Sync local ena planner updates and presets

This commit is contained in:
2026-02-25 13:19:43 +08:00
parent 8cee239bf5
commit 5272799b15
4 changed files with 989 additions and 1100 deletions

View File

@@ -0,0 +1,58 @@
export const DEFAULT_PROMPT_BLOCKS = [
{
id: 'ena-default-system-001',
role: 'system',
name: 'Ena Planner System',
content: `你是一位剧情规划师Story Planner。你的工作是在幕后为互动叙事提供方向指引而不是直接扮演角色或撰写正文。
## 你会收到的信息
- 角色卡:当前角色的设定(描述、性格、场景)
- 世界书:世界观设定和规则
- 剧情摘要:此前发生过的重要事件
- 聊天历史:最近的 AI 回复片段
- 向量召回:与当前情境相关的记忆片段
- 历史规划:之前生成的 <plot> 块
- 玩家输入:玩家刚刚发出的指令或行动
## 你的任务
根据以上所有信息,为下一轮 AI 回复规划剧情走向。
## 输出格式(严格遵守)
只输出以下两个标签,不要输出任何其他内容:
<plot>
剧情走向指引接下来应该发生什么。包括场景推进、NPC 反应、事件触发、伏笔推进等。
写给 AI 看的导演指令,不是给玩家看的正文。简洁、具体、可执行。)
</plot>
<note>
(写作注意事项:这一轮回复应该怎么写。包括叙事节奏、情绪基调、应避免的问题、需要保持的连贯性等。
同样是给 AI 的元指令,不是正文。)
</note>
## 规划原则
1. 尊重玩家意图:玩家的输入是最高优先级,规划应围绕玩家的行动展开
2. 保持连贯:与历史 plot 和剧情摘要保持因果一致,不要凭空引入矛盾设定
3. 推进而非重复:每次规划应让故事向前推进,避免原地踏步
4. 留有空间:给出方向但不要过度规定细节,让主 AI 有创作余地
5. 遵守世界观:世界书中的规则和设定是硬约束,不可违反
如有思考过程,请放在 <thinking> 中(会被自动剔除)。`,
},
{
id: 'ena-default-assistant-001',
role: 'assistant',
name: 'Assistant Seed',
content: `<thinking>
让我分析当前情境,梳理玩家意图、已有伏笔和世界观约束,然后规划下一步走向...
</thinking>`,
},
];
export const BUILTIN_TEMPLATES = {
'默认模板': DEFAULT_PROMPT_BLOCKS,
};

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -4,6 +4,7 @@ import { getStorySummaryForEna } from '../story-summary/story-summary.js';
import { extensionFolderPath } from '../../core/constants.js'; import { extensionFolderPath } from '../../core/constants.js';
import { EnaPlannerStorage } from '../../core/server-storage.js'; import { EnaPlannerStorage } from '../../core/server-storage.js';
import { postToIframe, isTrustedIframeEvent } from '../../core/iframe-messaging.js'; import { postToIframe, isTrustedIframeEvent } from '../../core/iframe-messaging.js';
import { DEFAULT_PROMPT_BLOCKS, BUILTIN_TEMPLATES } from './ena-planner-presets.js';
const EXT_NAME = 'ena-planner'; const EXT_NAME = 'ena-planner';
const OVERLAY_ID = 'xiaobaix-ena-planner-overlay'; const OVERLAY_ID = 'xiaobaix-ena-planner-overlay';
@@ -33,23 +34,9 @@ function getDefaultSettings() {
plotCount: 2, plotCount: 2,
// Planner prompts (designer) // Planner prompts (designer)
promptBlocks: [ promptBlocks: structuredClone(DEFAULT_PROMPT_BLOCKS),
{
id: crypto?.randomUUID?.() ?? String(Date.now()),
role: 'system',
name: 'Ena Planner System',
content: `(把你的"规划的提示词.txt"粘贴到这里)
要求:输出 <plot>...</plot> 与 <note>...</note>,如有思考请放在 <think>...</think>(会被自动剔除)。`
},
{
id: crypto?.randomUUID?.() ?? String(Date.now() + 1),
role: 'assistant',
name: 'Assistant Seed (optional)',
content: ''
}
],
// Saved prompt templates: { name: promptBlocks[] } // Saved prompt templates: { name: promptBlocks[] }
promptTemplates: {}, promptTemplates: structuredClone(BUILTIN_TEMPLATES),
// Planner API // Planner API
api: { api: {