Skip to content

Commit 280852d

Browse files
fix(api): Fetch default model in config if the state is not set yet
1 parent 94c4fc6 commit 280852d

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

lua/opencode/api.lua

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,13 @@ function M.mcp()
513513
end
514514

515515
function M.current_model()
516-
return state.current_model or ''
516+
if state.current_model and state.current_model ~= "" then
517+
return state.current_model
518+
else
519+
local conf = require('opencode.config_file').get_opencode_config()
520+
local model = conf and conf.model
521+
return model or ''
522+
end
517523
end
518524

519525
--- Runs a user-defined command by name.

0 commit comments

Comments
 (0)