mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-26 10:45:57 +08:00
feat(core): poll context docs and files embedding status (#10843)
Close [BS-2791](https://linear.app/affine-design/issue/BS-2791). ### What Changed? - Add status filed to `CopilotContextDoc` to querying document embedding processing progress. - Change `ChipState` from `success` to `finished` to better align with backend server status. - Add `pollContextDocsAndFiles` API for embedding status polling. ### About Polling - Set the minimum interval to 1 second and the maximum interval to 30 seconds - Use exponential backoff and increase the interval by 50% after each poll - Make sure the interval does not exceed the maximum
This commit is contained in:
@@ -1026,7 +1026,7 @@ test.describe('chat with doc', () => {
|
||||
expect(await chipTitle.textContent()).toBe('Untitled');
|
||||
let chip = await page.getByTestId('chat-panel-chip');
|
||||
// oxlint-disable-next-line unicorn/prefer-dom-node-dataset
|
||||
expect(await chip.getAttribute('data-state')).toBe('success');
|
||||
expect(await chip.getAttribute('data-state')).toBe('finished');
|
||||
|
||||
const editorTitle = await page.locator('doc-title .inline-editor').nth(0);
|
||||
await editorTitle.pressSequentially('AFFiNE AI', {
|
||||
@@ -1048,7 +1048,7 @@ test.describe('chat with doc', () => {
|
||||
|
||||
expect(await chipTitle.textContent()).toBe('AFFiNE AI');
|
||||
// oxlint-disable-next-line unicorn/prefer-dom-node-dataset
|
||||
expect(await chip.getAttribute('data-state')).toBe('success');
|
||||
expect(await chip.getAttribute('data-state')).toBe('finished');
|
||||
|
||||
await typeChatSequentially(page, 'What is AFiAI?');
|
||||
await page.keyboard.press('Enter');
|
||||
@@ -1071,6 +1071,6 @@ test.describe('chat with doc', () => {
|
||||
expect(await chipTitle.textContent()).toBe('AFFiNE AI');
|
||||
const chip2 = await page.getByTestId('chat-panel-chip');
|
||||
// oxlint-disable-next-line unicorn/prefer-dom-node-dataset
|
||||
expect(await chip2.getAttribute('data-state')).toBe('success');
|
||||
expect(await chip2.getAttribute('data-state')).toBe('finished');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user