feat: W7 功能標籤分類、對白檢索與注入 (#8)
用 $.model.complete(Haiku)判斷回應的功能標籤,從角色索引取同標籤對白, 以只增不改的訊息附在使用者訊息之前;失敗一律退回不注入。 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
1c4e0c5d98
commit
d9e50d196b
@@ -0,0 +1,13 @@
|
||||
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')
|
||||
}
|
||||
Reference in New Issue
Block a user