Skip to content

feat(vlm): 支持vlm单独配置请求超时时间 - #119

Open
rranr wants to merge 1 commit into
nageoffer:mainfrom
rranr:issue-107
Open

feat(vlm): 支持vlm单独配置请求超时时间#119
rranr wants to merge 1 commit into
nageoffer:mainfrom
rranr:issue-107

Conversation

@rranr

@rranr rranr commented Aug 16, 2026

Copy link
Copy Markdown

feat(vlm): 支持单独配置请求超时时间

背景

#107

知识库上传图片后会调用 VLM 生成图片描述。原实现直接复用全局 syncHttpClient,其读取超时为 30 秒。当 VLM 正常响应时间超过该限制时,图片分块任务会因 timeout 失败。

修改内容

  • 增加 ai.vlm.timeout-ms 配置,默认值为 120000 毫秒。
  • 将 VLM 模型组的超时预算传递到 ModelTarget
  • 基于全局 syncHttpClient 派生 VLM 客户端,仅覆盖 readTimeoutcallTimeout,保留原有连接、写入及重试配置。
  • 未配置 timeout-ms 时继续使用全局同步 HTTP 客户端,保持向后兼容。
  • 显式配置为 0 或负数时,在启动阶段校验失败。
  • 在系统设置接口和管理端 VLM 卡片中展示当前超时时间。
  • 增加候选选择、配置校验和实际请求超时行为测试。

配置示例

ai:
  vlm:
    timeout-ms: 120000

兼容性影响

  • 仅影响 VLM 同步请求。
  • 未配置该参数时,继续沿用原有 syncHttpClient 超时配置。

验证

相关后端测试

./mvnw -pl rag -am \
  -Dtest=VlmConfigValidatorTest,ModelSelectorTest,RoutingVlmServiceTest,RagentCoreApplicationTests \
  -Dsurefire.failIfNoSpecifiedTests=false test

结果:18 个测试全部通过。

前端类型检查与生产构建

cd frontend
npx tsc --noEmit
VITE_API_BASE_URL=/api/ragent npm run build

结果:类型检查和生产构建通过。

截图

系统设置页面的 VLM 卡片会展示当前配置的超时时间。此处设置为timeout-ms: 120000

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant