* Strip everything before and including </think> (handles unclosed think blocks) * Log 样式优化 * Log样式优化 * 小白板内容曝露给ena-planner * 小白板内容曝露给ena-planner * 修正世界书宏读取问题 * 修正summary触发绿灯的问题 * 向量存储到ST端 * 向量存储到ST端 * 向量到ST服务器 * 向量存储到ST端 * backup file名称修正 * 存取向量逻辑修正 * 切聊天时清掉旧 summary * 新增向量备份管理 UI(清单 + Modal) - vector-io.js:新增 fetchManifest / upsertManifestEntry / deleteServerBackup 等清单管理函数;backupToServer 成功后自动写入 LWB_BackupManifest.json - story-summary.html:在服务器 IO 区域新增「管理」按钮及独立 Modal 弹窗 - story-summary-ui.js:新增备份列表渲染、删除确认、只读模式降级逻辑 - story-summary.js:新增 VECTOR_LIST_BACKUPS / VECTOR_DELETE_BACKUP 消息处理 * 备份管理 Modal 移至父窗口,修复层级与配色问题 - Modal 从 iframe 移到父窗口 DOM(z-index:100000),不再被 settings modal 遮挡 - 改为白底深色文字,配色清晰可读 - 删除逻辑直接在父窗口调用,无需跨帧消息 - 简化 story-summary-ui.js,移除 modal 相关代码 * 删除聊天时自动清理服务器向量备份 - vector-io.js:导出 getBackupFilename - story-summary.js:监听 CHAT_DELETED / GROUP_CHAT_DELETED,静默删除对应 zip 和清单条目 * 修复 serverPath 含前导斜杠导致删除失败的问题 buildSafeServerPath 比较前 strip 前导 /,upsertManifestEntry 写入前同样 normalize, 确保清单和校验逻辑使用统一格式 * normalizeManifestEntry 读取时同步 strip serverPath 前导斜杠 补全斜杠 normalize 的覆盖点:写入(upsertManifestEntry)、校验(buildSafeServerPath)、 读取(normalizeManifestEntry)三处统一,旧清单条目自动修正 * 重要NPC生成路径:拆分添加按钮 + 完整角色档案模板 - 陌路人卡片"添加"按钮拆为"重要"(importantNpc)和"背景板"(npc)两个 - 新增 importantNpc 生成路径,传递 npcType 贯穿 genAddCt → CHECK_STRANGER_WORLDBOOK_RESULT → GENERATE_NPC_RESULT - 新增 importantNpc JSON 模板:白描外貌、世界观适配、性格调色盘+衍生、台词示例、结构化二次解释 - 新增 importantNpc UAUA 提示词:内嵌白描规则+正反示范、调色盘衍生写法指导 * 高级设置模板编辑器加注授权声明 * 授权声明仅在重要NPC生成模板下显示 --------- Co-authored-by: Hao19911125 <99091644+Hao19911125@users.noreply.github.com> Co-authored-by: LittleWhiteBox Dev <dev@littlewhitebox.local> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -32,7 +32,7 @@ import { StoryOutlineStorage } from "../../core/server-storage.js";
|
||||
import { promptManager } from "../../../../../openai.js";
|
||||
import {
|
||||
buildSmsMessages, buildSummaryMessages, buildSmsHistoryContent, buildExistingSummaryContent,
|
||||
buildNpcGenerationMessages, formatNpcToWorldbookContent, buildExtractStrangersMessages,
|
||||
buildNpcGenerationMessages, buildImportantNpcGenerationMessages, formatNpcToWorldbookContent, buildExtractStrangersMessages,
|
||||
buildWorldGenStep1Messages, buildWorldGenStep2Messages, buildWorldSimMessages, buildSceneSwitchMessages,
|
||||
buildInviteMessages, buildLocalMapGenMessages, buildLocalMapRefreshMessages, buildLocalSceneGenMessages,
|
||||
buildOverlayHtml, MOBILE_LAYOUT_STYLE, DESKTOP_LAYOUT_STYLE, getPromptConfigPayload, setPromptConfig
|
||||
@@ -874,14 +874,17 @@ async function handleCheckStrangerWb({ requestId, strangerName }) {
|
||||
postFrame({ type: 'CHECK_STRANGER_WORLDBOOK_RESULT', requestId, found: !!r, ...(r && { worldbookUid: r.uid, worldbook: r.bookName, entryName: r.entry.comment || r.entry.key?.[0] || strangerName }) });
|
||||
}
|
||||
|
||||
async function handleGenNpc({ requestId, strangerName, strangerInfo }) {
|
||||
async function handleGenNpc({ requestId, strangerName, strangerInfo, npcType = 'npc' }) {
|
||||
try {
|
||||
const comm = getCommSettings();
|
||||
const ctx = getContext(), char = ctx.characters?.[ctx.characterId];
|
||||
if (!char) return replyErr('GENERATE_NPC_RESULT', requestId, '未找到当前角色卡');
|
||||
const primary = char.data?.extensions?.world;
|
||||
if (!primary || !world_names?.includes(primary)) return replyErr('GENERATE_NPC_RESULT', requestId, '角色卡未绑定世界书,请先绑定世界书');
|
||||
const msgs = buildNpcGenerationMessages(getCommonPromptVars({ strangerName, strangerInfo: strangerInfo || '(无描述)' }));
|
||||
const vars = getCommonPromptVars({ strangerName, strangerInfo: strangerInfo || '(无描述)' });
|
||||
const msgs = npcType === 'importantNpc'
|
||||
? buildImportantNpcGenerationMessages(vars)
|
||||
: buildNpcGenerationMessages(vars);
|
||||
const npc = await callLLMJson({ messages: msgs, validate: V.npc });
|
||||
if (!npc?.name) return replyErr('GENERATE_NPC_RESULT', requestId, 'NPC 生成失败:无法解析 JSON 数据');
|
||||
const wd = await loadWorldInfo(primary); if (!wd) return replyErr('GENERATE_NPC_RESULT', requestId, `无法加载世界书: ${primary}`);
|
||||
|
||||
Reference in New Issue
Block a user