mirror of
https://github.com/docmost/docmost.git
synced 2026-08-29 01:37:05 +08:00
feat(ai): rebuild turbopuffer namespaces when the embedding model changes
This commit is contained in:
@@ -211,6 +211,24 @@ export class WorkspaceRepo {
|
|||||||
.executeTakeFirst();
|
.executeTakeFirst();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async updateAiEmbeddingFingerprint(
|
||||||
|
workspaceId: string,
|
||||||
|
fingerprint: { driver: string; model: string; dimensions: number },
|
||||||
|
trx?: KyselyTransaction,
|
||||||
|
) {
|
||||||
|
const db = dbOrTx(this.db, trx);
|
||||||
|
return db
|
||||||
|
.updateTable('workspaces')
|
||||||
|
.set({
|
||||||
|
settings: sql`COALESCE(settings, '{}'::jsonb)
|
||||||
|
|| jsonb_build_object('ai', COALESCE(settings->'ai', '{}'::jsonb)
|
||||||
|
|| jsonb_build_object('embedding', ${JSON.stringify(fingerprint)}::text::jsonb))`,
|
||||||
|
updatedAt: new Date(),
|
||||||
|
})
|
||||||
|
.where('id', '=', workspaceId)
|
||||||
|
.execute();
|
||||||
|
}
|
||||||
|
|
||||||
async updateSharingSettings(
|
async updateSharingSettings(
|
||||||
workspaceId: string,
|
workspaceId: string,
|
||||||
prefKey: string,
|
prefKey: string,
|
||||||
|
|||||||
+1
-1
Submodule apps/server/src/ee updated: f2da346b25...26030bdd71
Reference in New Issue
Block a user