Conversation
|
Regarding testing, I manually tested the feature with Ollama and llama.cpp as providers, and used local models with reasoning and no reasoning. I did not test with OpenRouter because I do not pay for any models. I am happy to refine this feature further if you have any feedback or suggestions! |
@Daniel5055 IMHO I agree with your point of having a new option + key binding for toggling the reasoning traces as this provides a much cleaner UX & separates concerns w.r.t keybindings. If this is not yet part of the PR, go for it ! 👍 You have a valid 2nd point as well... Again if you have the fix for it, please go ahead (assuming it's not already a part of the PR) @will-lamerton what do you think ? I just eyeballed the PR & it looks good to me, will take a deeper look sometime soon.. but awesome stuff ! |
Openrouter hosts a few free models: https://openrouter.ai/models?max_price=0 I think the Gemma 4 model from your screencast video is also free in Openrouter as of this writing, it would be helpful if you could test with any free tier models on Openrouter as well. I'm happy to test as well if you'd like👍. |
|
Thanks! I meant the improvements section to reflect potential changes that could be made. The second point was more open ended, and I don't have a better solution unfortunately for now. But you make a good point for a separate option and key binding, and I'll look into implementing it 👍 Ah I didn't know about free models on OpenRouter. I'll do some manual testing with it then too. |
|
This looks excellent @Daniel5055 - love the design choices as well. I'll review the code properly later and if all is good I'll merge. 😎 |
|
@Daniel5055 changes look good to me. For the 2nd point you mentioned I guess it's fine if you don't currently have an implementation approach, but do try to create an issue for it if you can..that way we can tackle it in a future date ! |
|
@Avtrkrb I have implemented an option for expanding reasoning traces which can be configured in the preferences file. It can also be toggled dynamically with the Ctrl-R keybind. By default reasoning traces are not expanded. Let me know if you want any tweaks to this. I also tested the feature with OpenRouter using free reasoning and non-reasoning models, and it works as expected 👍 |
This is awesome ! |
Description
This PR adds reasoning traces for thinking LLMs, as proposed in #341. When a model begins reasoning, the user is informed with a
Thinkingmessage. If the 'expand tool results' option is toggled, the full reasoning text is displayed.Reasoning text is streamed to the user like regular responses, and preserved in the chat history. The following video demonstrates how the reasoning appears expanded and then compacted.
Screencast_20260415_141539.webm
Implementation Details
Model reasoning is accessed via the Vercel AI SDK. The reasoning stream is stored and rendered separately from the text stream. Once finished streaming, the reasoning remains as a live component in the chat history until the text stream is finished. Then the reasoning is added to the chat history together with the text as to ensure the correct ordering.
Potential Improvements
Type of Change
Testing
Automated Tests
.spec.ts/tsxfilespnpm test:allcompletes successfully)Manual Testing
Checklist