feat: 添加独立视觉模型配置,支持fallback到主LLM#2
Merged
Merged
Conversation
❌ CLA Signature Required@whyovo Some contributors need to sign the CLA:
Please:
📋 View detailed check results: Action Run #24410717863 💡 Tip: All contributors must sign the CLA before the PR can be merged. |
Contributor
Author
|
/check-cla |
✅ CLA Verification Complete@whyovo All contributors have signed the CLA!
📋 View detailed check results: Action Run #24411063506 Your pull request can now proceed with the review process! 🎉 |
Add set_vision_llm command allowing users to configure a separate vision-capable model (e.g. mimo-v2-omni, gpt-4o, qwen-vl-max) for image analysis while keeping a cheaper text model for chat. When vision_model is not configured, vision calls automatically fall back to the main LLM config, maintaining full backward compatibility. Changes: - agent_config.h: add AGENT_CFG_KEY_VISION_* config keys - llm_proxy.c: add vision static vars, snapshot, setter with fallback - llm_proxy.h: declare llm_snapshot_vision_config, llm_set_vision_model - llm_vision.c: use vision-specific config in both vision entry points - cmd_llm.c: add cmd_set_vision_llm with 4 presets (mimo/openai/qwen/glm) - nsh_commands.c: register command, update help text and config_show Also fix mimo preset model name from MiMo-v2-Flash to mimo-v2-flash (lowercase) as required by api.xiaomimimo.com. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
skyxiaobai
reviewed
Apr 15, 2026
| strncpy(s_vision_host, host, sizeof(s_vision_host) - 1); | ||
| s_vision_host[sizeof(s_vision_host) - 1] = '\0'; | ||
| } else { | ||
| config_del(AGENT_CFG_KEY_VISION_HOST); |
Collaborator
There was a problem hiding this comment.
config_del not public api, please use claw_config_set
skyxiaobai
reviewed
Apr 15, 2026
|
|
||
| pthread_mutex_unlock(&s_llm_lock); | ||
|
|
||
| syslog(LOG_INFO, "[%s] Vision LLM config updated: model=%s host=%s\n", |
Collaborator
There was a problem hiding this comment.
syslog should move to unlock before
- Replace config_del with claw_config_set(key, "") per review feedback, using the public API instead of the non-public config_del function - Move syslog before pthread_mutex_unlock to avoid reading s_vision_model/s_vision_host after lock release Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Author
|
Thank you for your feedback! I've updated the code accordingly. |
skyxiaobai
approved these changes
Apr 16, 2026
skyxiaobai
approved these changes
Apr 16, 2026
TangMeng12
approved these changes
Apr 16, 2026
This was referenced Apr 16, 2026
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.
概述
set_vision_llm命令,允许为图片分析配置独立的视觉模型,同时保留文本模型用于对话。这样的话就可以文本用mimo-v2-flash,图片才用omni,降低成本。而且也可以参考miloco,单独在服务器布置视觉模型,比如miloco-vl-7b,这样可以保护图片的隐私,文本可以调用性能更高更快的api。当未配置视觉多模态模型或者运用set_vision_llm clear删除后,视觉理解依然使用原本的文本接口,保证原功能不变。MiMo-v2-Flash改为mimo-v2-flash(全小写),适配 api.xiaomimimo.com 的要求改动文件
include/agent_config.hAGENT_CFG_KEY_VISION_MODEL/HOST/API_KEY配置 keysrc/llm/llm_proxy.cllm_snapshot_vision_config()(带 fallback)、llm_set_vision_model()settersrc/llm/llm_proxy.hllm_snapshot_vision_config和llm_set_vision_modelsrc/llm/llm_vision.cllm_chat_vision和llm_chat_vision_raw改用 vision 专用配置src/channels/cmd_llm.ccmd_set_vision_llm(含 mimo/openai/qwen/glm 四个 preset),修复 mimo 模型名src/channels/cmd_llm.hcmd_set_vision_llmsrc/channels/nsh_commands.c工作原理
analyze_image、camera_capture)自动 fallback 到主 LLM 配置 — 完全向后兼容使用方式