Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lua/codecompanion/adapters/ollama.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,13 @@ local function get_models(self, opts)
local headers = {
["content-type"] = "application/json",
}

local auth_header = "Bearer "
if _cached_adapter.env_replaced.authorization then
auth_header = _cached_adapter.env_replaced.authorization .. " "
end
if _cached_adapter.env_replaced.api_key then
headers["Authorization"] = "Bearer " .. _cached_adapter.env_replaced.api_key
headers["Authorization"] = auth_header .. _cached_adapter.env_replaced.api_key
end

local ok, response = pcall(function()
Expand Down