feat: 插件改为浮窗模式
This commit is contained in:
@@ -116,6 +116,39 @@ DEFAULT_NEGATIVE_INTENT = (
|
||||
"no distorted text, no deformed product, no extra limbs, no blurry areas"
|
||||
)
|
||||
|
||||
# ── gpt-image(/v1/images/edits 语义)专用包装 ─────────────────────────────
|
||||
# gpt-image 的 edits 端点把输入图当"被编辑的底图"、prompt 当"编辑指令"(豆包/通义则是
|
||||
# "主体参考"),风格词会被字面执行到商品上。按 OpenAI 官方提示词指南的编辑模式:
|
||||
# 按序号说明输入图、PRESERVE/MAY CHANGE 分列、首尾重申不变量、文案逐字渲染。
|
||||
|
||||
GPT_EDITS_CONTRACT = (
|
||||
"INPUT IMAGES: Image 1 (and Image 2 if present) are reference photos of ONE product "
|
||||
"from different angles. Use them ONLY as the source of the product's true appearance.\n"
|
||||
"PRESERVE (frozen, never change): the product itself — silhouette, proportions, colors, "
|
||||
"print/pattern (keep stripes / logos / labels exactly), materials, texture, stitching, "
|
||||
"hardware and every design detail. The product in the output must be the same physical "
|
||||
"item as in the input images, merely photographed in a new setting.\n"
|
||||
"MAY CHANGE: background, scene, props, camera angle, lighting, composition "
|
||||
"and in-image marketing typography.\n"
|
||||
"STYLE SCOPE: all style, mood, color-palette and decoration instructions below describe "
|
||||
"the SCENE AND BACKGROUND ONLY — never apply them to the product itself. "
|
||||
"Do not restyle, recolor, re-pattern or redecorate the product. "
|
||||
"You may relight the product so it sits naturally in the new scene "
|
||||
"(matched shadows and color temperature), but never change its design, colors or pattern."
|
||||
)
|
||||
|
||||
GPT_EDITS_FINAL_CHECK = (
|
||||
"FINAL CHECK before output: if the product in your result differs from the input product in any "
|
||||
"design detail (shape, color, pattern, material, logo), the image is rejected. "
|
||||
"Render any listed marketing copy / headlines exactly as written (verbatim, no extra characters, "
|
||||
"no paraphrasing)."
|
||||
)
|
||||
|
||||
|
||||
def wrap_prompt_for_gpt_edits(prompt: str) -> str:
|
||||
"""gpt-image edits 语义适配:契约放开头(指令权重最高处),终检放结尾。"""
|
||||
return f"{GPT_EDITS_CONTRACT}\n\n{prompt}\n\n{GPT_EDITS_FINAL_CHECK}"
|
||||
|
||||
# ── 商品上下文提炼 ────────────────────────────────────────────────────────
|
||||
|
||||
def _shorten(text: str, n: int) -> str:
|
||||
|
||||
Reference in New Issue
Block a user