yihong0618 / xiaogpt

Play ChatGPT and other LLM with Xiaomi AI Speaker
MIT License
5.9k stars 820 forks source link

使用Azure OpenAI API不需要科学上网,但是,我不填proxy,就会报错,填了就没问题。 #396

Closed maopucheng closed 7 months ago

maopucheng commented 7 months ago

所以,配置文件中的proxy是必须填的吗?不填的时候报错如下:

Detailed traceback information: Traceback (most recent call last): File "D:\src\xiaogpt\xiaogpt\xiaogpt.py", line 403, in run_forever await self.tts.synthesize(query, self.ask_gpt(query)) File "D:\src\xiaogpt\xiaogpt\tts\mi.py", line 31, in synthesize async for text in text_stream: File "D:\src\xiaogpt\xiaogpt\xiaogpt.py", line 283, in ask_gpt answer = await self.chatbot.ask(query, **self.config.gpt_options) File "D:\src\xiaogpt\xiaogpt\bot\chatgptapi_bot.py", line 51, in ask async with httpx.AsyncClient(trust_env=True, proxies=self.proxy) as sess: File "C:\Users\maopu\anaconda3\envs\py310\lib\site-packages\httpx_client.py", line 1395, in init proxy_map = self._get_proxy_map(proxies, allow_env_proxies) File "C:\Users\maopu\anaconda3\envs\py310\lib\site-packages\httpx_client.py", line 228, in _get_proxy_map proxy = Proxy(url=proxies) if isinstance(proxies, (str, URL)) else proxies File "C:\Users\maopu\anaconda3\envs\py310\lib\site-packages\httpx_config.py", line 334, in init raise ValueError(f"Unknown scheme for proxy URL {url!r}") ValueError: Unknown scheme for proxy URL URL('')

谢谢!

DeadAt17 commented 7 months ago

我也遇到同样的问题

DeadAt17 commented 7 months ago

我也遇到同样的问题

我把 /xiaogpt/bot/chatgptapi_bot.py line 51, 68 的proxy删了就可以用了。 async with httpx.AsyncClient(trust_env=True) as sess:

yihong0618 commented 7 months ago

我们来修复下,谢谢

yihong0618 commented 7 months ago

尝试修复了,请拉下最新代码