mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-11-03 13:55:00 +08:00
fix(agent): avoid duplicate Google aiohttp timeout
This commit is contained in:
@@ -397,9 +397,15 @@ class _ProviderDiscovery:
|
||||
connect_timeout=10,
|
||||
trust_env=False,
|
||||
)
|
||||
# google-genai 的 aiohttp 请求已经显式传入 timeout,不能再从
|
||||
# async_client_args 透传同名参数,否则会触发重复关键字异常。
|
||||
async_client_args = {
|
||||
key: value for key, value in client_args.items() if key != "timeout"
|
||||
}
|
||||
http_options = HttpOptions(
|
||||
timeout=15_000,
|
||||
client_args=client_args,
|
||||
async_client_args=client_args,
|
||||
async_client_args=async_client_args,
|
||||
)
|
||||
|
||||
client = genai.Client(api_key=api_key, http_options=http_options)
|
||||
|
||||
@@ -136,8 +136,10 @@ def test_google_model_client_uses_adapter_args_and_closes_both_clients(
|
||||
client = captured["client"]
|
||||
http_options = captured["http_options"]
|
||||
assert result[0]["id"] == "gemini-test"
|
||||
assert http_options.timeout == 15_000
|
||||
assert http_options.client_args["trust_env"] is False
|
||||
assert http_options.async_client_args["trust_env"] is False
|
||||
assert "timeout" not in http_options.async_client_args
|
||||
assert any(
|
||||
key in http_options.async_client_args for key in ("proxy", "proxies")
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user