Skip to content

Commit

Permalink
fix(claude): add streaming response delay (#47)
Browse files Browse the repository at this point in the history
添加延时处理
  • Loading branch information
zhaopengme authored Aug 11, 2023
1 parent 7a0b0e6 commit 1fd52bc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/api/claude/append_message/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ async function claudeWebApiStream(response: any) {
async pull(controller) {
const { value, done } = await reader?.read();
if (done) {
controller.close();
setTimeout(() => {
controller.close();
}, 0);
} else {
let content: string = '';
const lines = decoder.decode(value).split("\n");
Expand All @@ -51,4 +53,4 @@ async function claudeWebApiStream(response: any) {
}
},
})
}
}

0 comments on commit 1fd52bc

Please sign in to comment.