Merge pull request #3670 from chauvinSimon/fix/http-slash-command
fix - resolve TypeError for http-slash-command
This commit is contained in:
commit
ca39ffacd8
1 changed files with 3 additions and 8 deletions
|
|
@ -1,5 +1,6 @@
|
|||
import { SlashCommand } from "../../index.js";
|
||||
import { removeQuotesAndEscapes } from "../../util/index.js";
|
||||
import { streamResponse } from "../../llm/stream.js";
|
||||
|
||||
const HttpSlashCommand: SlashCommand = {
|
||||
name: "http",
|
||||
|
|
@ -23,14 +24,8 @@ const HttpSlashCommand: SlashCommand = {
|
|||
if (response.body === null) {
|
||||
throw new Error("Response body is null");
|
||||
}
|
||||
const reader = response.body.getReader();
|
||||
while (true) {
|
||||
const { done, value } = await reader.read();
|
||||
if (done) {
|
||||
break;
|
||||
}
|
||||
const decoded = new TextDecoder("utf-8").decode(value);
|
||||
yield decoded;
|
||||
for await (const chunk of streamResponse(response)) {
|
||||
yield chunk;
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue