feat(server): workspace doc update event from indexer (#12186)

fix AI-108
fix AI-109
fix AI-13
This commit is contained in:
darkskygit
2025-05-09 07:35:47 +00:00
parent 918b3b2dab
commit 5f5de8e89d
6 changed files with 66 additions and 8 deletions
@@ -168,6 +168,12 @@ export class CopilotContextModel extends BaseModel {
`;
}
async deleteFileEmbedding(contextId: string, fileId: string) {
await this.db.aiContextEmbedding.deleteMany({
where: { contextId, fileId },
});
}
async matchFileEmbedding(
embedding: number[],
contextId: string,
@@ -205,6 +211,12 @@ export class CopilotContextModel extends BaseModel {
`;
}
async deleteWorkspaceEmbedding(workspaceId: string, docId: string) {
await this.db.aiWorkspaceEmbedding.deleteMany({
where: { workspaceId, docId },
});
}
async matchWorkspaceEmbedding(
embedding: number[],
workspaceId: string,
@@ -222,10 +234,4 @@ export class CopilotContextModel extends BaseModel {
`;
return similarityChunks.filter(c => Number(c.distance) <= threshold);
}
async deleteEmbedding(contextId: string, fileId: string) {
await this.db.aiContextEmbedding.deleteMany({
where: { contextId, fileId },
});
}
}