File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -369,10 +369,13 @@ function Copilot:ask(prompt, opts)
369369 local full_response = ' '
370370
371371 self .current_job_on_cancel = on_done
372+
373+ local temp_file = vim .fn .tempname ()
374+ vim .fn .writefile ({ body }, temp_file )
372375 self .current_job = curl
373376 .post (url , {
374377 headers = headers ,
375- body = body ,
378+ body = temp_file ,
376379 proxy = self .proxy ,
377380 insecure = self .allow_insecure ,
378381 on_error = function (err )
@@ -423,7 +426,7 @@ function Copilot:ask(prompt, opts)
423426 })
424427
425428 if not ok then
426- err = ' Failed parse response: ' .. vim .inspect (content )
429+ err = ' Failed parse response: \n ' .. line .. ' \n ' .. vim .inspect (content )
427430 log .error (err )
428431 return
429432 end
@@ -484,9 +487,12 @@ function Copilot:embed(inputs, opts)
484487 local body = vim .json .encode (generate_embedding_request (chunk , model ))
485488
486489 table.insert (jobs , function (resolve )
490+ local temp_file = vim .fn .tempname ()
491+ vim .fn .writefile ({ body }, temp_file )
492+
487493 curl .post (url , {
488494 headers = headers ,
489- body = body ,
495+ body = temp_file ,
490496 proxy = self .proxy ,
491497 insecure = self .allow_insecure ,
492498 on_error = function (err )
You can’t perform that action at this time.
0 commit comments