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

@@ -12,6 +12,7 @@ from .prompts import (
get_memory_prompt,
get_chapter_classification_prompt,
get_text_rewrite_prompt,
inject_image_placeholder_template,
CHAPTER_CATEGORIES,
STAGE_TO_ORDER,
)
@@ -106,13 +107,15 @@ class MemoryAgent:
content = content.strip()
result = json.loads(content)
result["content"] = inject_image_placeholder_template(result.get("content") or "")
return result
except json.JSONDecodeError:
# 如果解析失败,返回基本结构
raw = response.content if hasattr(response, 'content') else str(response)
return {
"title": CHAPTER_CATEGORIES.get(chapter_category, "章节"),
"content": response.content if hasattr(response, 'content') else str(response),
"content": inject_image_placeholder_template(raw),
"summary": "",
"image_suggestions": []
}