feat: 新增图片占位符提示词固定模板 入库时拼接
This commit is contained in:
@@ -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": []
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user