mirror of
https://github.com/FuQuan233/nonebot-plugin-llmchat.git
synced 2026-09-29 01:19:28 +00:00
✨ 增加自定义User-Agent支持,允许在请求API时设置User-Agent
This commit is contained in:
parent
3320758cf9
commit
0f33591f4d
3 changed files with 4 additions and 0 deletions
|
|
@ -67,6 +67,8 @@ class ConversationService:
|
|||
"api_key": preset.api_key,
|
||||
"timeout": self.config.request_timeout,
|
||||
}
|
||||
if preset.user_agent:
|
||||
options["default_headers"] = {"User-Agent": preset.user_agent}
|
||||
if preset.proxy:
|
||||
options["http_client"] = httpx.AsyncClient(proxy=preset.proxy)
|
||||
return AsyncOpenAI(**options)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue