Fix: bruk sql.json() for JSONB payload i job_queue
JSON.stringify + ::jsonb via postgres-biblioteket lagret payload som dobbelt-escaped string i stedet for JSONB-objekt. Workeren fant ikke message_id i den resulterende strengen. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
832ea7117a
commit
0a560bdf2d
1 changed files with 7 additions and 6 deletions
|
|
@ -30,17 +30,18 @@ export const POST: RequestHandler = async ({ request, locals }) => {
|
||||||
if (!msg) error(404, 'Melding ikke funnet');
|
if (!msg) error(404, 'Melding ikke funnet');
|
||||||
|
|
||||||
// Opprett jobb i køen
|
// Opprett jobb i køen
|
||||||
|
const payload = {
|
||||||
|
message_id,
|
||||||
|
action: action ?? 'fix_text',
|
||||||
|
prompt_override: prompt_override ?? null,
|
||||||
|
model: model ?? null
|
||||||
|
};
|
||||||
const [job] = await sql`
|
const [job] = await sql`
|
||||||
INSERT INTO job_queue (workspace_id, job_type, payload, priority)
|
INSERT INTO job_queue (workspace_id, job_type, payload, priority)
|
||||||
VALUES (
|
VALUES (
|
||||||
${workspace.id},
|
${workspace.id},
|
||||||
'ai_text_process',
|
'ai_text_process',
|
||||||
${JSON.stringify({
|
${sql.json(payload)},
|
||||||
message_id,
|
|
||||||
action: action ?? 'fix_text',
|
|
||||||
prompt_override: prompt_override ?? null,
|
|
||||||
model: model ?? null
|
|
||||||
})}::jsonb,
|
|
||||||
10
|
10
|
||||||
)
|
)
|
||||||
RETURNING id, status, created_at
|
RETURNING id, status, created_at
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue