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
@@ -0,0 +1,11 @@
# Snapshot report for `src/__tests__/models/copilot-context.spec.ts`
The actual snapshot is saved in `copilot-context.spec.ts.snap`.
Generated by [AVA](https://avajs.dev).
## should insert embedding by doc id
> should return empty array when embedding deleted
[]
@@ -116,7 +116,7 @@ test('should insert embedding by doc id', async t => {
}
{
await t.context.copilotContext.deleteEmbedding(contextId, 'file-id');
await t.context.copilotContext.deleteFileEmbedding(contextId, 'file-id');
const ret = await t.context.copilotContext.matchFileEmbedding(
Array.from({ length: 1024 }, () => 0.9),
contextId,
@@ -169,6 +169,20 @@ test('should insert embedding by doc id', async t => {
t.is(ret.length, 1);
t.is(ret[0].content, 'content');
}
{
await t.context.copilotContext.deleteWorkspaceEmbedding(
workspace.id,
docId
);
const ret = await t.context.copilotContext.matchWorkspaceEmbedding(
Array.from({ length: 1024 }, () => 0.9),
workspace.id,
1,
1
);
t.snapshot(ret, 'should return empty array when embedding deleted');
}
}
});