update pay function
This commit is contained in:
@@ -519,8 +519,10 @@ export const agentHandlers = [
|
||||
await delay(200);
|
||||
|
||||
// 发送工具调用
|
||||
const toolCallResults = [];
|
||||
for (const tool of role.tools) {
|
||||
const toolCallId = `tc-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
||||
const execTime = 0.5 + Math.random() * 0.5;
|
||||
|
||||
// tool_call_start
|
||||
controller.enqueue(encoder.encode(`data: ${JSON.stringify({
|
||||
@@ -538,11 +540,20 @@ export const agentHandlers = [
|
||||
type: 'tool_call_result',
|
||||
role_id: role.role_id,
|
||||
tool_call_id: toolCallId,
|
||||
result: tool.result,
|
||||
tool_name: tool.name,
|
||||
result: { success: true, data: tool.result },
|
||||
status: 'success',
|
||||
execution_time: 0.5 + Math.random() * 0.5,
|
||||
execution_time: execTime,
|
||||
})}\n\n`));
|
||||
|
||||
toolCallResults.push({
|
||||
tool_call_id: toolCallId,
|
||||
tool_name: tool.name,
|
||||
result: { success: true, data: tool.result },
|
||||
status: 'success',
|
||||
execution_time: execTime,
|
||||
});
|
||||
|
||||
await delay(200);
|
||||
}
|
||||
|
||||
@@ -561,8 +572,13 @@ export const agentHandlers = [
|
||||
controller.enqueue(encoder.encode(`data: ${JSON.stringify({
|
||||
type: 'message_complete',
|
||||
role_id: role.role_id,
|
||||
content: role.content,
|
||||
is_conclusion: role.is_conclusion || false,
|
||||
message: {
|
||||
role_id: role.role_id,
|
||||
role_name: role.role_name,
|
||||
content: role.content,
|
||||
tool_calls: toolCallResults,
|
||||
is_conclusion: role.is_conclusion || false,
|
||||
},
|
||||
})}\n\n`));
|
||||
|
||||
await delay(500);
|
||||
|
||||
@@ -358,7 +358,9 @@ export const useInvestmentMeeting = ({
|
||||
|
||||
case 'message_complete':
|
||||
if (data.role_id) {
|
||||
finishStreamingMessage(data.role_id, data.content);
|
||||
// 后端可能发送 message 对象或直接 content
|
||||
const finalContent = data.message?.content || data.content;
|
||||
finishStreamingMessage(data.role_id, finalContent);
|
||||
setSpeakingRoleId(null);
|
||||
}
|
||||
break;
|
||||
@@ -561,7 +563,9 @@ export const useInvestmentMeeting = ({
|
||||
|
||||
case 'message_complete':
|
||||
if (data.role_id) {
|
||||
finishStreamingMessage(data.role_id, data.content);
|
||||
// 后端可能发送 message 对象或直接 content
|
||||
const finalContent = data.message?.content || data.content;
|
||||
finishStreamingMessage(data.role_id, finalContent);
|
||||
setSpeakingRoleId(null);
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user