fix: make AI polish neutral
This commit is contained in:
15
api/main.py
15
api/main.py
@@ -5271,7 +5271,7 @@ class CreativeCopyResp(BaseModel):
|
||||
class PromptPolishReq(BaseModel):
|
||||
text: str
|
||||
system_prompt: str = ""
|
||||
mode: Literal["image", "video", "general"] = "image"
|
||||
mode: Literal["image", "video", "general", "chat"] = "image"
|
||||
target_language: Literal["en", "zh", "keep"] = "en"
|
||||
|
||||
|
||||
@@ -5421,7 +5421,7 @@ def _prompt_polish_fallback(req: PromptPolishReq) -> PromptPolishResp:
|
||||
f"{base}. Smooth camera movement, clear subject continuity, stable composition, "
|
||||
"natural motion, coherent lighting, no subtitles, no watermark."
|
||||
)
|
||||
elif req.mode == "general":
|
||||
elif req.mode in {"general", "chat"}:
|
||||
polished = base
|
||||
else:
|
||||
polished = (
|
||||
@@ -5448,16 +5448,25 @@ def polish_prompt(req: PromptPolishReq) -> PromptPolishResp:
|
||||
"image": "an image-generation prompt",
|
||||
"video": "a video-generation prompt",
|
||||
"general": "a concise generation prompt",
|
||||
"chat": "a professional response to the user's request",
|
||||
}.get(req.mode, "an image-generation prompt")
|
||||
user_system = req.system_prompt.strip()
|
||||
prompt = (
|
||||
f"Rewrite the user's input into {mode_hint} in {target_label}.\n"
|
||||
"Preserve the user's actual subject, brand, product, place, style, and intent.\n"
|
||||
"Do not add SKG, health-tech, massage products, TikTok ad framing, product sales language, hashtags, captions, or any brand/product not explicitly present in the input.\n"
|
||||
"Do not add SKG, health-tech, massage products, TikTok ad framing, product sales language, hashtags, captions, or any brand/product not explicitly present in the input or user-selected guidance.\n"
|
||||
"Do not add medical, wellness, or advertising claims unless the user asked for them.\n"
|
||||
"Improve concrete visual details, composition, lighting, camera language, materials, mood, and quality.\n"
|
||||
"Return only the rewritten prompt. No markdown, labels, JSON, quotes, explanation, or alternatives.\n"
|
||||
)
|
||||
if req.mode == "chat":
|
||||
prompt = (
|
||||
f"Answer or rewrite the user's request professionally in {target_label}.\n"
|
||||
"Follow the user-selected guidance when provided.\n"
|
||||
"Do not add SKG, health-tech, massage products, TikTok ad framing, product sales language, hashtags, captions, or any brand/product not explicitly present in the input or user-selected guidance.\n"
|
||||
"Do not add medical, wellness, or advertising claims unless the user asked for them.\n"
|
||||
"Return only the final content in the format requested by the guidance. No markdown fences, labels, explanation, or alternatives unless explicitly requested.\n"
|
||||
)
|
||||
if req.mode == "video":
|
||||
prompt += (
|
||||
"For video, describe motion, timing, camera movement, continuity, and what changes over time. "
|
||||
|
||||
Reference in New Issue
Block a user