Merge branch 'feat/backend' into feat/front-end

This commit is contained in:
Roe-xin
2026-02-25 10:15:50 +08:00
3 changed files with 18 additions and 2 deletions

View File

@ -41,6 +41,7 @@ export interface MessageSegment {
toolName?: string;
toolStatus?: "running" | "success" | "error";
toolResult?: string;
toolDescription?: string;
askId?: string;
question?: string;
options?: string[];
@ -180,7 +181,8 @@ export class DialogSession {
private updateToolSegment(
toolName: string,
status: "success" | "error",
result?: string
result?: string,
description?: string
): void {
// 找到最后一个匹配的工具段落
for (let i = this.segments.length - 1; i >= 0; i--) {
@ -192,6 +194,9 @@ export class DialogSession {
) {
seg.toolStatus = status;
seg.toolResult = result;
if (description !== undefined) {
seg.toolDescription = description;
}
break;
}
}
@ -590,7 +595,7 @@ export class DialogSession {
},
onToolComplete: (data) => {
this.updateToolSegment(data.tool_name, "success", data.result);
this.updateToolSegment(data.tool_name, "success", data.result, data.description);
callbacks.onToolComplete?.(data.tool_name, data.result);
// 实时发送段落更新
callbacks.onSegmentUpdate?.(this.segments);