fix(knowledge): align embedding configuration with Yuxi
This commit is contained in:
@@ -38,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: ++knowledgeCatalogLoads === 1 ? [] : [{ id: 'fixture:test-embedding', name: '资料向量模型' }] });
|
||||
if (body.operation === 'knowledge') return result({ databases: [], models: ++knowledgeCatalogLoads === 1 ? [] : [{ id: 'fixture:test-embedding', name: '资料向量模型', dimension: 1024 }] });
|
||||
if (body.operation === 'resources') return result({ mcps: [], skills: [], subagents: [] });
|
||||
if (body.operation === 'budget' || body.operation === 'saveBudget') {
|
||||
if (body.operation === 'saveBudget') limits = input;
|
||||
@@ -104,7 +104,8 @@ test('personal cloud Agent creation, draft save and leave protection in Electron
|
||||
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 expect(page.getByText(/Yuxi 后台/)).toContainText('服务地址和 API Key');
|
||||
await expect(page.getByText(/Works Square 运营后台|one-api/)).toHaveCount(0);
|
||||
await page.getByLabel('知识库名称', { exact: true }).fill('我的创作资料');
|
||||
await page.screenshot({ path: testInfo.outputPath('knowledge-empty.png') });
|
||||
await page.getByRole('button', { name: '刷新知识库与模型', exact: true }).click();
|
||||
|
||||
@@ -6,7 +6,7 @@ const api = vi.hoisted(() => ({ call: vi.fn() }));
|
||||
vi.mock('@/lib/cloud-agents-api', () => ({ cloudAgentsApi: api }));
|
||||
const slug = 'ml-' + 'a'.repeat(32);
|
||||
const empty = { databases: [], models: [] };
|
||||
const available = { ...empty, models: [{ id: 'relay:fixture-embedding', name: '资料向量模型' }] };
|
||||
const available = { ...empty, models: [{ id: 'relay:fixture-embedding', name: '资料向量模型', dimension: 1024 }] };
|
||||
|
||||
beforeEach(() => vi.resetAllMocks());
|
||||
afterEach(cleanup);
|
||||
@@ -20,11 +20,12 @@ function openCreation() {
|
||||
it('explains who configures an empty embedding catalog and refreshes without losing the name', async () => {
|
||||
api.call.mockResolvedValueOnce(empty).mockResolvedValueOnce(available);
|
||||
openCreation();
|
||||
expect(await screen.findByText('暂时没有可用的向量模型。请联系平台管理员完成云端配置,然后刷新。')).toBeVisible();
|
||||
expect(await screen.findByText('暂时没有可用的向量模型。请联系平台管理员在 Yuxi 完成配置,然后刷新。')).toBeVisible();
|
||||
expect(screen.getByRole('combobox', { name: '向量模型' })).toBeDisabled();
|
||||
fireEvent.click(screen.getByText('管理员配置说明'));
|
||||
expect(screen.getByText(/Yuxi 后台/)).toHaveTextContent('智能体管理 → 模型供应商');
|
||||
expect(screen.getByText(/Works Square 运营后台/)).toHaveTextContent('模型管理');
|
||||
expect(screen.getByText(/Yuxi 后台/)).toHaveTextContent('服务地址和 API Key');
|
||||
expect(screen.queryByText(/Works Square 运营后台|one-api/)).not.toBeInTheDocument();
|
||||
fireEvent.change(screen.getByRole('textbox', { name: '知识库名称' }), { target: { value: '创作资料' } });
|
||||
fireEvent.click(screen.getByRole('button', { name: '刷新知识库与模型' }));
|
||||
expect(await screen.findByRole('option', { name: '资料向量模型' })).toBeInTheDocument();
|
||||
|
||||
Reference in New Issue
Block a user