添加工具调用解析和聊天工具操作处理
This commit is contained in:
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user