Integrate delivered Code navigation and Yuxi channel recovery into Canvas trial source

This commit is contained in:
鲨鱼辣椒 committed 2026-10-14 00:10:15 +08:00
1 parent 2ca6e3199d
commit 3fe3fdb1c0
38 files changed
+1602 -198

No files matched your search

+21 -11
View File
@@ -186,9 +186,9 @@ async function expectKnowledgeLayout(page: Page) {
const selection = knowledge.getByRole('region', { name: '选择知识库', exact: true });
await expect(creation.getByRole('button', { name: '新建知识库', exact: true })).toBeVisible();
await expect(creation.getByRole('combobox', { name: '管理的知识库', exact: true })).toHaveCount(0);
await expect(creation.getByRole('button', { name: '从电脑上传', exact: true })).toHaveCount(0);
await expect(creation.getByRole('button', { name: '从电脑上传', exact: true })).toBeVisible();
await expect(management.getByRole('combobox', { name: '管理的知识库', exact: true })).toBeVisible();
await expect(management.getByRole('button', { name: '从电脑上传', exact: true })).toBeVisible();
await expect(management.getByRole('button', { name: '从电脑上传', exact: true })).toHaveCount(0);
await expect(management.getByRole('button', { name: '新建知识库', exact: true })).toHaveCount(0);
await expect(management.locator('summary').filter({ hasText: '使用说明与费用' })).toHaveCount(0);
await expect(management.getByText('上传到知识库的文档可供获准使用此智能体的人检索。解析并建立索引后才会生效;embedding 向量化由平台承担,不计入用户用量、词元点数或智能体费用上限。知识处理如触发对话模型调用,仍按原模型实际用量计费。', { exact: true })).toHaveCount(0);
@@ -212,8 +212,11 @@ async function expectKnowledgeLayout(page: Page) {
const create = await creation.getByRole('button', { name: '新建知识库', exact: true }).boundingBox();
const manager = await management.getByRole('combobox', { name: '管理的知识库', exact: true }).boundingBox();
const refresh = await management.getByRole('button', { name: '刷新知识库与模型', exact: true }).boundingBox();
const upload = await management.getByRole('button', { name: '从电脑上传', exact: true }).boundingBox();
const upload = await creation.getByRole('button', { name: '从电脑上传', exact: true }).boundingBox();
const controls = await management.locator('.agent-knowledge-management-controls').boundingBox();
expect(create!.x + create!.width).toBeLessThanOrEqual(upload!.x);
expect(upload!.x + upload!.width).toBeLessThanOrEqual(creationBounds!.x + creationBounds!.width);
expect(manager!.x + manager!.width).toBeLessThanOrEqual(refresh!.x);
for (const control of [manager, refresh, upload]) {
expect(Math.abs(control!.y + control!.height / 2 - create!.y - create!.height / 2)).toBeLessThanOrEqual(1);
}
@@ -305,7 +308,7 @@ for (const width of [375, 1440]) {
const creation = knowledge.getByRole('region', { name: '上传自己的文件', exact: true });
const management = knowledge.getByRole('region', { name: '查看我的知识库', exact: true });
const manager = management.getByRole('combobox', { name: '管理的知识库', exact: true });
const upload = management.getByRole('button', { name: '从电脑上传', exact: true });
const upload = creation.getByRole('button', { name: '从电脑上传', exact: true });
const create = creation.getByRole('button', { name: '新建知识库', exact: true });
await expect(upload).toBeDisabled();
await expectKnowledgeLayout(page);
@@ -382,15 +385,22 @@ test('cancelled and failed uploads preserve shared choices and the personal draf
// An uncertain upload response keeps its retry attached to the same library.
await expect(knowledge.getByRole('combobox', { name: '管理的知识库', exact: true })).toBeDisabled();
await expect(knowledge.getByRole('button', { name: '新建知识库', exact: true })).toBeDisabled();
await page.setViewportSize({ width: 1440, height: 850 });
const creationCard = knowledge.getByRole('region', { name: '上传自己的文件', exact: true });
const managementCard = knowledge.getByRole('region', { name: '查看我的知识库', exact: true });
const managementBounds = await managementCard.boundingBox();
for (const control of await managementCard.locator('.agent-knowledge-management-controls').getByRole('button').all()) {
const bounds = await control.boundingBox();
expect(bounds!.x).toBeGreaterThanOrEqual(managementBounds!.x);
expect(bounds!.x + bounds!.width).toBeLessThanOrEqual(managementBounds!.x + managementBounds!.width);
await expect(creationCard.getByRole('button', { name: '重新选择同一文件并重试', exact: true })).toBeEnabled();
await expect(managementCard.getByRole('button', { name: '重新选择同一文件并重试', exact: true })).toHaveCount(0);
for (const width of [375, 768, 1024, 1440]) {
await page.setViewportSize({ width, height: 850 });
for (const [card, row] of [[creationCard, '.agent-knowledge-create-action'], [managementCard, '.agent-knowledge-management-controls']] as const) {
const cardBounds = await card.boundingBox();
for (const control of await card.locator(row).getByRole('button').all()) {
const bounds = await control.boundingBox();
expect(bounds!.x).toBeGreaterThanOrEqual(cardBounds!.x);
expect(bounds!.x + bounds!.width).toBeLessThanOrEqual(cardBounds!.x + cardBounds!.width);
}
}
await expectNoClipping(page);
}
await expectNoClipping(page);
await page.setViewportSize({ width: 375, height: 850 });
const failedUpload = (await calls(page)).filter(call => call.path.endsWith('/knowledge/pick')).at(-1)!;
await page.evaluate(() => { (window as unknown as FixtureWindow).__knowledgeFixture.upload = 'cancel'; });