You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(ollama): add native thinking/reasoning support (#832)
* feat(ollama): add native thinking/reasoning support
- Add Enable Thinking checkbox + ThinkingBudget selector to Ollama settings
- Map reasoning effort to Ollama native think param (low/medium/high)
- Stream message.thinking as reasoning chunks
- Round-trip prior reasoning/thinking blocks for multi-turn thinking
- Add unit tests for native-ollama and Ollama settings component
- Add i18n strings for thinking toggle
Closes#831
* i18n: add Ollama thinking translations for all locales
Adds thinking and thinkingHelp strings for the new Ollama native
thinking toggle across all 17 non-English webview-ui locales.
Part of #831
* fix(ollama): resolve check-types error, gate think param on opt-in, address CodeRabbit comments
- Fix TS2367 in native-ollama.ts: remove unreachable 'image' branch from
assistant message conversion (Anthropic ContentBlock union has no 'image';
assistant cannot send images). User-message image handling is preserved.
- Gate getOllamaThinkParam on enableReasoningEffort === true so a stale
reasoningEffort inherited from another provider config cannot silently
emit a think param when the Ollama UI checkbox is unchecked.
- Extract buildChatRequestOptions() helper shared by createMessage and
completePrompt to eliminate duplicated request-option assembly.
- Ollama settings UI: preserve reasoningEffort across checkbox toggles
instead of wiping it to undefined when unchecked; restore the prior value
on re-enable rather than forcing 'medium'.
- Add tests for the stale-config case, the disable+opt-in case, and the
completePrompt non-Error throw branch. Coverage now 83.89% (>= 80%).
* docs(ollama): add explanatory comment for removed Anthropic image branch in assistant messages
* test(ollama): improve patch coverage for native thinking support
Add tests covering previously uncovered branches in native-ollama.ts:
- Anthropic-protocol thinking block round-tripping (block.type === thinking)
- Concatenation of multiple reasoning/thinking blocks with newline joins
- Empty reasoning/thinking blocks (length > 0 false branch + reasoningText || undefined)
- Plain assistant message without reasoning blocks (falsy reasoningText branch)
- Unknown reasoningEffort value (default switch branch returns undefined)
- Stream processing error wrapping (catch streamError branch + Unknown error fallback)
- Non-ECONNREFUSED non-404 error rethrow (fall-through throw error branch)
Also strengthen the Ollama.spec.tsx toggle-off assertion per CodeRabbit
nitpick: assert no call with reasoningEffort as the first argument at
all, instead of only ruling out undefined.
Patch coverage for native-ollama.ts rises from 71.05% to ~100% of new
lines, clearing the codecov/patch 80% threshold.
0 commit comments