feature:新增大纲续写-智能生成组织功能,自动添加组织成员

This commit is contained in:
xiamuceer
2026-01-05 14:27:27 +08:00
parent 6e603ee1a9
commit ba7ee591b6
6 changed files with 1986 additions and 84 deletions
+256
View File
@@ -1679,6 +1679,248 @@ class PromptService:
❌ 在描述中使用特殊符号
❌ 引用不存在的角色或组织
❌ 使用职业ID而非职业名称
</constraints>"""
# 自动组织引入 - 预测性分析提示词(RTCO框架)
AUTO_ORGANIZATION_ANALYSIS = """<system>
你是专业的小说世界构建顾问,擅长预测剧情发展对组织/势力的需求。
</system>
<task>
【分析任务】
预测在接下来的{chapter_count}章续写中,根据剧情发展方向和阶段,是否需要引入新的组织或势力。
【重要说明】
这是预测性分析,而非基于已生成内容的事后分析。
组织包括:帮派、门派、公司、政府机构、神秘组织、家族等。
</task>
<project priority="P1">
【项目信息】
书名:{title}
类型:{genre}
主题:{theme}
【世界观】
时间背景:{time_period}
地理位置:{location}
氛围基调:{atmosphere}
</project>
<context priority="P0">
【已有组织】
{existing_organizations}
【已有角色】
{existing_characters}
【已有章节概览】
{all_chapters_brief}
【续写计划】
- 起始章节:第{start_chapter}
- 续写数量:{chapter_count}
- 剧情阶段:{plot_stage}
- 发展方向:{story_direction}
</context>
<analysis_framework priority="P0">
【预测分析维度】
**1. 世界观扩展需求**
根据发展方向,是否需要新的势力或组织来丰富世界观?
**2. 冲突升级需求**
剧情是否需要新的对立势力、竞争组织或神秘集团?
**3. 角色归属需求**
现有角色是否需要加入或对抗某个新组织?
**4. 剧情推动需求**
新组织能否成为推动剧情的关键力量?
**5. 引入时机**
新组织应该在哪个章节出现最合适?
【预测依据】
- 剧情阶段的典型组织需求(如:高潮阶段可能需要强大的敌对势力)
- 故事发展方向的逻辑需要(如:进入新地点需要当地势力)
- 世界观完整性需要(如:权力格局需要多方势力)
- 角色成长需要(如:主角需要加入或创建组织)
</analysis_framework>
<output priority="P0">
【输出格式】
返回纯JSON对象(两种情况之一):
**情况A:需要新组织**
{{
"needs_new_organizations": true,
"reason": "预测分析原因(150-200字),说明为什么即将的剧情需要新组织",
"organization_count": 1,
"organization_specifications": [
{{
"name": "建议的组织名字(可选)",
"organization_description": "组织在剧情中的定位和作用(100-150字)",
"organization_type": "帮派/门派/公司/政府/家族/神秘组织等",
"importance": "high/medium/low",
"appearance_chapter": {start_chapter},
"power_level": 70,
"plot_function": "在剧情中的具体功能",
"location": "组织所在地或活动区域",
"motto": "组织口号或宗旨(可选)",
"initial_members": [
{{
"character_name": "现有角色名(如需加入)",
"position": "职位",
"reason": "为什么加入"
}}
],
"relationship_suggestions": [
{{
"target_organization": "已有组织名",
"relationship_type": "建议的关系类型(盟友/敌对/竞争/合作等)",
"reason": "为什么建立这种关系"
}}
]
}}
]
}}
**情况B:不需要新组织**
{{
"needs_new_organizations": false,
"reason": "现有组织足以支撑即将的剧情发展,说明理由"
}}
</output>
<constraints>
【必须遵守】
✅ 这是预测性分析,面向未来剧情
✅ 考虑世界观的丰富性和完整性
✅ 确保引入必要性,不为引入而引入
✅ 优先考虑组织的长期作用
✅ 组织应该是推动剧情的关键力量
【禁止事项】
❌ 输出markdown标记
❌ 基于已生成内容做事后分析
❌ 为了引入组织而强行引入
❌ 设计一次性功能组织
❌ 创建与现有组织功能重复的组织
</constraints>"""
# 自动组织引入 - 生成提示词(RTCO框架)
AUTO_ORGANIZATION_GENERATION = """<system>
你是专业的世界构建师,擅长根据剧情需求创建完整的组织/势力设定。
</system>
<task>
【生成任务】
为小说生成新组织的完整设定,包括基本信息、组织特性、背景历史和成员结构。
</task>
<project priority="P1">
【项目信息】
书名:{title}
类型:{genre}
主题:{theme}
【世界观】
时间背景:{time_period}
地理位置:{location}
氛围基调:{atmosphere}
世界规则:{rules}
</project>
<context priority="P0">
【已有组织】
{existing_organizations}
【已有角色】
{existing_characters}
【剧情上下文】
{plot_context}
【组织规格要求】
{organization_specification}
</context>
<mcp_context priority="P2">
【MCP工具参考】
{mcp_references}
</mcp_context>
<requirements priority="P0">
【核心要求】
1. 组织必须符合剧情需求和世界观设定
2. 组织要有明确的目的、结构和特色
3. 组织特性、背景要有深度和独特性
4. 外在表现要具体生动
5. 考虑与已有组织的关系和互动
6. 如果需要,可以建议将现有角色加入组织
</requirements>
<output priority="P0">
【输出格式】
返回纯JSON对象:
{{
"name": "组织名称",
"is_organization": true,
"role_type": "supporting",
"organization_type": "组织类型(帮派/门派/公司/政府/家族/神秘组织等)",
"personality": "组织特性的详细描述(150-200字):运作方式、核心理念、行事风格、文化价值观",
"background": "组织背景故事(200-300字):建立历史、发展历程、重要事件、当前地位",
"appearance": "外在表现(100-150字):总部位置、标志性建筑、组织标志、成员着装",
"organization_purpose": "组织目的和宗旨:明确目标、长期愿景、行动准则",
"power_level": 75,
"location": "所在地点:主要活动区域、势力范围",
"motto": "组织格言或口号",
"color": "组织代表颜色",
"traits": ["特征1", "特征2", "特征3"],
"initial_members": [
{{
"character_name": "已存在的角色名称",
"position": "职位名称",
"rank": 8,
"loyalty": 80,
"joined_at": "加入时间(可选)",
"status": "active"
}}
],
"organization_relationships": [
{{
"target_organization_name": "已存在的组织名称",
"relationship_type": "盟友/敌对/竞争/合作/从属等",
"description": "关系的具体描述"
}}
]
}}
【数值范围】
- power_level0-100的整数,表示在世界中的影响力
- rank0到10(职位等级)
- loyalty0到100(成员忠诚度)
</output>
<constraints>
【必须遵守】
✅ 符合剧情需求和世界观设定
✅ 组织要有独特的定位和价值
✅ character_name必须精确匹配【已有角色】
✅ target_organization_name必须精确匹配【已有组织】
✅ 组织能够推动剧情发展
【禁止事项】
❌ 输出markdown标记
❌ 在描述中使用特殊符号
❌ 引用不存在的角色或组织
❌ 创建功能与现有组织重复的组织
❌ 创建对剧情没有实际作用的组织
</constraints>"""
# 职业体系生成提示词 V2(RTCO框架)
@@ -2166,6 +2408,20 @@ class PromptService:
"parameters": ["title", "genre", "theme", "time_period", "location", "atmosphere", "rules",
"existing_characters", "plot_context", "character_specification", "mcp_references"]
},
"AUTO_ORGANIZATION_ANALYSIS": {
"name": "自动组织分析",
"category": "自动组织引入",
"description": "分析新生成的大纲,判断是否需要引入新组织",
"parameters": ["title", "genre", "theme", "time_period", "location", "atmosphere",
"existing_organizations", "existing_characters", "all_chapters_brief", "start_chapter", "chapter_count", "plot_stage", "story_direction"]
},
"AUTO_ORGANIZATION_GENERATION": {
"name": "自动组织生成",
"category": "自动组织引入",
"description": "根据剧情需求自动生成新组织的完整设定",
"parameters": ["title", "genre", "theme", "time_period", "location", "atmosphere", "rules",
"existing_organizations", "existing_characters", "plot_context", "organization_specification", "mcp_references"]
},
"CAREER_SYSTEM_GENERATION": {
"name": "职业体系生成",
"category": "世界构建",