feat: WebUI 测试支持图片、优化虚拟上下文

This commit is contained in:
foxhui
2025-12-21 03:00:58 +08:00
Unverified
parent 326607ea74
commit f649b7549e
14 changed files with 102 additions and 93 deletions
+10 -1
View File
@@ -213,7 +213,16 @@ async function parseTextRequest(messages, tempDir, imageLimit, modelId, isStream
// 4. 构建当前输入
const lastUserMsg = messages[lastUserIndex];
const currentContent = await processContent(lastUserMsg.content);
currentPrompt = `=== 当前输入 ===\nUser: ${currentContent}`;
// 判断是否需要添加分割符号
const hasContext = systemPrompt || historyPrompt;
if (hasContext) {
// 有上下文,添加分割符
currentPrompt = `=== 当前输入 ===\nUser: ${currentContent}`;
} else {
// 没有上下文,直接使用内容
currentPrompt = currentContent;
}
// 5. 合并最终 Prompt
const finalPrompt = systemPrompt + historyPrompt + currentPrompt;