Skip to content

Commit

Permalink
fix(agent): fix processing undefined read from readable stream. (#3206)
Browse files Browse the repository at this point in the history
  • Loading branch information
icycodes authored Sep 26, 2024
1 parent abdf72a commit 765c7fc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions clients/tabby-agent/src/chat/inlineEdit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -436,11 +436,11 @@ export class ChatEditProvider implements Feature {
// Insert the first line as early as possible so codelens can be shown
await applyEdit(this.currentEdit, true, false);

for await (const delta of stream) {
for await (const item of stream) {
if (!this.mutexAbortController || this.mutexAbortController.signal.aborted) {
break;
}

const delta = typeof item === "string" ? item : "";
const edit = this.currentEdit;
edit.buffer += delta;

Expand Down
3 changes: 2 additions & 1 deletion clients/tabby-agent/src/utils/string.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,8 @@ import type { Readable } from "readable-stream";
export async function parseChatResponse(readableStream: Readable): Promise<string> {
let output = "";
try {
for await (const delta of readableStream) {
for await (const item of readableStream) {
const delta = typeof item === "string" ? item : "";
output += delta;
}
} catch (error) {
Expand Down

0 comments on commit 765c7fc

Please sign in to comment.