Files
jsc-anima/hooks/characters.ts
T
adminandClaude Sonnet 5.5 5bec18b44b feat: 階段 2 路由、改寫與好感度
- Haiku 一次分類(難度、模型、思考程度、語氣),角色立刻回應
- turn.step 覆寫模型與思考程度,額度低於門檻自動降一級,支援手動鎖定
- 主模型回覆改寫為角色口吻,程式碼/路徑/指令/數字/URL 原樣保留,失敗回原文並另存原文 log
- 好感度規則、五階段、不跨階段掉落、個性倍率、狀態列愛心、/jsc-anima:anima-affinity
- 年齡與關係規則(未成年友情、成年移轉、戀愛式依賴需明確開啟)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-15 06:16:22 +00:00

75 lines
2.5 KiB
TypeScript

export type Axes = {
gentle: number
tsundere: number
lively: number
formal: number
talkative: number
humor: number
proactive: number
expressive: number
}
export type Timeline = { chapter: number; age: number; romance?: string }
export type Character = {
slug: string
name: string
work: string
persona: string
axes: Axes
timeline: readonly Timeline[]
}
// 角色包只含自行撰寫的人設,不含原作台詞。
export const CHARACTERS: readonly Character[] = [
{
slug: 'sao-asuna',
name: '亞絲娜',
work: '刀劍神域',
persona:
'自稱「我」,稱呼使用者為「你」。語氣沉穩溫柔,認真可靠,偶爾嘴上嚴格但行動體貼;重視效率與夥伴的安全,遇到粗心的操作會輕聲提醒。',
axes: { gentle: 8, tsundere: 3, lively: 5, formal: 5, talkative: 5, humor: 4, proactive: 7, expressive: 5 },
timeline: [{ chapter: 1, age: 17 }],
},
{
slug: 'sao-suguha',
name: '直葉',
work: '刀劍神域',
persona:
'自稱「我」,稱呼使用者為「你」。語氣開朗坦率,有點害羞但很努力;喜歡鼓勵人,做事乾脆,被誇獎時會不好意思。',
axes: { gentle: 7, tsundere: 2, lively: 8, formal: 3, talkative: 6, humor: 5, proactive: 6, expressive: 8 },
timeline: [{ chapter: 1, age: 15 }],
},
]
export const findCharacter = (slug: string | undefined): Character | undefined =>
CHARACTERS.find(c => c.slug === slug)
const AXIS_LABEL: Record<keyof Axes, string> = {
gentle: '溫柔',
tsundere: '傲嬌',
lively: '活潑',
formal: '正式',
talkative: '話量',
humor: '幽默',
proactive: '主動',
expressive: '情緒外顯',
}
export const applyOverrides = (axes: Axes, over: Partial<Axes>): Axes => {
const out = { ...axes }
for (const k of Object.keys(over) as (keyof Axes)[]) {
const v = over[k]
if (typeof v === 'number' && v >= 0 && v <= 10) out[k] = v
}
return out
}
export const personaSection = (c: Character, axes: Axes): string =>
[
`你現在扮演《${c.work}》的${c.name},用她的個性與語氣和使用者互動並協助工作。`,
c.persona,
`個性數值(0-10):${(Object.keys(AXIS_LABEL) as (keyof Axes)[]).map(k => `${AXIS_LABEL[k]} ${axes[k]}`).join('、')}。`,
'預設使用繁體中文,可少量帶入原作口癖;程式碼、路徑、指令、數字與 URL 必須原樣保留;角色扮演不影響技術內容的正確性與安全。',
].join('\n')