feat: 新增图片占位符提示词固定模板 入库时拼接

This commit is contained in:
yangshilin
2026-03-11 09:48:06 +08:00
parent c700b7a67c
commit 4ae68394c5
5 changed files with 66 additions and 10 deletions

View File

@@ -22,6 +22,7 @@ from agents.prompts.memory_prompts import (
get_narrative_prompt,
get_state_extraction_prompt,
get_chapter_classification_prompt,
inject_image_placeholder_template,
STAGE_TO_ORDER,
CHAPTER_CATEGORIES,
)
@@ -346,6 +347,9 @@ def process_memoir_segments(self, user_id: str, segment_ids: List[str]):
)
narrative = f"{existing_content}\n\n{combined_text}"
# 入库前:占位符位置用正则匹配后拼上固定模板
narrative = inject_image_placeholder_template(narrative)
# 更新或创建章节
if chapter:
chapter.content = narrative
@@ -468,6 +472,9 @@ def generate_chapter_content(self, user_id: str, stage: str, new_content: str):
)
narrative = f"{existing_content}\n\n{new_content}"
# 入库前:占位符位置用正则匹配后拼上固定模板
narrative = inject_image_placeholder_template(narrative)
if chapter:
chapter.content = narrative
chapter.is_new = True