mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-11 22:18:54 +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:
@@ -308,6 +308,7 @@ export async function enableCloudWorkspace(page: Page) {
|
||||
await waitForAllPagesLoad(page);
|
||||
await dismissBlockingModal(page);
|
||||
await clickNewPageButton(page);
|
||||
await waitForWorkspaceSynced(page);
|
||||
}
|
||||
|
||||
export async function enableCloudWorkspaceFromShareButton(page: Page) {
|
||||
@@ -324,6 +325,32 @@ export async function enableCloudWorkspaceFromShareButton(page: Page) {
|
||||
await waitForEditorLoad(page);
|
||||
await dismissBlockingModal(page);
|
||||
await clickNewPageButton(page);
|
||||
await waitForWorkspaceSynced(page);
|
||||
}
|
||||
|
||||
async function waitForWorkspaceSynced(page: Page) {
|
||||
await page.evaluate(async () => {
|
||||
const workspaceId = location.pathname.split('/')[2];
|
||||
const workspace = (
|
||||
window as typeof window & {
|
||||
currentWorkspace?: {
|
||||
engine: {
|
||||
doc: {
|
||||
waitForSynced(docId: string, abort: AbortSignal): Promise<void>;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
).currentWorkspace;
|
||||
if (!workspaceId || !workspace) {
|
||||
throw new Error('Cloud workspace is unavailable');
|
||||
}
|
||||
const abort = AbortSignal.timeout(60_000);
|
||||
await Promise.all([
|
||||
workspace.engine.doc.waitForSynced(workspaceId, abort),
|
||||
workspace.engine.doc.waitForSynced('db$docProperties', abort),
|
||||
]);
|
||||
});
|
||||
}
|
||||
|
||||
export async function enableShare(page: Page) {
|
||||
|
||||
Reference in New Issue
Block a user