fix: check gemini api key (#1205)
This commit is contained in:
		
							parent
							
								
									12cf3c0418
								
							
						
					
					
						commit
						c2b3cd7a32
					
				@ -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" },
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user