feat(gateway): per-platform default model routing via config.platform_models#15660
feat(gateway): per-platform default model routing via config.platform_models#15660GeorgeXu wants to merge 2 commits into
Conversation
…_models
Allow config.yaml to specify default model/provider per IM platform
(e.g., weixin→qwen3.6, dingtalk→deepseek-v4-pro). Platform defaults
only apply when no /model session override is active.
Config format:
platform_models:
weixin:
provider: bailian
model: qwen3.6-plus
dingtalk:
provider: deepseek-pro
model: deepseek-v4-pro
Providers are resolved via resolve_runtime_provider(), supporting
env-var expansion and credential lookup for custom providers.
|
Likely duplicate of #11439 |
|
I checked #11439. The duplicate concern is real at the feature level even though the config surface is different ( From a maintainer-triage perspective, I don't think we should merge both. We should pick one configuration shape and converge the work there. Right now #11439 has the advantage of being older and already touching the surrounding gateway/session/docs surface. |
5 tests covering: correct routing, session override precedence, missing key silent noop, missing section noop, resolution failure. All existing 12 tests continue to pass. docs: add per-platform default model section to FAQ
|
Thanks for the review @alt-glitch and @nwang783 — appreciate the careful triage. I read through #11439 and wanted to share some perspective from a user/product angle rather than re-litigate the technical debate. Config surface: what does the user see? The two proposals expose different UX: # #11439 — platforms.<platform>.extra
platforms:
telegram:
extra:
model: claude-sonnet-4
provider: anthropic# #15660 — platform_models (this PR)
platform_models:
weixin:
provider: bailian
model: qwen3.6-plusFor a user who just wants "WeChat uses Qwen, DingTalk uses DeepSeek", This matters because Hermes has 123k stars — the majority of users configure via copy-paste and YAML editing, not by reading docs first. Scope: 39 lines vs 268 This PR is a single injection point — it resolves the platform default once at session creation and the rest of the system is unaware. #11439 threads platform awareness through 6 functions. Smaller surface means fewer future bugs when those functions change. What I have added
I am not precious about which config shape wins — if the maintainers prefer the Decision is yours. Happy to iterate either way. |
Summary
Allow users to configure different default models per IM platform (WeChat, DingTalk, Telegram, Discord, etc.) via
config.yaml.Problem
Currently Hermes uses a single global default model for all platforms. Users who want DingTalk conversations to use DeepSeek v4 while WeChat uses Qwen 3.6 have no way to set this — they must manually
/modelswitch in each session. When sessions expire and are recreated, the override is lost.Solution
Adds a
platform_modelssection toconfig.yaml:The gateway reads this during session/agent creation. Platform defaults only apply when no explicit
/modelsession override is active — the user's manual override always wins.Implementation
gateway/run.pyinGatewayRunner._create_agent_for_session()resolve_runtime_provider()for provider resolution (supports env-var expansion and credential lookup)platform_modelsfield is missing from config