Skip to content

Commit cfd3e04

Browse files
committed
fix: apply humanizer to ai prompts
1 parent 30490dd commit cfd3e04

2 files changed

Lines changed: 15 additions & 3 deletions

File tree

‎supabase/functions/ai/index.ts‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1199,7 +1199,7 @@ async function buildSystemPrompt(feature: Feature, customSystemPrompt?: string |
11991199
const custom = customSystemPrompt ? `\n\nCUSTOM SYSTEM PROMPT:\n${customSystemPrompt}` : "";
12001200

12011201
const sourceText = sources && sources.length ? `\n\nLOCAL KNOWLEDGE BASE (use as primary factual source):\n${sources.map((s) => `--- ${s.title} (${s.origin || s.type}) ---\n${s.content}\n`).join("\n")}` : "";
1202-
return `${base}${globalSection}${custom}${sourceText}`;
1202+
return withHumanizerInstructions(`${base}${globalSection}${custom}${sourceText}`);
12031203
}
12041204

12051205
// ============== MAIN HANDLER ==============
@@ -1399,6 +1399,8 @@ Research Context: ${webSearchContext || urlContext ? "AVAILABLE" : "NONE"}${urlC
13991399
queries: askSearchQuery ? [askSearchQuery] : [],
14001400
sources: researchSources,
14011401
};
1402+
} else {
1403+
delete typedOutput.searchInfo;
14021404
}
14031405

14041406
if (citationMode && researchSources.length > 0 && (!Array.isArray(typedOutput.citations) || typedOutput.citations.length === 0)) {
@@ -1412,6 +1414,15 @@ Research Context: ${webSearchContext || urlContext ? "AVAILABLE" : "NONE"}${urlC
14121414
? typedOutput.uncertainties
14131415
: [];
14141416
}
1417+
if (!citationMode) {
1418+
typedOutput.citations = [];
1419+
}
1420+
if (!prosConsMode) {
1421+
delete (typedOutput as { prosConsAnalysis?: unknown }).prosConsAnalysis;
1422+
}
1423+
if (!argumentMapMode) {
1424+
delete (typedOutput as { argumentMap?: unknown }).argumentMap;
1425+
}
14151426
}
14161427

14171428
// Log usage and return

‎supabase/functions/deno.json‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
"compilerOptions": {
33
"lib": [
44
"deno.ns",
5-
"deno.unstable"
5+
"deno.unstable",
6+
"dom"
67
]
78
}
8-
}
9+
}

0 commit comments

Comments
 (0)