Skip to content

Commit

Permalink
chore: copilot bearer refreshing
Browse files Browse the repository at this point in the history
  • Loading branch information
Robitx committed Mar 24, 2024
1 parent fd30689 commit 466aca4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lua/gp/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1036,6 +1036,7 @@ M.refresh_state = function()
local bearer = M._state.copilot_bearer or state.copilot_bearer or nil
if bearer and bearer.expires_at and bearer.expires_at < os.time() then
bearer = nil
M.refresh_copilot_bearer()
end
M._state.copilot_bearer = bearer

Expand Down Expand Up @@ -1381,7 +1382,8 @@ M.query = function(buf, provider, payload, handler, on_exit)
local bearer = M.providers[provider].secret
local headers = {}

if provider == "copilot" and M._state.copilot_bearer then
if provider == "copilot" then
M.refresh_copilot_bearer()
---@diagnostic disable-next-line: undefined-field
bearer = M._state.copilot_bearer.token or ""
headers = {
Expand Down

0 comments on commit 466aca4

Please sign in to comment.