Add current_model function to the API#96
Conversation
|
@sudo-tee This specific change looks fine to me. It does make me wonder, tho, if there's a better way to initialize opencode.nvim/lua/opencode/ui/topbar.lua Lines 12 to 16 in c3ad995 Also possible it gets set by renderer: opencode.nvim/lua/opencode/ui/renderer.lua Lines 932 to 935 in c3ad995 Or it can be specifically selected: opencode.nvim/lua/opencode/core.lua Lines 180 to 189 in c3ad995 Would it be better to explicitly initialize so it's always well defined? Or maybe have a way in |
|
You are right. I've been thinking about that lately since I got annoyed by the fact that after a restart if you had a session with a specific model it defaults back to the default model instead of picking the one from the last message. The model should probably be set when the config is loaded if the config specifies one. And should also be determined by the last message in an active session. But it's tricky because if a new session is created after, it should be reset to default IMHO. A default initializer is a good idea, but only triggered once the config is loaded. I hope it makes sense? |
|
I'll take a stab at solving this. |
I had a little need for something like this in my confs. And I felt like it could be a useful addition so here's a PR.
I'm still testing it a bit so I'll undraft it in a bit and after adding some unit tests.