返回提交历史
Modified
g4f/tools/run_tools.py
+4
-5
XFEstudio/gpt4free
Fix pass api_key
e48ca345
代码差异
1 个文件
+4
-5
@@ -236,10 +236,9 @@ async def async_iter_run_tools(
236
236
messages, sources = await perform_web_search(messages, web_search)
237
237
238
238
# Get API key
239
if not kwargs.get("api_key"):
240
api_key = AuthManager.load_api_key(provider)
241
if api_key:
242
kwargs["api_key"] = api_key
239
api_key = AuthManager.load_api_key(provider)
240
if api_key:
241
kwargs["api_key"] = api_key
243
242
244
243
# Process tool calls
245
244
if tool_calls:
@@ -278,7 +277,7 @@ def iter_run_tools(
278
277
debug.error(f"Couldn't do web search: {e.__class__.__name__}: {e}")
279
278
280
279
# Get API key if needed
281
if provider is not None and not kwargs.get("api_key"):
280
if provider is not None:
282
281
api_key = AuthManager.load_api_key(provider)
283
282
if api_key:
284
283
kwargs["api_key"] = api_key