feat(agents): 展示云端通俗技能与工具文案
This commit is contained in:
1 parent
23aa927441
commit
821fd6ffbe
16 files changed
+118
-23
No files matched your search
@@ -52,7 +52,10 @@ test('personal cloud Agent creation, draft save and leave protection in Electron
|
||||
if (path.endsWith('/recovery/recent')) { recent = body; return result({ saved: true }); }
|
||||
if (path.endsWith('/actions')) {
|
||||
const input = body.input ?? {};
|
||||
if (body.operation === 'catalog') return result({ models: [{ id: 'test-model', name: '创作模型' }], resources: {}, pricing: null });
|
||||
if (body.operation === 'catalog') return result({ models: [{ id: 'test-model', name: '创作模型' }], resources: {
|
||||
tools: [{ key: 'web_search', name: '上网查资料', description: '在网上查找相关信息。' }],
|
||||
skills: [{ key: 'deep-research', name: '查资料,做研究', description: '比较不同说法,再整理出结论和出处。' }],
|
||||
}, pricing: null });
|
||||
if (body.operation === 'knowledge') return result({ databases: knowledgeCreated ? [{ kb_id: 'kb', name: '我的创作资料' }] : [], models: ++knowledgeCatalogLoads === 1 ? [] : [{ id: 'fixture:test-embedding', name: '资料向量模型', dimension: 1024 }] });
|
||||
if (body.operation === 'createKnowledge') { knowledgeCreated = true; return result({ kb_id: 'kb', name: '我的创作资料' }); }
|
||||
if (body.operation === 'processKnowledge') { knowledgeStage = 0; return result({ task_id: 'process-document' }); }
|
||||
@@ -145,6 +148,11 @@ test('personal cloud Agent creation, draft save and leave protection in Electron
|
||||
await expect(page.getByRole('tabpanel', { name: '高级设置' })).toBeVisible();
|
||||
await expect(page.getByLabel('特别要求')).toBeHidden();
|
||||
await expect(page.getByRole('button', { name: '能力', exact: true })).toHaveAttribute('aria-current', 'page');
|
||||
await page.getByRole('button', { name: '选择工具', exact: true }).click();
|
||||
await expect(page.getByRole('checkbox', { name: /上网查资料.*在网上查找相关信息/ })).toBeVisible();
|
||||
await page.getByRole('button', { name: '选择技能', exact: true }).click();
|
||||
await page.getByLabel('搜索技能', { exact: true }).fill('出处');
|
||||
await expect(page.getByRole('checkbox', { name: /查资料,做研究.*出处/ })).toBeVisible();
|
||||
await advancedTab.click();
|
||||
await expect(advancedTab).toHaveAttribute('aria-selected', 'true');
|
||||
await page.screenshot({ path: testInfo.outputPath('cloud-agent-advanced-tab.png') });
|
||||
|
||||
@@ -35,7 +35,7 @@ test('personal chat displays thinking, tools and Markdown, then restores them af
|
||||
id: 1, message_id: 'answer', role: 'assistant', run_id: run.agent_run_id, request_id: run.request_id, created_at: '',
|
||||
content: '## 整理结果\n\n| 项目 | 状态 |\n| --- | --- |\n| 资料 | 已核对 |\n\n**可以使用**',
|
||||
reasoning_content: '先核对来源,再整理结果。',
|
||||
tool_calls: [{ id: 'lookup', name: '资料检索', args: { query: '实际检索资料' }, status: 'success', tool_call_result: { content: '找到两条资料' } }],
|
||||
tool_calls: [{ id: 'lookup', name: 'web_search', display_name: '上网查资料', display_description: '在网上查找相关信息。', args: { query: '实际检索资料' }, status: 'success', tool_call_result: { content: '找到两条资料' } }],
|
||||
}] : [] });
|
||||
if (body.operation === 'run') return result({ ...run, status: complete ? 'completed' : 'running' });
|
||||
if (body.operation === 'viewed') return result({});
|
||||
@@ -71,7 +71,7 @@ test('personal chat displays thinking, tools and Markdown, then restores them af
|
||||
const process = page.getByTestId('cloud-message-process');
|
||||
await expect(page.getByLabel('智能体思考过程')).toBeVisible();
|
||||
await emit([
|
||||
{ stream_event: { type: 'tool_call', message_id: 'answer', tool_call_id: 'lookup', name: '资料检索', args: { query: '测试资料' } } },
|
||||
{ stream_event: { type: 'tool_call', message_id: 'answer', tool_call_id: 'lookup', name: 'web_search', display_name: '上网查资料', display_description: '在网上查找相关信息。', args: { query: '测试资料' } } },
|
||||
{ event: { method: 'tools', data: { event: 'tool-started', tool_call_id: 'lookup', input: { query: '实际检索资料' } } } },
|
||||
{ event: { method: 'tools', data: { event: 'tool-finished', tool_call_id: 'lookup', output: { content: '找到两条资料' } } } },
|
||||
{ stream_event: { type: 'message_delta', message_id: 'answer', content: '## 整理结果\n\n| 项目 | 状态 |\n| --- | --- |\n| 资料 | 已核对 |\n\n**可以使用**' } },
|
||||
@@ -79,8 +79,10 @@ test('personal chat displays thinking, tools and Markdown, then restores them af
|
||||
await expect(page.getByRole('heading', { name: '整理结果' })).toBeVisible();
|
||||
await expect(page.getByRole('table')).toBeVisible();
|
||||
await process.locator(':scope > summary').click();
|
||||
await process.getByText('资料检索 · 已完成', { exact: true }).click();
|
||||
await process.getByText('上网查资料 · 已完成', { exact: true }).click();
|
||||
await expect(process.getByText('找到两条资料', { exact: true })).toBeVisible();
|
||||
await expect(process.getByText('在网上查找相关信息。', { exact: true })).toBeVisible();
|
||||
await expect(process.getByText('工具标识:web_search', { exact: true })).toBeVisible();
|
||||
await expect(process.getByText('"实际检索资料"', { exact: false })).toBeVisible();
|
||||
await page.screenshot({ path: testInfo.outputPath('personal-chat-process.png') });
|
||||
await app.evaluate(() => (globalThis as unknown as { finishRenderRun: () => void }).finishRenderRun());
|
||||
@@ -91,7 +93,9 @@ test('personal chat displays thinking, tools and Markdown, then restores them af
|
||||
await expect(page.getByRole('heading', { name: '整理结果' })).toBeVisible();
|
||||
await page.getByTestId('cloud-message-process').locator(':scope > summary').click();
|
||||
await expect(page.getByLabel('智能体思考过程')).toHaveText('先核对来源,再整理结果。');
|
||||
await expect(page.getByText('资料检索 · 已完成', { exact: true })).toBeVisible();
|
||||
await page.getByText('上网查资料 · 已完成', { exact: true }).click();
|
||||
await expect(page.getByText('在网上查找相关信息。', { exact: true })).toBeVisible();
|
||||
await expect(page.getByText('工具标识:web_search', { exact: true })).toBeVisible();
|
||||
await page.screenshot({ path: testInfo.outputPath('personal-chat-reopened.png') });
|
||||
} finally { await closeElectronApp(app); }
|
||||
});
|
||||
Reference in new issue
Block a user