From 543aa135d44a0b302f9f040f3324aafdcc1432ab Mon Sep 17 00:00:00 2001 From: Oli Morris Date: Sat, 22 Feb 2025 17:37:44 +0000 Subject: [PATCH] try out fix --- lua/codecompanion/adapters/ollama.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lua/codecompanion/adapters/ollama.lua b/lua/codecompanion/adapters/ollama.lua index 5a4318537..c2806242a 100644 --- a/lua/codecompanion/adapters/ollama.lua +++ b/lua/codecompanion/adapters/ollama.lua @@ -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()