Skip to content

Commit 715080b

Browse files
committed
refactor(gitcommit): simplify generator setup and adapter configuration
- streamline adapter and model configuration logic - remove nested configuration handling - reduce complexity of generator setup method
1 parent c090747 commit 715080b

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

lua/codecompanion/_extensions/gitcommit/generator.lua

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,10 @@ local CONSTANTS = {
1919
--- @param adapter string? The adapter to use for generation
2020
--- @param model string? The model of the adapter to use for generation
2121
function Generator.setup(adapter, model)
22-
-- Get the adapter configuration properly
23-
local chat_config = codecompanion_config.strategies.chat
24-
25-
-- Handle adapter as a table (with name and model) or string
26-
if type(chat_config.adapter) == "table" then
27-
_adapter = adapter or chat_config.adapter.name
28-
_model = model or chat_config.adapter.model or chat_config.model
29-
else
30-
_adapter = adapter or chat_config.adapter
31-
_model = model or chat_config.model
32-
end
22+
_adapter = adapter
23+
_model = model
3324
end
25+
3426
---@param commit_history? string[] Array of recent commit messages for context (optional)
3527
function Generator.generate_commit_message(diff, lang, commit_history, callback)
3628
-- Setup adapter with proper resolution

0 commit comments

Comments
 (0)