chore: update appcast and TUI streaming handling
This commit is contained in:
@@ -8,6 +8,7 @@ export class ChatLog extends Container {
|
||||
private toolById = new Map<string, ToolExecutionComponent>();
|
||||
private streamingAssistant: AssistantMessageComponent | null = null;
|
||||
private streamingRunId: string | null = null;
|
||||
private streamingText: string | null = null;
|
||||
private toolsExpanded = false;
|
||||
|
||||
clearAll() {
|
||||
@@ -15,6 +16,7 @@ export class ChatLog extends Container {
|
||||
this.toolById.clear();
|
||||
this.streamingAssistant = null;
|
||||
this.streamingRunId = null;
|
||||
this.streamingText = null;
|
||||
}
|
||||
|
||||
addSystem(text: string) {
|
||||
@@ -30,6 +32,7 @@ export class ChatLog extends Container {
|
||||
const component = new AssistantMessageComponent(text);
|
||||
this.streamingAssistant = component;
|
||||
this.streamingRunId = runId ?? null;
|
||||
this.streamingText = text;
|
||||
this.addChild(component);
|
||||
return component;
|
||||
}
|
||||
@@ -42,17 +45,23 @@ export class ChatLog extends Container {
|
||||
this.startAssistant(text, runId);
|
||||
return;
|
||||
}
|
||||
this.streamingText = text;
|
||||
this.streamingAssistant.setText(text);
|
||||
}
|
||||
|
||||
finalizeAssistant(text: string, runId?: string) {
|
||||
if (this.streamingAssistant && (!runId || runId === this.streamingRunId)) {
|
||||
if (
|
||||
this.streamingAssistant &&
|
||||
(!runId || runId === this.streamingRunId || text === this.streamingText)
|
||||
) {
|
||||
this.streamingText = text;
|
||||
this.streamingAssistant.setText(text);
|
||||
} else {
|
||||
this.startAssistant(text, runId);
|
||||
}
|
||||
this.streamingAssistant = null;
|
||||
this.streamingRunId = null;
|
||||
this.streamingText = null;
|
||||
}
|
||||
|
||||
startTool(toolCallId: string, toolName: string, args: unknown) {
|
||||
|
||||
Reference in New Issue
Block a user