mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-14 03:02:14 +03:00
Thinking-mode upstreams routed through OpenCode (DeepSeek V4 Flash, Kimi, MiniMax, ...) require `reasoning_content` echoed back on every prior assistant message. Standard OpenAI clients drop that field across turns, so multi-turn `oc/deepseek-v4-flash-free` requests failed with `400 reasoning_content must be passed back`. OpencodeExecutor.transformRequest now invokes a small, pure helper (`open-sse/utils/reasoningContentInjector.ts`) that injects a non-empty placeholder on assistant messages lacking one. Scope is gated by a model id regex (`deepseek`/`kimi`/`k2`/`minimax`), so non-thinking opencode models are untouched and an existing non-empty `reasoning_content` is preserved verbatim. TDD: tests/unit/opencode-deepseek-reasoning-injected.test.ts (4 cases — deepseek inject, preserve existing, kimi inject, negative for gpt-5). Co-authored-by: Neonity2020 <Neonity2020@users.noreply.github.com> Inspired-by: https://github.com/decolua/9router/pull/1099