Skip to content

Commit 814f7ba

Browse files
tarrudaRobitx
andauthored
feat: handle o1 when used with copilot provider (#235)
The o1-preview and o1-mini models can be used with copilot provider when you have a copilot pro subscription. This ensures the request/response are handled in those cases (currently only openai provider is handled). Co-authored-by: Tibor Schmidt <robitx@gmail.com>
1 parent 19024cd commit 814f7ba

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lua/gp/dispatcher.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ D.prepare_payload = function(messages, model, provider)
174174
top_p = math.max(0, math.min(1, model.top_p or 1)),
175175
}
176176

177-
if provider == "openai" and model.model:sub(1, 1) == "o" then
177+
if (provider == "openai" or provider == "copilot") and model.model:sub(1, 1) == "o" then
178178
if model.model:sub(1, 2) == "o3" then
179179
output.reasoning_effort = model.reasoning_effort or "medium"
180180
end
@@ -303,7 +303,7 @@ local query = function(buf, provider, payload, handler, on_exit, callback)
303303
end
304304
local raw_response = qt.raw_response
305305
local content = qt.response
306-
if qt.provider == 'openai' and content == "" and raw_response:match('choices') and raw_response:match("content") then
306+
if (qt.provider == 'openai' or qt.provider == 'copilot') and content == "" and raw_response:match('choices') and raw_response:match("content") then
307307
local response = vim.json.decode(raw_response)
308308
if response.choices and response.choices[1] and response.choices[1].message and response.choices[1].message.content then
309309
content = response.choices[1].message.content

0 commit comments

Comments
 (0)