mirror of
https://github.com/nesquena/hermes-webui.git
synced 2026-05-25 03:00:23 +00:00
520795fdd2
Providers like Xiaomi MiMo, DeepSeek, and Kimi require reasoning_content to be echoed back on every assistant message in multi-turn conversations with tool calls. Omitting it causes HTTP 400: 'The reasoning_content in the thinking mode must be passed back to the API.' The WebUI's _sanitize_messages_for_api() strips all fields not in _API_SAFE_MSG_KEYS before sending conversation history to the LLM API. reasoning_content was not in this whitelist, so it was silently dropped. The CLI path (run_agent.py) is unaffected because it has its own _copy_reasoning_content_for_api() logic that operates on raw message dicts without going through this filter. This is why the same session works from CLI but fails from WebUI with HTTP 400. The fix adds 'reasoning_content' to _API_SAFE_MSG_KEYS so the field passes through sanitization intact.