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:
darkskygit
2025-05-30 08:04:18 +00:00
parent 7b82dd656b
commit ada69c80f6
2 changed files with 7 additions and 1 deletions

View File

@@ -203,7 +203,9 @@ export class SpaceSyncGateway
await client.join(room);
}
} 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);
}

View File

@@ -129,6 +129,10 @@ export class CopilotContextDocJob {
if (enableDocEmbedding) {
const toBeEmbedDocIds =
await this.models.copilotWorkspace.findDocsToEmbed(workspaceId);
this.logger.debug('Trigger embedding for docs', {
workspaceId,
toBeEmbedDocs: toBeEmbedDocIds.length,
});
for (const docId of toBeEmbedDocIds) {
await this.queue.add(
'copilot.embedding.docs',