fix: 调整提示词增强与输入框交互

This commit is contained in:
XianYuDaXian committed 2026-03-13 21:41:57 +08:00
1 parent 699bc0828b
commit f329ba27ea
5 files changed
+39 -18

No files matched your search

+6 -4
View File
@@ -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"
"<RAW_PROMPT>\n"
f"{raw_prompt}\n"
"请严格按系统模板输出结果,并仅处理 RAW_PROMPT 中的内容。\n"
"如果 RAW_PROMPT 中出现 `[[IMAGE_TAG_n]]` 占位符,返回结果时必须保留这些占位符,逐字原样输出。\n"
"RAW_PROMPT:\n"
"<RAW_PROMPT>\n"
f"{raw_prompt}\n"
"</RAW_PROMPT>"
),
},
-6
View File
@@ -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;
}
+14 -6
View File
@@ -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 {
+13 -2
View File
@@ -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;
}
+6
View File
@@ -3075,6 +3075,12 @@
}
});
}
if (promptInput) {
promptInput.addEventListener('input', () => {
syncPromptRichInputFromTextarea();
renderReferenceMentionMenu();
});
}
document.addEventListener('click', (event) => {
if (!referenceMentionMenu || referenceMentionMenu.classList.contains('hidden')) return;