直聊的种子历史改成逐条真多轮,不再靠块头文本猜轮次。

一条一个角色下拉加一整句正文,换行原样保留;旧盘里的纯文本在读盘时迁移,切得出轮次的转成条目,切不出的挪进史前设定免得悄悄丢掉。历史编辑器做成共用控件,预设工作台的用例与假历史也用同一套。
This commit is contained in:
2026-10-26 01:09:34 +08:00
parent 860eff59b2
commit 98e51f9c6c
11 changed files with 686 additions and 17 deletions
+11
View File
@@ -233,6 +233,9 @@ function slotsFromBody(body: Record<string, unknown>): DirectChatShellSlots {
typeof body.seedHistory === "string"
? body.seedHistory
: EMPTY_SHELL_SLOTS.seedHistory,
seedMessages: Array.isArray(body.seedMessages)
? (body.seedMessages as DirectChatShellSlots["seedMessages"])
: EMPTY_SHELL_SLOTS.seedMessages,
loreAfter:
typeof body.loreAfter === "string"
? body.loreAfter
@@ -319,6 +322,9 @@ export async function handleDirectChatApi(
typeof body.seedHistory === "string"
? body.seedHistory
: undefined,
seedMessages: Array.isArray(body.seedMessages)
? (body.seedMessages as DirectChatShellSlots["seedMessages"])
: undefined,
loreAfter:
typeof body.loreAfter === "string" ? body.loreAfter : undefined,
postTurn:
@@ -489,6 +495,7 @@ export async function handleDirectChatApi(
systemPrompt: shell.systemPrompt,
loreBefore: shell.loreBefore,
seedHistory: shell.seedHistory,
seedMessages: shell.seedMessages,
loreAfter: shell.loreAfter,
postTurn: shell.postTurn,
},
@@ -600,6 +607,7 @@ export async function handleDirectChatApi(
systemPrompt: shell.systemPrompt,
loreBefore: shell.loreBefore,
seedHistory: shell.seedHistory,
seedMessages: shell.seedMessages,
loreAfter: shell.loreAfter,
postTurn: shell.postTurn,
},
@@ -721,6 +729,7 @@ export async function handleDirectChatApi(
systemPrompt: shell.systemPrompt,
loreBefore: shell.loreBefore,
seedHistory: shell.seedHistory,
seedMessages: shell.seedMessages,
loreAfter: shell.loreAfter,
postTurn: shell.postTurn,
},
@@ -909,6 +918,7 @@ export async function handleDirectChatApi(
systemPrompt?: string;
loreBefore?: string;
seedHistory?: string;
seedMessages?: DirectChatShellSlots["seedMessages"];
loreAfter?: string;
postTurn?: string;
presetId?: string | null;
@@ -928,6 +938,7 @@ export async function handleDirectChatApi(
systemPrompt: body.shell.systemPrompt ?? "",
loreBefore: body.shell.loreBefore ?? "",
seedHistory: body.shell.seedHistory ?? "",
seedMessages: body.shell.seedMessages ?? [],
loreAfter: body.shell.loreAfter ?? "",
postTurn: body.shell.postTurn ?? "",
},