From 9ef7604135058fb0a203d9fc0f5b53b480fb8dd9 Mon Sep 17 00:00:00 2001 From: foxhui Date: Sun, 11 Jan 2026 19:41:37 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20LMA=20=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E4=B8=8A=E4=BC=A0=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 10 ++++++++++ src/backend/adapter/lmarena.js | 22 +++++++++++----------- src/backend/adapter/lmarena_text.js | 20 ++++++++++---------- 3 files changed, 31 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d3c6f13..f058c54 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [3.4.5] - 2026-01-11 + +### ✨ Added +- **增加计数功能** + - 支持在 WebUI 记录与查看成功次数 + +### 🐛 Fixed +- **修复图片上传** + - 修复 LMArena 因模型选择与图片上传的顺序错误导致的图片上传失败 + ## [3.4.4] - 2026-01-10 ### ✨ Added diff --git a/src/backend/adapter/lmarena.js b/src/backend/adapter/lmarena.js index 827967b..5117d63 100644 --- a/src/backend/adapter/lmarena.js +++ b/src/backend/adapter/lmarena.js @@ -68,16 +68,7 @@ async function generate(context, prompt, imgPaths, modelId, meta = {}) { await waitForInput(page, textareaSelector, { click: false }); await sleep(1500, 2500); - // 2. 上传图片 (uploadImages) - if (imgPaths && imgPaths.length > 0) { - await pasteImages(page, textareaSelector, imgPaths); - } - - // 3. 填写提示词 (fillPrompt) - await safeClick(page, textareaSelector, { bias: 'input' }); - await fillPrompt(page, textareaSelector, prompt, meta); - - // 4. 选择模型 + // 2. 选择模型(必须在上传图片之前,因为能否上传图片取决于模型 imagePolicy) if (modelId) { logger.debug('适配器', `选择模型: ${modelId}`, meta); const modelCombobox = page.locator('#chat-area') @@ -97,6 +88,15 @@ async function generate(context, prompt, imgPaths, modelId, meta = {}) { await sleep(500, 800); } + // 3. 上传图片 (uploadImages) + if (imgPaths && imgPaths.length > 0) { + await pasteImages(page, textareaSelector, imgPaths); + } + + // 4. 填写提示词 (fillPrompt) + await safeClick(page, textareaSelector, { bias: 'input' }); + await fillPrompt(page, textareaSelector, prompt, meta); + // 5. 提交表单 (submit) logger.debug('适配器', '点击发送...', meta); await submit(page, { @@ -212,7 +212,7 @@ export const manifest = { { id: 'qwen-image-edit', codeName: '995cf221-af30-466d-a809-8e0985f83649', imagePolicy: 'required' }, { id: 'ideogram-v3-quality', codeName: '73378be5-cdba-49e7-b3d0-027949871aa6', imagePolicy: 'forbidden' }, { id: 'hunyuan-image-2.1', codeName: 'a9a26426-5377-4efa-bef9-de71e29ad943', imagePolicy: 'forbidden' }, - { id: 'qwen-image-2512', codeName: '', imagePolicy: 'optional' }, + { id: 'qwen-image-2512', codeName: '', imagePolicy: 'forbidden' }, { id: 'wan2.5-t2i-preview', codeName: '019a5050-2875-78ed-ae3a-d9a51a438685', imagePolicy: 'forbidden' }, { id: 'reve-v1.1', codeName: '', imagePolicy: 'required' }, { id: 'chatgpt-image-latest', codeName: '', imagePolicy: 'optional' }, diff --git a/src/backend/adapter/lmarena_text.js b/src/backend/adapter/lmarena_text.js index a46e270..e40c0ab 100644 --- a/src/backend/adapter/lmarena_text.js +++ b/src/backend/adapter/lmarena_text.js @@ -49,16 +49,7 @@ async function generate(context, prompt, imgPaths, modelId, meta = {}) { await waitForInput(page, textareaSelector, { click: false }); await sleep(1500, 2500); - // 2. 上传图片 (uploadImages) - if (imgPaths && imgPaths.length > 0) { - await pasteImages(page, textareaSelector, imgPaths); - } - - // 3. 填写提示词 (fillPrompt) - await safeClick(page, textareaSelector, { bias: 'input' }); - await fillPrompt(page, textareaSelector, prompt, meta); - - // 4. 选择模型 + // 2. 选择模型(必须在上传图片之前,因为能否上传图片取决于模型 imagePolicy) if (modelId) { logger.debug('适配器', `选择模型: ${modelId}`, meta); const modelCombobox = page.locator('#chat-area') @@ -78,6 +69,15 @@ async function generate(context, prompt, imgPaths, modelId, meta = {}) { await sleep(500, 800); } + // 3. 上传图片 (uploadImages) + if (imgPaths && imgPaths.length > 0) { + await pasteImages(page, textareaSelector, imgPaths); + } + + // 4. 填写提示词 (fillPrompt) + await safeClick(page, textareaSelector, { bias: 'input' }); + await fillPrompt(page, textareaSelector, prompt, meta); + // 5. 提交表单 (submit) logger.debug('适配器', '点击发送...', meta); await submit(page, {