Skip to content

fix(kb): persist vlm_config on knowledge base update#1777

Open
lyra-planet wants to merge 1 commit into
Tencent:mainfrom
lyra-planet:fix/kb-update-vlm-config
Open

fix(kb): persist vlm_config on knowledge base update#1777
lyra-planet wants to merge 1 commit into
Tencent:mainfrom
lyra-planet:fix/kb-update-vlm-config

Conversation

@lyra-planet

@lyra-planet lyra-planet commented Jun 23, 2026

Copy link
Copy Markdown

Description

Fixes the knowledge base update API so top-level vlm_config is accepted and persisted by PUT /api/v1/knowledge-bases/{id}.

Previously, UpdateKnowledgeBaseRequest did not expose vlm_config, so Gin ignored the field during JSON binding and the service update path never saw it. The frontend already sends vlm_config when editing a knowledge base, but the backend response and follow-up GET kept the old disabled VLM configuration.

This PR adds vlm_config to the update request DTO, passes it through the knowledge base service update path, persists it only when explicitly provided, and keeps omitted vlm_config requests preserving the existing KB configuration. It also syncs the Go client request type, frontend API typing, and API docs.

Type of Change

  • 🐛 Bug fix
  • ✨ New feature
  • 💥 Breaking change
  • 📚 Documentation update
  • 🎨 Refactor
  • ⚡ Performance improvement
  • 🧪 Test
  • 🔧 Configuration / Build / CI

Related Issue

Fixes #1723

Testing

  • gofmt on changed Go files
  • go test ./internal/handler ./internal/application/service ./internal/agent/tools
  • (cd client && go test ./...)
  • Regression coverage added for the issue path:
    • UpdateKnowledgeBaseRequest now binds a top-level vlm_config field from the update JSON body.
    • UpdateKnowledgeBase preserves the existing VLM config when vlm_config is omitted.
    • UpdateKnowledgeBase overwrites the stored VLM config when vlm_config is provided.
  • Verified the [Bug]: KB更新API无法设置vlm_config — UpdateKnowledgeBaseRequest缺少VLMConfig字段 #1723 API scenario against a local WeKnora Lite instance:
    • Created a temporary knowledge base with VLM disabled.
    • Sent PUT /api/v1/knowledge-bases/{kbId} with {"name":"test","vlm_config":{"enabled":true,"model_id":"<vlm-model-id>"}}.
    • Confirmed the PUT response and follow-up GET /api/v1/knowledge-bases/{kbId} both returned vlm_config.enabled=true with the same model_id.

Checklist

  • Self-reviewed the code
  • Added/updated tests covering the change
  • Updated related documentation

Screenshots / Recordings

N/A; backend API fix with no UI-visible layout change.

@lyra-planet lyra-planet force-pushed the fix/kb-update-vlm-config branch from eb5b6a3 to 7c75028 Compare June 23, 2026 18:35
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.

[Bug]: KB更新API无法设置vlm_config — UpdateKnowledgeBaseRequest缺少VLMConfig字段

1 participant