feat: VLM 配置测试入口(选图即测 + 排障报文) - #2030
Open
jarvislee90s-dot wants to merge 6 commits into
Open
Conversation
为纯文本模型的 VLM 视觉辅助配置提供即测即看的验证入口。 核心契约:测试请求与真实识图链路同源;交互为选图即测 + 排障增强(原始报文折叠、一键复制错误)。
- 提示词常量与请求体构造提取为共享原语,call_vlm_batch 等价重构, vlm_endpoint 共享端点构造——测试请求与真实识图请求构造同源 - VlCallOutcome 结构化结果:status 分类(ok/http_error/timeout/ send_error/json_error/no_text)+ 耗时 + 原始请求/响应(展示副本: base64 截断、永不包含 API Key) - 错误判定先读 body 再判 HTTP 码,HTML 错误页不再误判为 json_error - 11 例 wiremock 测试逐类覆盖失败口径 + 请求体形状钉子
表单当前值(未保存可测)→ test_vlm_once 单图调用 → 结构化结果 返回前端。HTTP 客户端复用 vlm_http_client(与真实链路同款 连接/总超时)。
状态分类 -> 人话文案(认证失败 401/403、接口不存在、限流、超时、 网络、解析等),翻译回调注入,模块零依赖、16 例单测(含逐字锁定)。 认证失败归因 API Key 或模型名——手工验收发现部分网关对未知模型 也返回 401,单一归因 Key 会误导。
- VLM 配置区底部入口,就地内联展开;选完图片自动发起,无需二次点击 - 结果区:通俗诊断 + 描述原文 + 复制错误(诊断+原始报文,无 Key) + 可折叠原始请求/响应 - 图片超 10MB / 非图片拒绝;表单当前值即可测;a11y(role/aria)齐备
i18n-verify.mjs 增扫 vlm-test-translation.ts;tr(zh) 按 plain、 tr(zh, params) 按 template 归类。本 PR 新增 29 键零缺失零冗余 (工具余下的缺失/冗余均为上游既有词典漂移,与本 PR 无关)。
jarvislee90s-dot
marked this pull request as ready for review
August 27, 2026 17:11
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
feat: VLM 配置测试入口(选图即测 + 排障报文)
PR 正文
背景
为纯文本模型配置 VLM 视觉辅助分析后,目前没有任何验证手段——只能等真实对话里发图,靠结果反推配置是否生效。常见遭遇:模型先说"不接受图片输入",追问后却开始幻觉式描述图片,用户无法判断是 Key 错、Base URL 错、模型名错,还是 VLM 服务本身异常(#1599)。
本 PR 在 VLM 配置区(Vision Analysis Provider)增加「测试 VLM」入口:选一张图立刻验证配置,失败时给人话诊断与完整排障信息。
设计要点:与真实链路同源
测试请求与真实识图链路共享同一提示词常量、请求体构造与端点构造(
call_vlm_batch等价重构为共用原语,行为零变化,现有测试兜底),并共用全局并发信号量。测试通过即代表真实对话识图可用;一个形状钉子测试锁定提示词与请求体逐字一致。交互
测试
自动化(全绿):
codex-plus-corevision 68 例:11 例 wiremock 逐类失败口径(成功 / 401 / 404 / 429 / 502 HTML 错误页 / 超时 / 连接拒绝 / 非 JSON / 无描述文本)+ 请求体形状钉子 + 无 Key 泄漏钉子protocol_proxy74 例;cargo build --workspace干净tsc --noEmit零错误手工验收(15 项全过):
说明
95abcf6(main 祖先):main 当前 tip 在 Windows 目标编译失败(fix(dream_skin): fix Windows-only compile error breaking Windows CI #2024 修复中),其合并后我会 rebasetools/i18n-verify.mjs)本 PR 扩展为识别注入式tr回调;存量词典漂移建议后续单独清理