Repository navigation
fix(local): route Ollama through native /api/chat for think: false - #11
Merged
Merged
Conversation
Ollama 0.18.x ignores think on /v1/chat/completions. Route local chat through /api/chat, map responses to OpenAI ChatCompletion shape, and emit SSE chunks from NDJSON streams for the plugin proxy. Co-authored-by: 0x4C33 <haoruilee@users.noreply.github.com>
haoruilee
marked this pull request as ready for review
April 2, 2026 06:51
Co-authored-by: 0x4C33 <haoruilee@users.noreply.github.com>
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.
Summary
Ollama 0.18.x honors
thinkon the nativePOST /api/chatendpoint but not on the OpenAI-compatible/v1/chat/completionspath. The plugin was sending local traffic to the latter, sothink: false(andlocalDisableThinking) had no effect on reasoning-style models.Changes
LocalAdapternow calls${localProxyUrl}/api/chatfor both non-streaming and streaming chat.model,messages(same OpenAI-style array),stream, optional nativethink, andoptionsfortemperature,top_p,num_predict(frommax_tokens). Optionaltools/tool_choice/stopare forwarded when present.chat.completion(choices[0].message,finish_reason, optionalusagefrom eval counts).data: { ... chat.completion.chunk ... }\n\nplusdata: [DONE]) so the existing proxy (text/event-stream) stays compatible with OpenAI clients.1.2.14→1.2.15(package.json,openclaw.plugin.json,package-lock.json).Tests
/api/chatURL and Ollama-shaped mock responses;npm testpasses.Notes
/api/tags(and/v1/modelsfallback) as before.mainis fine after review; optional: runnpm run test:e2elocally if you have Ollama + key.