mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-30 00:29:46 +08:00
feat(server): only trigger embedding in workspace sync (#12634)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Bug Fixes** - Improved handling of workspace embedding events to ensure they are only triggered for workspace-type spaces. - **Chores** - Added additional debug logging for document embedding jobs to aid in monitoring and troubleshooting. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -203,7 +203,9 @@ export class SpaceSyncGateway
|
|||||||
await client.join(room);
|
await client.join(room);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.event.emit('workspace.embedding', { workspaceId: spaceId });
|
if (spaceType === SpaceType.Workspace) {
|
||||||
|
this.event.emit('workspace.embedding', { workspaceId: spaceId });
|
||||||
|
}
|
||||||
await this.selectAdapter(client, spaceType).join(user.id, spaceId);
|
await this.selectAdapter(client, spaceType).join(user.id, spaceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -129,6 +129,10 @@ export class CopilotContextDocJob {
|
|||||||
if (enableDocEmbedding) {
|
if (enableDocEmbedding) {
|
||||||
const toBeEmbedDocIds =
|
const toBeEmbedDocIds =
|
||||||
await this.models.copilotWorkspace.findDocsToEmbed(workspaceId);
|
await this.models.copilotWorkspace.findDocsToEmbed(workspaceId);
|
||||||
|
this.logger.debug('Trigger embedding for docs', {
|
||||||
|
workspaceId,
|
||||||
|
toBeEmbedDocs: toBeEmbedDocIds.length,
|
||||||
|
});
|
||||||
for (const docId of toBeEmbedDocIds) {
|
for (const docId of toBeEmbedDocIds) {
|
||||||
await this.queue.add(
|
await this.queue.add(
|
||||||
'copilot.embedding.docs',
|
'copilot.embedding.docs',
|
||||||
|
|||||||
Reference in New Issue
Block a user