Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

chore(server): move embedding job namespace (#11397)

darkskygit94ddcc7a7a59
diff --git a/packages/backend/server/src/plugins/copilot/context/job.ts b/packages/backend/server/src/plugins/copilot/context/job.ts
index 1b71eaa8bf..1943b42579 100644
--- a/packages/backend/server/src/plugins/copilot/context/job.ts
+++ b/packages/backend/server/src/plugins/copilot/context/job.ts
@@ -58,11 +58,11 @@ export class CopilotContextDocJob {
return this.client as EmbeddingClient;
}
- async addFileEmbeddingQueue(file: Jobs['doc.embedPendingFiles']) {
+ async addFileEmbeddingQueue(file: Jobs['copilot.embedding.files']) {
if (!this.supportEmbedding) return;
const { userId, workspaceId, contextId, blobId, fileId, fileName } = file;
- await this.queue.add('doc.embedPendingFiles', {
+ await this.queue.add('copilot.embedding.files', {
userId,
workspaceId,
contextId,
@@ -80,7 +80,7 @@ export class CopilotContextDocJob {
if (!this.supportEmbedding) return;
for (const { workspaceId, docId } of docs) {
- await this.queue.add('doc.embedPendingDocs', {
+ await this.queue.add('copilot.embedding.docs', {
contextId,
workspaceId,
docId,
@@ -100,7 +100,7 @@ export class CopilotContextDocJob {
return new File([buffer], fileName);
}
- @OnJob('doc.embedPendingFiles')
+ @OnJob('copilot.embedding.files')
async embedPendingFile({
userId,
workspaceId,
@@ -108,7 +108,7 @@ export class CopilotContextDocJob {
blobId,
fileId,
fileName,
- }: Jobs['doc.embedPendingFiles']) {
+ }: Jobs['copilot.embedding.files']) {
if (!this.supportEmbedding || !this.embeddingClient) return;
try {
@@ -149,12 +149,12 @@ export class CopilotContextDocJob {
}
}
- @OnJob('doc.embedPendingDocs')
+ @OnJob('copilot.embedding.docs')
async embedPendingDocs({
contextId,
workspaceId,
docId,
- }: Jobs['doc.embedPendingDocs']) {
+ }: Jobs['copilot.embedding.docs']) {
if (!this.supportEmbedding) return;
try {
diff --git a/packages/backend/server/src/plugins/copilot/context/types.ts b/packages/backend/server/src/plugins/copilot/context/types.ts
index ac089b9959..a40cf5874d 100644
--- a/packages/backend/server/src/plugins/copilot/context/types.ts
+++ b/packages/backend/server/src/plugins/copilot/context/types.ts
@@ -29,13 +29,13 @@ declare global {
};
}
interface Jobs {
- 'doc.embedPendingDocs': {
+ 'copilot.embedding.docs': {
contextId?: string;
workspaceId: string;
docId: string;
};
- 'doc.embedPendingFiles': {
+ 'copilot.embedding.files': {
contextId: string;
userId: string;
workspaceId: string;