Skip to content

[Bug] 獲取模型列表失敗: Invalid http_client argument (Missing parentheses on httpx.AsyncClient) #7770

@stanley-1028

Description

@stanley-1028

What happened / 发生了什么

在 AstrBot v4.23.5 中,點擊「獲取模型列表」時出現紅色錯誤提示,導致無法正常獲取模型。

Reproduce / 如何复现?

看起來是一個初始化的 Typo。在傳遞 http_client 參數時,似乎傳入了類別本身而不是實例化物件。
可能需要將原始碼中的:
http_client=httpx.AsyncClient
修改為帶有括號的:
http_client=httpx.AsyncClient()

AstrBot version, deployment method (e.g., Windows Docker Desktop deployment), provider used, and messaging platform used. / AstrBot 版本、部署方式(如 Windows Docker Desktop 部署)、使用的提供商、使用的消息平台适配器

環境 / Environment:

AstrBot 版本:v4.23.5
部署方式:Windows Docker Desktop 部署
使用的提供商:deepseek
使用的消息平台适配器:discord

OS

Windows

Logs / 报错日志

[2026-04-24 19:18:33.522] [Core] [INFO] [routes.config:307]: Saving config, is_core=True
[2026-04-24 19:18:37.668] [Core] [ERRO] [v4.23.5] [routes.config:1006]: Traceback (most recent call last):
File "\?\C:\Users\user\AppData\Local\AstrBot\backend\app\astrbot\dashboard\routes\config.py", line 974, in get_provider_source_models
inst = cls_type(provider_source, {})
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "\?\C:\Users\user\AppData\Local\AstrBot\backend\app\astrbot\core\provider\sources\openai_source.py", line 474, in init
self.client = AsyncOpenAI(
^^^^^^^^^^^^
File "C:\Users\user\AppData\Local\AstrBot\backend\python\Lib\site-packages\openai_client.py", line 617, in init
super().init(
File "C:\Users\user\AppData\Local\AstrBot\backend\python\Lib\site-packages\openai_base_client.py", line 1487, in init
raise TypeError(
TypeError: Invalid http_client argument; Expected an instance of httpx.AsyncClient but got <class 'httpx.AsyncClient'>

Are you willing to submit a PR? / 你愿意提交 PR 吗?

  • Yes!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:providerThe bug / feature is about AI Provider, Models, LLM Agent, LLM Agent Runner.bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions