feat(jobs): repo-level embed triggers (pages/refs/source_docs)
create/update on embeddable repos enqueue embed.text with a singleton key that coalesces rapid edits. No-op when the queue is not running (server tests construct createApp without booting pg-boss). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { pool } from '../pool.js';
|
||||
import { recordAudit } from './audit_stub.js';
|
||||
import { triggerEmbed } from '../../jobs/triggers.js';
|
||||
|
||||
const FIELDS = [
|
||||
'space_id','kind','source_url','title','description','summary',
|
||||
@@ -21,6 +22,7 @@ export async function create(input, actor) {
|
||||
vals
|
||||
);
|
||||
await recordAudit(actor, 'create', 'ref', r.id, null, r);
|
||||
await triggerEmbed('ref', r.id);
|
||||
return r;
|
||||
}
|
||||
|
||||
@@ -72,6 +74,7 @@ export async function update(id, patch, actor) {
|
||||
vals
|
||||
);
|
||||
await recordAudit(actor, 'update', 'ref', id, before, r);
|
||||
if (patch.embedding === undefined) await triggerEmbed('ref', id);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user