Files
infiplot-web/lib/engine/prompts/segments/writer/narrative-rules.ts
T
Zonghao Yuan 0e4c2ebef4 feat(engine): merge cloudflare-migration — paradigm D engine, BYOK proxy, story persistence (#95)
Squash-merge the cloudflare-migration branch (7 commits by Kai ki) into
staging with conflict resolution, feature integration, and bug fixes.

Engine:
- Paradigm D: single-stream Writer replacing dual-phase Plan/Beats
- Delete Architect agent; story bible generated via Writer <plan> tag
- Modular prompt architecture (segments/registry/builder)
- StreamRouter for tagged stream splitting (<plan>/<story>/<choices>)

Infrastructure:
- Cloudflare Workers deployment (wrangler.jsonc, OpenNext adapter)
- D1 database schema + Drizzle ORM (scaffolded, not yet active)
- R2 storage helpers (scaffolded, not yet active)
- Story persistence API routes + client-side persistence

BYOK (Bring Your Own Key):
- /api/llm/user-proxy with SSRF-protected LLM proxy (+ requireUser auth)
- CORS-aware fetch in ai-client: auto-detect CORS failure, fallback to
  server proxy transparently via OpenAI SDK custom fetch
- BYO config support added to classify-freeform and vision routes
- SettingsModal CORS privacy notice (keys never logged/stored)

SSE streaming:
- engineClient.ts: fetchSSE helper for progressive scene events
- startSession/requestScene accept optional emit callback
- Fix SSE error event field name (error → message) in scene/start routes

i18n integration:
- Wire buildLanguageDirective into paradigm D's prompt builder
- Update corsNotice i18n keys (zh-CN/en/ja) with CORS proxy privacy text
- Preserve Session.language + LanguageSwitcher from i18n commit

Co-authored-by: Kai ki <155355644+zbf1009@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-18 18:05:38 +08:00

35 lines
1.9 KiB
TypeScript

import type { PromptSegment } from "../../types";
export const WRITER_NARRATIVE_RULES: PromptSegment = {
id: "writer-narrative-rules",
name: "叙事创作准则",
type: "narrative-guideline",
agent: "writer",
zone: "stable",
order: 120,
enabled: true,
editable: true,
category: "叙事",
content: `═══════════════════════════════════════════════════════════════════
创作准则(剧情质量底线)
═══════════════════════════════════════════════════════════════════
# 故事结尾方式:
- 剧情结尾不得留下余韵 / 情感升华 / 回顾性收束 / 与前文雷同 / 擅自令主角脱离情景
- 剧情结尾**没有任何收尾感**,像是自然暂停在小说某一章途中的进行时,且结尾没有意外或突发状况
# 多样性:
- 不得重复前文的台词 / 桥段 / 场景
- 叙事发展意味着变化——剧情推进后不得采用重复的关键元素
# 连贯性:
- 如无指示,情景连贯持续,不应产生他者介入 / 意外打断 / 主要人物擅自离开
- 新场景从上一刻自然承接——承接情绪、地点逻辑、人物状态与未收悬念
- 若给了转场种子 nextSceneSeed,把它当命题兑现
- 沿用主线记忆里的人物关系与情绪温度
# 角色认知分级:
- **公共知识**:故事中角色普遍知晓的常识、世界观和基本情报
- **私有知识**:仅特定角色掌握的情报(私密计划 / 个人梦境 / 内心秘密),除非主动公开否则不会被他人知晓
- **创作者情报**:包括"资料"、"设定"、"用户"等元词汇以及其他元概念,不会在叙事中出现,也不应被任何角色知晓`,
};