feat: add url_join (#856)
This commit is contained in:
@@ -25,11 +25,10 @@ M.parse_curl_args = function(provider, code_opts)
|
||||
if not P.env.is_local("azure") then headers["api-key"] = provider.parse_api_key() end
|
||||
|
||||
return {
|
||||
url = Utils.trim(base.endpoint, { suffix = "/" })
|
||||
.. "/openai/deployments/"
|
||||
.. base.deployment
|
||||
.. "/chat/completions?api-version="
|
||||
.. base.api_version,
|
||||
url = Utils.url_join(
|
||||
base.endpoint,
|
||||
"/openai/deployments/" .. base.deployment .. "/chat/completions?api-version=" .. base.api_version
|
||||
),
|
||||
proxy = base.proxy,
|
||||
insecure = base.allow_insecure,
|
||||
headers = headers,
|
||||
|
||||
@@ -106,7 +106,7 @@ M.parse_curl_args = function(provider, prompt_opts)
|
||||
local messages = M.parse_messages(prompt_opts)
|
||||
|
||||
return {
|
||||
url = Utils.trim(base.endpoint, { suffix = "/" }) .. "/v1/messages",
|
||||
url = Utils.url_join(base.endpoint, "/v1/messages"),
|
||||
proxy = base.proxy,
|
||||
insecure = base.allow_insecure,
|
||||
headers = headers,
|
||||
|
||||
@@ -85,7 +85,7 @@ M.parse_curl_args = function(provider, code_opts)
|
||||
if not P.env.is_local("cohere") then headers["Authorization"] = "Bearer " .. provider.parse_api_key() end
|
||||
|
||||
return {
|
||||
url = Utils.trim(base.endpoint, { suffix = "/" }) .. "/chat",
|
||||
url = Utils.url_join(base.endpoint, "/chat"),
|
||||
proxy = base.proxy,
|
||||
insecure = base.allow_insecure,
|
||||
headers = headers,
|
||||
|
||||
@@ -86,11 +86,10 @@ M.parse_curl_args = function(provider, code_opts)
|
||||
body_opts.max_tokens = nil
|
||||
|
||||
return {
|
||||
url = Utils.trim(base.endpoint, { suffix = "/" })
|
||||
.. "/"
|
||||
.. base.model
|
||||
.. ":streamGenerateContent?alt=sse&key="
|
||||
.. provider.parse_api_key(),
|
||||
url = Utils.url_join(
|
||||
base.endpoint,
|
||||
base.model .. ":streamGenerateContent?alt=sse&key=" .. provider.parse_api_key()
|
||||
),
|
||||
proxy = base.proxy,
|
||||
insecure = base.allow_insecure,
|
||||
headers = { ["Content-Type"] = "application/json" },
|
||||
|
||||
@@ -136,7 +136,7 @@ M.parse_curl_args = function(provider, code_opts)
|
||||
end
|
||||
|
||||
return {
|
||||
url = Utils.trim(base.endpoint, { suffix = "/" }) .. "/chat/completions",
|
||||
url = Utils.url_join(base.endpoint, "/chat/completions"),
|
||||
proxy = base.proxy,
|
||||
insecure = base.allow_insecure,
|
||||
headers = headers,
|
||||
|
||||
Reference in New Issue
Block a user