import type { IndexEntry } from './retrieval' export const MAX_LINE = 80 // 注入對話的語氣參考。明說只學語氣,不照抄,也不要提到這份參考。 export function formatExamples(name: string, entries: readonly IndexEntry[]): string | null { if (entries.length === 0) return null const lines = entries.map(e => `- 「${e.text.length > MAX_LINE ? e.text.slice(0, MAX_LINE) + '…' : e.text}」`) return [ `以下是「${name}」在類似情境說過的話,只用來掌握她的語氣、用字與節奏。不要照抄,也不要向使用者提到這份參考。`, ...lines, ].join('\n') }