mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-12 14:40:22 +08:00
feat(server): improve context management (#15448)
#### PR Dependency Tree * **PR #15448** 👈 This tree was auto-generated by [Charcoal](https://github.com/danerwilliams/charcoal) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added workspace artifact upload, browsing, removal, deduplication, and library ownership support. * Copilot now supports scoped document and artifact search, canvas reading, live editor context, and frontend tools. * Added scope and focus selectors with source-resolution receipts in chat. * Added embedding health, progress, synchronization, and retrieval capabilities. * Added BYOK policy visibility, provider restrictions, endpoint dialect selection, and validation. * Added delegated editor interactions and userdata document authorization. * **Bug Fixes** * Improved attachment handling, cancellation, access control, retrieval fallbacks, workspace synchronization, and configuration validation. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -7,7 +7,7 @@ test.describe.configure({ mode: 'serial' });
|
||||
|
||||
test.describe('AISettings/Embedding', () => {
|
||||
test.beforeEach(async ({ loggedInPage: page, utils }) => {
|
||||
await utils.testUtils.setupTestEnvironment(page, 'claude-sonnet-4-6');
|
||||
await utils.testUtils.setupTestEnvironment(page);
|
||||
await utils.chatPanel.openChatPanel(page);
|
||||
});
|
||||
|
||||
@@ -158,28 +158,8 @@ test.describe('AISettings/Embedding', () => {
|
||||
},
|
||||
];
|
||||
|
||||
const client = await page.context().newCDPSession(page);
|
||||
await client.send('Network.enable');
|
||||
await client.send('Network.emulateNetworkConditions', {
|
||||
offline: false,
|
||||
latency: 1000,
|
||||
downloadThroughput: (50 * 1024) / 8,
|
||||
uploadThroughput: (50 * 1024) / 8,
|
||||
connectionType: 'cellular3g',
|
||||
});
|
||||
|
||||
await utils.settings.uploadWorkspaceEmbedding(page, attachments);
|
||||
|
||||
await client.send('Network.emulateNetworkConditions', {
|
||||
offline: false,
|
||||
latency: 0,
|
||||
downloadThroughput: -1,
|
||||
uploadThroughput: -1,
|
||||
});
|
||||
|
||||
await utils.settings.disableWorkspaceEmbedding(page);
|
||||
await utils.settings.enableWorkspaceEmbedding(page);
|
||||
|
||||
await utils.settings.waitForFileEmbeddingReadiness(page, 2);
|
||||
|
||||
await utils.settings.closeSettingsPanel(page);
|
||||
@@ -236,7 +216,7 @@ test.describe('AISettings/Embedding', () => {
|
||||
await page.context().setOffline(false);
|
||||
});
|
||||
|
||||
test('should support hybrid search for both globally uploaded attachments and those uploaded in the current session', async ({
|
||||
test('should isolate selected attachments from workspace artifact search', async ({
|
||||
loggedInPage: page,
|
||||
utils,
|
||||
}) => {
|
||||
@@ -287,8 +267,8 @@ test.describe('AISettings/Embedding', () => {
|
||||
await expect(async () => {
|
||||
const { message } = await utils.chatPanel.getLatestAssistantMessage(page);
|
||||
const fullText = await message.innerText();
|
||||
expect(fullText).toMatch(/climbing/i);
|
||||
expect(fullText).toMatch(/skating/i);
|
||||
expect(fullText).not.toMatch(/climbing/i);
|
||||
expect(
|
||||
await message.locator('affine-footnote-node').count()
|
||||
).toBeGreaterThanOrEqual(1);
|
||||
@@ -305,7 +285,7 @@ test.describe('AISettings/Embedding', () => {
|
||||
const attachments = Array.from({ length: 11 }, (_, i) => ({
|
||||
name: `document${i + 1}.txt`,
|
||||
mimeType: 'text/plain',
|
||||
buffer: Buffer.from('attachment content'),
|
||||
buffer: Buffer.from(`attachment content ${i + 1}`),
|
||||
}));
|
||||
|
||||
await utils.settings.uploadWorkspaceEmbedding(page, attachments);
|
||||
|
||||
Reference in New Issue
Block a user