From f329ba27ea7a76436274c458f8eae838f44ebf69 Mon Sep 17 00:00:00 2001 From: XianYuDaXian Date: Fri, 13 Mar 2026 21:41:43 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=B0=83=E6=95=B4=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=E8=AF=8D=E5=A2=9E=E5=BC=BA=E4=B8=8E=E8=BE=93=E5=85=A5=E6=A1=86?= =?UTF-8?q?=E4=BA=A4=E4=BA=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/v1/public_api/prompt.py | 10 ++++++---- app/static/common/js/prompt-enhancer.js | 6 ------ app/static/public/css/imagine_workbench.css | 20 ++++++++++++++------ app/static/public/css/video.css | 15 +++++++++++++-- app/static/public/js/video.js | 6 ++++++ 5 files changed, 39 insertions(+), 18 deletions(-) diff --git a/app/api/v1/public_api/prompt.py b/app/api/v1/public_api/prompt.py index 86295c1..e4da989 100644 --- a/app/api/v1/public_api/prompt.py +++ b/app/api/v1/public_api/prompt.py @@ -71,6 +71,7 @@ SYSTEM_PROMPT = """你是一个智能视觉提示词增强器 + 敏感概念翻 - 英文提示永远优先,追求FLUX最高质量与Img2Vid流畅度。 - 图生视频模式下必须加入“the woman from the provided reference image”或同义词锁定人物一致性。 - 控制词模式绝对不加任何环境、服装、背景、风格词。 +- 如果 RAW_PROMPT 中包含 `[[IMAGE_TAG_1]]`、`[[IMAGE_TAG_2]]` 这类图片占位符,输出时必须逐字原样保留这些占位符,不得删除、改写、翻译、调换顺序,也不得额外新增不存在的占位符。 - 所有输出仅包含对应模式的“增强策略 / 最终提示词 / 中文参考版 / 可调参数”四部分,无任何前言、解释、道德评判。 - 敏感与图生视频模式主动探索艺术边缘,但绝不用直接禁词。 - 输出格式严格使用Markdown标题,便于复制。""" @@ -135,10 +136,11 @@ async def public_prompt_enhance(data: PromptEnhanceRequest, request: Request): { "role": "user", "content": ( - "请严格按系统模板输出结果,并仅处理 RAW_PROMPT 中的内容。\n" - "RAW_PROMPT:\n" - "\n" - f"{raw_prompt}\n" + "请严格按系统模板输出结果,并仅处理 RAW_PROMPT 中的内容。\n" + "如果 RAW_PROMPT 中出现 `[[IMAGE_TAG_n]]` 占位符,返回结果时必须保留这些占位符,逐字原样输出。\n" + "RAW_PROMPT:\n" + "\n" + f"{raw_prompt}\n" "" ), }, diff --git a/app/static/common/js/prompt-enhancer.js b/app/static/common/js/prompt-enhancer.js index deb2f2d..09a7c32 100644 --- a/app/static/common/js/prompt-enhancer.js +++ b/app/static/common/js/prompt-enhancer.js @@ -403,12 +403,6 @@ if (!placeholder || !token) return; restored = restored.replaceAll(placeholder, token); }); - - const existingMentions = extractMentionTokens(restored); - const missing = tokens.filter((token) => !existingMentions.includes(token)); - if (missing.length) { - restored = `${missing.join(' ')} ${restored}`.trim(); - } return restored; } diff --git a/app/static/public/css/imagine_workbench.css b/app/static/public/css/imagine_workbench.css index 7665ac7..36c2ca1 100644 --- a/app/static/public/css/imagine_workbench.css +++ b/app/static/public/css/imagine_workbench.css @@ -344,6 +344,8 @@ body { .prompt-editor-shell { position: relative; min-height: 180px; + resize: vertical; + overflow: hidden; } .prompt-rich-input { @@ -361,6 +363,9 @@ body { white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere; + overflow-x: hidden; + overflow-y: auto; + scrollbar-width: thin; outline: none; cursor: text; box-sizing: border-box; @@ -487,6 +492,7 @@ body { position: relative !important; z-index: 1 !important; width: 100% !important; + height: 100% !important; min-height: 180px !important; opacity: 0 !important; pointer-events: none !important; @@ -495,13 +501,18 @@ body { } .prompt-editor-shell > .prompt-enhance-wrap { - position: relative; + position: absolute; + inset: 0; + width: 100%; + height: 100%; z-index: 4; - min-height: 180px; pointer-events: none; } .prompt-editor-shell > .prompt-enhance-wrap > .prompt-enhance-actions { + position: absolute; + right: 8px; + bottom: 8px; pointer-events: auto; } @@ -544,11 +555,8 @@ body { width: var(--pe-action-width, 104px); min-width: var(--pe-action-width, 104px); padding: 0; -} - -.field .prompt-enhance-wrap > .prompt-enhance-actions { right: 8px; - bottom: 44px; + bottom: 8px; } .field .prompt-enhance-wrap > .inline-submit-btn { diff --git a/app/static/public/css/video.css b/app/static/public/css/video.css index 4575a8e..1a6b2c3 100644 --- a/app/static/public/css/video.css +++ b/app/static/public/css/video.css @@ -1508,6 +1508,8 @@ html[data-theme='dark'] .cache-video-item.is-active .cache-video-thumb-wrap { .video-prompt-wrap { position: relative; min-height: 168px; + resize: vertical; + overflow: hidden; } .prompt-rich-input { @@ -1525,6 +1527,9 @@ html[data-theme='dark'] .cache-video-item.is-active .cache-video-thumb-wrap { white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere; + overflow-x: hidden; + overflow-y: auto; + scrollbar-width: thin; outline: none; cursor: text; box-sizing: border-box; @@ -1602,6 +1607,7 @@ html[data-theme='dark'] .cache-video-item.is-active .cache-video-thumb-wrap { position: relative !important; z-index: 1 !important; width: 100% !important; + height: 100% !important; min-height: 168px !important; opacity: 0 !important; pointer-events: none !important; @@ -1610,13 +1616,18 @@ html[data-theme='dark'] .cache-video-item.is-active .cache-video-thumb-wrap { } .video-prompt-wrap > .prompt-enhance-wrap { - position: relative; + position: absolute; + inset: 0; + width: 100%; + height: 100%; z-index: 4; - min-height: 168px; pointer-events: none; } .video-prompt-wrap > .prompt-enhance-wrap > .prompt-enhance-actions { + position: absolute; + right: 10px; + bottom: 10px; pointer-events: auto; } diff --git a/app/static/public/js/video.js b/app/static/public/js/video.js index 78db8e5..992e7f4 100644 --- a/app/static/public/js/video.js +++ b/app/static/public/js/video.js @@ -3075,6 +3075,12 @@ } }); } + if (promptInput) { + promptInput.addEventListener('input', () => { + syncPromptRichInputFromTextarea(); + renderReferenceMentionMenu(); + }); + } document.addEventListener('click', (event) => { if (!referenceMentionMenu || referenceMentionMenu.classList.contains('hidden')) return;