Answer style + no-preamble rule
Source: platform/apps/app/src/lib/chat/answer-style.ts · rendered from main on every deploy — edit in the repo, not here
/** * Shared answer-style instruction fragments used across both rich-prompt * (buildSystemPrompt / /api/chat) and minimal-prompt (/api/answer) flows. * * CRITICAL: Do NOT extract the full no-preamble instruction — the rich flow * includes additional detail about inline [1], [2] markers that the minimal * flow's response parser does NOT handle. Extracting this shared prefix only * eliminates drift on the core constraint without changing rendered text. */
/** * Core no-preamble instruction (shared by both flows). * Both buildSystemPrompt and /api/answer systemPrompt begin with this phrase * to suppress Haiku's native "ตามเอกสาร…" preamble on grounded answers. * * The +server.ts version stops here (line 255). * The buildSystemPrompt version continues with marker-placement detail. */export const NO_PREAMBLE_INSTRUCTION_PREFIX = `ตอบเข้าเนื้อหาโดยตรง ห้ามขึ้นต้นคำตอบด้วยวลีเกริ่นนำอ้างอิงแหล่งที่มา เช่น "ตามเอกสาร", "ตามเอกสารของ`;
/** * Full no-preamble instruction (rich flow only). * Includes additional detail about inline [1], [2] marker placement that * /api/answer's single-shot parser does NOT expect. NOT shared. A function (not * a const + `.replace('${tenantName}', …)`) so the tenant name is real template * interpolation — avoids biome's noTemplateCurlyInString on a literal placeholder. */export function noPreambleInstructionFull(tenantName: string): string { return `ตอบเข้าเนื้อหาโดยตรง ห้ามขึ้นต้นคำตอบด้วยวลีเกริ่นนำอ้างอิงแหล่งที่มา เช่น "ตามเอกสาร", "ตามเอกสารของ${tenantName}", "ตามข้อมูล", "จากข้อมูลที่มี" — ใส่ [1], [2] ตามจุดที่ใช้ข้อมูลได้ตามปกติ แต่ห้ามเกริ่นนำก่อนเข้าคำตอบ`;}