build_pack.py 產生對白索引(放在使用者資料目錄);render_skill.py 把人格卡渲染成 角色 skill 並檢查精選對白逐字來自索引;插件改成執行期從資料目錄讀索引。 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
352ce7dcad
commit
697ed6a0b9
@@ -6,7 +6,7 @@ import { retrieve, type IndexEntry } from './retrieval'
|
||||
|
||||
export type InjectDeps = {
|
||||
config: Config
|
||||
indexes: Readonly<Record<CharacterCode, readonly IndexEntry[]>>
|
||||
loadIndex: (character: CharacterCode) => Promise<readonly IndexEntry[]>
|
||||
complete: Complete
|
||||
append: (text: string) => Promise<unknown>
|
||||
now: () => number
|
||||
@@ -16,12 +16,12 @@ export type InjectDeps = {
|
||||
// 回傳 null 表示這一輪不注入(沒選角色、強度 0、索引為空、分類失敗或沒有同標籤的對白)。
|
||||
// 索引為空時不呼叫模型,省下一次無用的分類。
|
||||
export async function buildInjection(
|
||||
{ config, indexes, complete, now, turn }: Omit<InjectDeps, 'append'>,
|
||||
{ config, loadIndex, complete, now, turn }: Omit<InjectDeps, 'append'>,
|
||||
userText: string,
|
||||
): Promise<{ text: string | null; fn: string | null; ms: number } | null> {
|
||||
const character = config.character
|
||||
if (character === null || config.intensity === 0) return null
|
||||
const index = indexes[character]
|
||||
const index = await loadIndex(character)
|
||||
if (index.length === 0) return null
|
||||
const started = now()
|
||||
const fn = await classify(complete, userText)
|
||||
|
||||
Reference in New Issue
Block a user