-
Notifications
You must be signed in to change notification settings - Fork 434
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ui): add abort button's logic, fix rehypePrism type error
- Loading branch information
Showing
8 changed files
with
82 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,24 @@ | ||
import type { Setter } from 'solid-js' | ||
|
||
export const convertReadableStreamToAccessor = async(stream: ReadableStream, setter: Setter<string>) => { | ||
const reader = stream.getReader() | ||
const decoder = new TextDecoder('utf-8') | ||
let done = false | ||
let text = '' | ||
while (!done) { | ||
const { value, done: readerDone } = await reader.read() | ||
if (value) { | ||
const char = decoder.decode(value) | ||
if (char) { | ||
text += char | ||
setter(text) | ||
try { | ||
const reader = stream.getReader() | ||
const decoder = new TextDecoder('utf-8') | ||
let done = false | ||
while (!done) { | ||
const { value, done: readerDone } = await reader.read() | ||
if (value) { | ||
const char = decoder.decode(value) | ||
if (char) { | ||
text += char | ||
setter(text) | ||
} | ||
} | ||
done = readerDone | ||
} | ||
done = readerDone | ||
return text | ||
} catch (error) { | ||
return text | ||
} | ||
return text | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
aae7830
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yzh990918 is attempting to deploy a commit to the Anse Team on Vercel.
To accomplish this, @yzh990918 needs to request access to the Team.
Afterwards, an owner of the Team is required to accept their membership request.
If you're already a member of the respective Vercel Team, make sure that your Personal Vercel Account is connected to your GitHub account.