From 2512a2b957f4d7ebc8b7d06b158a713c05129dc1 Mon Sep 17 00:00:00 2001 From: kang Date: Wed, 13 May 2026 00:28:31 +0800 Subject: [PATCH] auto-save 2026-05-13 00:28 (~4) --- .memory/worklog.json | 7 +++++++ api/main.py | 7 +++++-- web/components/dashboard.tsx | 37 ++++++++++++++++++++++++++++++------ web/lib/api.ts | 2 +- 4 files changed, 44 insertions(+), 9 deletions(-) diff --git a/.memory/worklog.json b/.memory/worklog.json index 75d64f4..b76a55a 100644 --- a/.memory/worklog.json +++ b/.memory/worklog.json @@ -531,6 +531,13 @@ "message": "auto-save 2026-05-13 00:17 (~1)", "hash": "2d7c6cc", "files_changed": 1 + }, + { + "ts": "2026-05-13T00:23:01+08:00", + "type": "commit", + "message": "auto-save 2026-05-13 00:22 (~4)", + "hash": "66fb144", + "files_changed": 4 } ] } diff --git a/api/main.py b/api/main.py index dca932d..72a47d0 100644 --- a/api/main.py +++ b/api/main.py @@ -597,7 +597,8 @@ def get_frame(job_id: str, idx: int): class GenerateReq(BaseModel): prompt: str - extra_prompt: str = "" + extra_prompt: str = "" # ✓ 需要的元素(正向) + negative_prompt: str = "" # ✗ 不需要的元素(负向) model: str = "" # 留空用 IMAGE_MODEL 默认 mode: str = "edit" # "edit" 带参考图,"text" 纯文字 @@ -617,7 +618,9 @@ def generate_image(job_id: str, idx: int, req: GenerateReq) -> Job: full_prompt = req.prompt.strip() if req.extra_prompt.strip(): - full_prompt = f"{full_prompt}. {req.extra_prompt.strip()}" + full_prompt = f"{full_prompt}. Include: {req.extra_prompt.strip()}" + if req.negative_prompt.strip(): + full_prompt = f"{full_prompt}. Do NOT include: {req.negative_prompt.strip()}. Output must be clean without any watermark, username text, or platform logo." if not full_prompt: raise HTTPException(400, "prompt required") diff --git a/web/components/dashboard.tsx b/web/components/dashboard.tsx index 4d41bf1..f38dad9 100644 --- a/web/components/dashboard.tsx +++ b/web/components/dashboard.tsx @@ -580,6 +580,7 @@ function ImageGenCard({ job, frame, onJobUpdate }: { onJobUpdate: (j: Job) => void }) { const [extra, setExtra] = useState("") + const [negative, setNegative] = useState("水印, @用户名, TikTok logo, 平台文字, 浮水印") const [model, setModel] = useState("gemini-3-pro-image-preview") const [mode, setMode] = useState<"edit" | "text">("edit") const [generating, setGenerating] = useState(false) @@ -605,6 +606,7 @@ function ImageGenCard({ job, frame, onJobUpdate }: { const updated = await generateImage(job.id, frame.index, { prompt: editablePrompt, extra_prompt: extra, + negative_prompt: negative, model, mode, }) @@ -660,14 +662,14 @@ function ImageGenCard({ job, frame, onJobUpdate }: { - {/* base prompt(可展开编辑) */} + {/* 画面描述(AI 自动 · 可展开编辑) */}
{showPrompt && ( @@ -680,18 +682,41 @@ function ImageGenCard({ job, frame, onJobUpdate }: { )}
- {/* 用户额外指令 */} + {/* 正向:我要保留 / 加入 */}
-
我的需求(额外指令)
+
+ ✓ 需要保留 / 加入 +