fix: check gemini api key (#1205)

This commit is contained in:
yetone 2025-02-07 13:21:45 +08:00 committed by GitHub
parent 12cf3c0418
commit c2b3cd7a32
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -93,11 +93,11 @@ M.parse_curl_args = function(provider, prompt_opts)
body_opts.temperature = nil body_opts.temperature = nil
body_opts.max_tokens = nil body_opts.max_tokens = nil
local api_key = provider.parse_api_key()
if api_key == nil then error("Cannot get the gemini api key!") end
return { return {
url = Utils.url_join( url = Utils.url_join(base.endpoint, base.model .. ":streamGenerateContent?alt=sse&key=" .. api_key),
base.endpoint,
base.model .. ":streamGenerateContent?alt=sse&key=" .. provider.parse_api_key()
),
proxy = base.proxy, proxy = base.proxy,
insecure = base.allow_insecure, insecure = base.allow_insecure,
headers = { ["Content-Type"] = "application/json" }, headers = { ["Content-Type"] = "application/json" },