-
Notifications
You must be signed in to change notification settings - Fork 60.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
5 changed files
with
25 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,15 @@ async function createStream(req: NextRequest) { | |
|
||
const res = await requestOpenai(req); | ||
|
||
const contentType = res.headers.get("Content-Type") ?? ""; | ||
if (!contentType.includes("stream")) { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
gaogao1030
Contributor
|
||
const content = await ( | ||
await res.text() | ||
).replace(/provided:.*. You/, "provided: ***. You"); | ||
console.log("[Stream] error ", content); | ||
return "```json\n" + content + "```"; | ||
} | ||
|
||
const stream = new ReadableStream({ | ||
async start(controller) { | ||
function onParse(event: any) { | ||
|
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
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
1 comment
on commit b44caee
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.
Successfully deployed to the following URLs:
chat-gpt-next-web – ./
chat-gpt-next-web-git-main-yidadaa.vercel.app
chat-gpt-next-web-yidadaa.vercel.app
chat.simplenaive.cn
chat-gpt-next-web.vercel.app
前天本地调试的时候发现被阻塞住了,后面定位原因就发现这边没对res不是流的情况处理.本来想抽空提个pr的没想到发现这个提交里处理了。错过一次当贡献者的机会…