Skip to content

Commit

Permalink
Merge pull request #3670 from chauvinSimon/fix/http-slash-command
Browse files Browse the repository at this point in the history
fix - resolve TypeError for http-slash-command
  • Loading branch information
sestinj authored Jan 10, 2025
2 parents 50e7b55 + c382d3e commit ca39ffa
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions core/commands/slash/http.ts
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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;
}
},
};
Expand Down

0 comments on commit ca39ffa

Please sign in to comment.