Skip to content

Commit 8d58beb

Browse files
committed
feat:增加会话、调用及函数调用ID以请求前端工具结果的确认操作
1 parent a5eba01 commit 8d58beb

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

  • agents/matmaster_agent/sub_agents/built_in_agent/demo_frontend_agent

agents/matmaster_agent/sub_agents/built_in_agent/demo_frontend_agent/agent.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,20 @@
2727
class DemoFrontendAgent(BaseSyncAgentWithToolValidator):
2828
async def _run_events(self, ctx: InvocationContext) -> AsyncGenerator[Event, None]:
2929
function_call_id = f"added_{str(uuid.uuid4()).replace('-', '')[:24]}"
30+
# 在 args 里带上三 id,前端用户确认/取消后可用以请求 POST /awp/frontend-tool-result
3031
yield context_function_call_event(
3132
ctx,
3233
self.name,
3334
function_call_id,
3435
DEMO_FRONTEND_TOOL,
3536
ModelRole,
36-
{'message': '请确认', 'title': '前端 Demo Tool'},
37+
{
38+
'message': '请确认',
39+
'title': '前端 Demo Tool',
40+
'session_id': ctx.session.id,
41+
'invocation_id': ctx.invocation_id,
42+
'function_call_id': function_call_id,
43+
},
3744
)
3845
demo_result = await wait_for_frontend_tool_result(
3946
ctx.session.id, ctx.invocation_id, function_call_id

0 commit comments

Comments
 (0)