update:1.修复一对一模式修改大纲名称没有同步更新章节名称 2.修复一对一模式全新生成大纲,没有关联删除对应章节问题 3.优化根据分析建议重新生成章节内容时引用默认写作风格 5.将写作风格调整至用户级,在一个项目中添加全局可见(需要更新数据库)
This commit is contained in:
@@ -23,7 +23,8 @@ class ChapterRegenerator:
|
||||
chapter: Chapter,
|
||||
analysis: Optional[PlotAnalysis],
|
||||
regenerate_request: ChapterRegenerateRequest,
|
||||
project_context: Dict[str, Any]
|
||||
project_context: Dict[str, Any],
|
||||
style_content: str = ""
|
||||
) -> AsyncGenerator[Dict[str, Any], None]:
|
||||
"""
|
||||
根据反馈重新生成章节(流式)
|
||||
@@ -55,7 +56,8 @@ class ChapterRegenerator:
|
||||
chapter=chapter,
|
||||
modification_instructions=modification_instructions,
|
||||
project_context=project_context,
|
||||
regenerate_request=regenerate_request
|
||||
regenerate_request=regenerate_request,
|
||||
style_content=style_content
|
||||
)
|
||||
|
||||
logger.info(f"🎯 提示词构建完成,开始AI生成")
|
||||
@@ -161,7 +163,8 @@ class ChapterRegenerator:
|
||||
chapter: Chapter,
|
||||
modification_instructions: str,
|
||||
project_context: Dict[str, Any],
|
||||
regenerate_request: ChapterRegenerateRequest
|
||||
regenerate_request: ChapterRegenerateRequest,
|
||||
style_content: str = ""
|
||||
) -> str:
|
||||
"""构建完整的重新生成提示词"""
|
||||
|
||||
@@ -235,6 +238,17 @@ class ChapterRegenerator:
|
||||
|
||||
{project_context['previous_context']}
|
||||
|
||||
---
|
||||
""")
|
||||
|
||||
# 写作风格要求(如果提供)
|
||||
if style_content:
|
||||
prompt_parts.append(f"""## 🎨 写作风格要求
|
||||
|
||||
{style_content}
|
||||
|
||||
请在重新创作时严格遵循上述写作风格。
|
||||
|
||||
---
|
||||
""")
|
||||
|
||||
@@ -246,6 +260,7 @@ class ChapterRegenerator:
|
||||
3. **提升质量**:在节奏、情感、描写等方面明显优于原版
|
||||
4. **保留精华**:保持原章节中优秀的部分和关键情节
|
||||
5. **字数控制**:目标字数约{regenerate_request.target_word_count}字(可适当浮动±20%)
|
||||
{f'6. **风格一致**:严格按照上述写作风格进行创作' if style_content else ''}
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -77,6 +77,7 @@ class ImportExportService:
|
||||
"chapter_count": project.chapter_count,
|
||||
"narrative_perspective": project.narrative_perspective,
|
||||
"character_count": project.character_count,
|
||||
"outline_mode": project.outline_mode,
|
||||
"user_id": project.user_id,
|
||||
"created_at": project.created_at.isoformat() if project.created_at else None,
|
||||
}
|
||||
@@ -496,6 +497,7 @@ class ImportExportService:
|
||||
chapter_count=project_data.get("chapter_count"),
|
||||
narrative_perspective=project_data.get("narrative_perspective"),
|
||||
character_count=project_data.get("character_count"),
|
||||
outline_mode=project_data.get("outline_mode", "one-to-many"), # ✅ 导入大纲模式,默认为一对多
|
||||
current_words=project_data.get("current_words", 0), # 保留原项目的字数
|
||||
wizard_step=4, # 导入的项目设置为向导完成状态
|
||||
wizard_status="completed" # 标记向导已完成
|
||||
|
||||
Reference in New Issue
Block a user