添加工具调用解析和聊天工具操作处理

This commit is contained in:
2026-04-03 11:49:05 +08:00
parent a1c8041b11
commit d610a09c14
11 changed files with 1269 additions and 18 deletions
+15
View File
@@ -9,6 +9,12 @@ export type StreamEvent =
conversationId?: string;
message: string;
detail?: string;
}
| {
type: "tool_call";
conversationId: string;
tool: string;
params: Record<string, unknown>;
};
type StreamOptions = {
@@ -113,6 +119,8 @@ export const streamCopilotChat = async ({
content?: string;
message?: string;
detail?: string;
tool?: string;
params?: Record<string, unknown>;
};
if (event === "token") {
onEvent({
@@ -132,6 +140,13 @@ export const streamCopilotChat = async ({
message: parsed.message ?? "unknown error",
detail: parsed.detail,
});
} else if (event === "tool_call") {
onEvent({
type: "tool_call",
conversationId: parsed.conversationId ?? "",
tool: parsed.tool ?? "",
params: parsed.params ?? {},
});
}
} catch {
onEvent({