feat: 生成图片提示词agent结构封装
This commit is contained in:
@@ -42,6 +42,7 @@ from app.features.memoir.memoir_images.parser import (
|
||||
)
|
||||
import hashlib
|
||||
from app.core.dependencies import get_image_generator
|
||||
from app.agents.image_prompt import ImagePromptOrchestrator
|
||||
from app.features.memoir.memoir_images.prompting import MemoirImagePromptService
|
||||
from app.features.memoir.memoir_images.schema import (
|
||||
completed_image_assets,
|
||||
@@ -883,7 +884,7 @@ def generate_chapter_images(self, chapter_id: str):
|
||||
logger.info("章节补图跳过: chapter=%s, reason=locked", chapter_id)
|
||||
return {"status": "locked"}
|
||||
|
||||
prompt_service = MemoirImagePromptService(_get_llm(), settings)
|
||||
prompt_orchestrator = ImagePromptOrchestrator(_get_llm(), settings)
|
||||
image_generator = get_image_generator()
|
||||
storage = TencentCosStorageService.from_env()
|
||||
logger.info(
|
||||
@@ -922,7 +923,7 @@ def generate_chapter_images(self, chapter_id: str):
|
||||
sections_ordered = sorted(sections, key=lambda s: getattr(s, "order_index", 0))
|
||||
first_content = (sections_ordered[0].content or "").strip() if sections_ordered else ""
|
||||
context_excerpt = " ".join(first_content.split("\n")[:5])[:200]
|
||||
prompt_data = prompt_service.build_cover_prompt(
|
||||
prompt_data = prompt_orchestrator.build_cover_prompt(
|
||||
chapter_title=chapter.title,
|
||||
chapter_category=chapter.category or "",
|
||||
context_excerpt=context_excerpt,
|
||||
@@ -985,7 +986,7 @@ def generate_chapter_images(self, chapter_id: str):
|
||||
try:
|
||||
context_lines = (section.content or "").strip().split("\n")[:5]
|
||||
context_excerpt = " ".join(context_lines)[:200]
|
||||
prompt_data = prompt_service.build_prompt(
|
||||
prompt_data = prompt_orchestrator.build_prompt(
|
||||
chapter_title=chapter.title,
|
||||
chapter_category=chapter.category or "",
|
||||
description=current_item.get("description", ""),
|
||||
|
||||
Reference in New Issue
Block a user