fix(style): add parentheses (#471)

Signed-off-by: Aaron Pham <contact@aarnphm.xyz>
This commit is contained in:
Aaron Pham
2024-09-03 05:12:07 -04:00
committed by GitHub
parent 8cc674f1da
commit 0d8098e4eb
25 changed files with 213 additions and 214 deletions

View File

@@ -1,7 +1,7 @@
local Utils = require "avante.utils"
local Config = require "avante.config"
local Clipboard = require "avante.clipboard"
local P = require "avante.providers"
local Utils = require("avante.utils")
local Config = require("avante.config")
local Clipboard = require("avante.clipboard")
local P = require("avante.providers")
---@class OpenAIChatResponse
---@field id string
@@ -56,11 +56,11 @@ M.parse_message = function(opts)
end
M.parse_response = function(data_stream, _, opts)
if data_stream:match '"%[DONE%]":' then
if data_stream:match('"%[DONE%]":') then
opts.on_complete(nil)
return
end
if data_stream:match '"delta":' then
if data_stream:match('"delta":') then
---@type OpenAIChatResponse
local json = vim.json.decode(data_stream)
if json.choices and json.choices[1] then
@@ -80,7 +80,7 @@ M.parse_curl_args = function(provider, code_opts)
local headers = {
["Content-Type"] = "application/json",
}
if not P.env.is_local "openai" then headers["Authorization"] = "Bearer " .. provider.parse_api_key() end
if not P.env.is_local("openai") then headers["Authorization"] = "Bearer " .. provider.parse_api_key() end
return {
url = Utils.trim(base.endpoint, { suffix = "/" }) .. "/chat/completions",