fix: 完善知识库向量模型配置提示与刷新

This commit is contained in:
2026-09-12 20:35:11 +08:00
parent a0b869a333
commit 3507f70e11
5 changed files with 181 additions and 9 deletions

View File

@@ -12,6 +12,7 @@ test('personal cloud Agent creation, draft save and leave protection in Electron
BrowserWindow.getAllWindows()[0].setSize(1366, 768);
let draft: Record<string, unknown> | null = null;
let recent: unknown = null;
let knowledgeCatalogLoads = 0;
let limits: { request_limit_points: string | null; daily_limit_points: string | null } = { request_limit_points: null, daily_limit_points: null };
const jobs: Record<string, unknown>[] = [];
const configuration = { model: '', tools: [], knowledges: [], mcps: [], skills: [], preload_skills: [], subagents: [], tool_approval_mode: 'default', max_execution_steps: 40, max_output_tokens: 4096, max_run_seconds: 600 };
@@ -37,7 +38,7 @@ test('personal cloud Agent creation, draft save and leave protection in Electron
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 === 'knowledge') return result({ databases: [], models: [] });
if (body.operation === 'knowledge') return result({ databases: [], models: ++knowledgeCatalogLoads === 1 ? [] : [{ id: 'fixture:test-embedding', name: '资料向量模型' }] });
if (body.operation === 'resources') return result({ mcps: [], skills: [], subagents: [] });
if (body.operation === 'budget' || body.operation === 'saveBudget') {
if (body.operation === 'saveBudget') limits = input;
@@ -90,6 +91,22 @@ test('personal cloud Agent creation, draft save and leave protection in Electron
await page.getByRole('button', { name: '保存草稿', exact: true }).click();
await expect(page.getByRole('button', { name: '已保存', exact: true })).toBeVisible();
await expect(page.getByTestId('titlebar-page-title')).toHaveText('智能体工作区');
await page.getByRole('button', { name: '知识', exact: true }).click();
await page.getByText('管理我的知识文档', { exact: true }).click();
await page.getByRole('button', { name: '新建知识库', exact: true }).click();
await expect(page.getByLabel('向量模型', { exact: true })).toBeDisabled();
await page.getByText('管理员配置说明', { exact: true }).click();
await expect(page.getByText(/Yuxi 后台/)).toContainText('智能体管理 → 模型供应商');
await expect(page.getByText(/Works Square 运营后台/)).toBeVisible();
await page.getByLabel('知识库名称', { exact: true }).fill('我的创作资料');
await page.screenshot({ path: testInfo.outputPath('knowledge-empty.png') });
await page.getByRole('button', { name: '刷新知识库与模型', exact: true }).click();
await page.getByLabel('向量模型', { exact: true }).selectOption('fixture:test-embedding');
await expect(page.getByLabel('知识库名称', { exact: true })).toHaveValue('我的创作资料');
await expect(page.getByRole('button', { name: '创建并选用', exact: true })).toBeEnabled();
await expect(page.getByText('管理员配置说明', { exact: true })).toHaveCount(0);
await page.getByLabel('知识库名称', { exact: true }).fill('');
await page.getByRole('button', { name: '新建知识库', exact: true }).click();
await page.getByRole('button', { name: '指令', exact: true }).click();
const preview = page.getByRole('region', { name: '草稿预览', exact: true });
await preview.getByLabel('消息').fill('先给我一些创作建议');