yihong0618 / xiaogpt

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

ChatGPTBot not running. #388

Closed pjq closed 2 months ago

pjq commented 7 months ago

It seems hang by the code async with httpx.AsyncClient(trust_env=True, proxies=self.proxy) as sess:

   async def ask_stream(self, query, **options):
        ms = self.get_messages()
        ms.append({"role": "user", "content": f"{query}"})
        kwargs = {**self.default_options, **options}
        print(kwargs)
        async with httpx.AsyncClient(trust_env=True, proxies=self.proxy) as sess:
            print("start _make_openai_client ")
            client = self._make_openai_client(sess)
            try:
                completion = await client.chat.completions.create(
                    messages=ms, stream=True, **kwargs
                )
            except Exception as e:
                print(str(e))
                return
image
yihong0618 commented 7 months ago

Will take a look this night Can you restart and run again? @frostming

yihong0618 commented 7 months ago

@pjq no problem in my side can you try pip install -U httpx

frostming commented 7 months ago

Did you use any proxy? You can run the line you suspect in a clean script or REPL to see if it fails.

yihong0618 commented 7 months ago

@pjq maybe you use config.json please delete proxy or just use command line