chore/ 删除无用文件
This commit is contained in:
@@ -42,7 +42,9 @@ class MemoirImagePromptService:
|
||||
description: str,
|
||||
context_excerpt: str,
|
||||
) -> dict[str, str]:
|
||||
style = self.CATEGORY_STYLE_MAP.get(chapter_category, self.settings.default_style)
|
||||
style = self.CATEGORY_STYLE_MAP.get(
|
||||
chapter_category, self.settings.default_style
|
||||
)
|
||||
prompt_context = f"{chapter_category}: {chapter_title}"
|
||||
|
||||
llm_input = {
|
||||
@@ -69,7 +71,9 @@ class MemoirImagePromptService:
|
||||
raw_response = response.content
|
||||
parsed = json.loads(extract_json_payload(raw_response))
|
||||
return {
|
||||
"prompt": _ensure_style_in_prompt(parsed["prompt"], parsed.get("style", style)),
|
||||
"prompt": _ensure_style_in_prompt(
|
||||
parsed["prompt"], parsed.get("style", style)
|
||||
),
|
||||
"style": parsed.get("style", style),
|
||||
"size": parsed.get("size", self.settings.default_size),
|
||||
"prompt_context": prompt_context,
|
||||
@@ -104,7 +108,9 @@ class MemoirImagePromptService:
|
||||
context_excerpt: str,
|
||||
) -> dict[str, str]:
|
||||
"""生成章节封面图的 image-generation prompt。"""
|
||||
style = self.CATEGORY_STYLE_MAP.get(chapter_category, self.settings.default_style)
|
||||
style = self.CATEGORY_STYLE_MAP.get(
|
||||
chapter_category, self.settings.default_style
|
||||
)
|
||||
prompt_context = f"{chapter_category}: {chapter_title}"
|
||||
|
||||
llm_input = {
|
||||
@@ -189,14 +195,18 @@ class MemoirImagePromptService:
|
||||
context_excerpt: str,
|
||||
style: str,
|
||||
) -> str:
|
||||
subject = self.CATEGORY_FALLBACK_SUBJECT_MAP.get(chapter_category, "memoir scene")
|
||||
subject = self.CATEGORY_FALLBACK_SUBJECT_MAP.get(
|
||||
chapter_category, "memoir scene"
|
||||
)
|
||||
if _contains_cjk(description) or _contains_cjk(context_excerpt):
|
||||
return (
|
||||
f"A {style} illustration of a {subject}, emotionally resonant, cinematic composition, "
|
||||
"authentic everyday details, natural lighting, expressive environment, no text overlay."
|
||||
)
|
||||
|
||||
details = ". ".join(part.strip() for part in (description, context_excerpt) if part.strip())
|
||||
details = ". ".join(
|
||||
part.strip() for part in (description, context_excerpt) if part.strip()
|
||||
)
|
||||
if not details:
|
||||
details = "A personal life story scene with authentic emotional detail"
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user