feat(agents): 展示云端通俗技能与工具文案

This commit is contained in:
brother7 committed 2026-10-13 10:25:11 +08:00
1 parent 23aa927441
commit 821fd6ffbe
16 files changed
+118 -23

No files matched your search

+5 -2
View File
@@ -74,14 +74,17 @@ it('associates tool arguments and results by call identity, keeps failures visib
render(<CloudChat slug="agent" />);
await waitFor(() => expect(api.events).toHaveBeenCalled());
await emit([
{ stream_event: { type: 'tool_call_delta', message_id: 'm', tool_call_id: 'search', name: '查资料', args_delta: '{"query":', index: 0 } },
{ stream_event: { type: 'tool_call_delta', message_id: 'm', tool_call_id: 'search', name: 'web_search',
display_name: '上网查资料', display_description: '在网上查找相关信息。', args_delta: '{"query":', index: 0 } },
{ stream_event: { type: 'tool_call_delta', message_id: 'm', args_delta: '"天气"}', index: 0 } },
{ stream_event: { type: 'tool_call', message_id: 'm', tool_call_id: 'write', name: '写文件', args: { path: '/a' }, index: 1 } },
{ event: { method: 'tools', data: { event: 'tool-finished', tool_call_id: 'write', output: { content: '磁盘不足', status: 'error' } } } },
{ event: { method: 'tools', data: { event: 'tool-finished', tool_call_id: 'search', output: { content: '晴天', status: 'success' } } } },
], '101-0');
const process = screen.getByTestId('cloud-message-process');
expect(process).toHaveTextContent('查资料 · 已完成');
expect(process).toHaveTextContent('上网查资料 · 已完成');
expect(process).toHaveTextContent('在网上查找相关信息。');
expect(process).toHaveTextContent('工具标识:web_search');
expect(process).toHaveTextContent('写文件 · 失败');
expect(within(process).getByText('{"query":"天气"}')).toBeInTheDocument();
expect(within(process).getByText('晴天')).toBeInTheDocument();