zhaozh10 / ChatCAD

[COMMSENG'24, TMI'24] Interactive Computer-Aided Diagnosis using LLMs
Apache License 2.0
132 stars 17 forks source link

你好,我在运行web.py的时候,链接打开的同时报错,这该怎么解决?(并且我已确认代理正常,gradio版本是3.31.0,api key正常) #6

Closed abandonnnnn closed 6 months ago

abandonnnnn commented 1 year ago

(cad) zzz@zzz:~/yz/AllVscodes/ChatCAD-main$ python3 web.py /home/zzz/anaconda3/envs/cad/lib/python3.9/site-packages/revChatGPT/init.py:29: UserWarning: The current Python is not a recommended version, 3.10+ is recommended import("warnings").warn( Running on local URL: http://127.0.0.1:4900

To create a public link, set share=True in launch(). ERROR: Exception in ASGI application Traceback (most recent call last): File "/home/zzz/anaconda3/envs/cad/lib/python3.9/site-packages/uvicorn/protocols/http/h11_impl.py", line 408, in run_asgi result = await app( # type: ignore[func-returns-value] File "/home/zzz/anaconda3/envs/cad/lib/python3.9/site-packages/uvicorn/middleware/proxy_headers.py", line 84, in call return await self.app(scope, receive, send) File "/home/zzz/anaconda3/envs/cad/lib/python3.9/site-packages/fastapi/applications.py", line 1106, in call await super().call(scope, receive, send) File "/home/zzz/anaconda3/envs/cad/lib/python3.9/site-packages/starlette/applications.py", line 122, in call await self.middleware_stack(scope, receive, send) File "/home/zzz/anaconda3/envs/cad/lib/python3.9/site-packages/starlette/middleware/errors.py", line 184, in call raise exc File "/home/zzz/anaconda3/envs/cad/lib/python3.9/site-packages/starlette/middleware/errors.py", line 162, in call await self.app(scope, receive, _send) File "/home/zzz/anaconda3/envs/cad/lib/python3.9/site-packages/starlette/middleware/cors.py", line 83, in call await self.app(scope, receive, send) File "/home/zzz/anaconda3/envs/cad/lib/python3.9/site-packages/starlette/middleware/exceptions.py", line 79, in call raise exc File "/home/zzz/anaconda3/envs/cad/lib/python3.9/site-packages/starlette/middleware/exceptions.py", line 68, in call await self.app(scope, receive, sender) File "/home/zzz/anaconda3/envs/cad/lib/python3.9/site-packages/fastapi/middleware/asyncexitstack.py", line 20, in call raise e File "/home/zzz/anaconda3/envs/cad/lib/python3.9/site-packages/fastapi/middleware/asyncexitstack.py", line 17, in call await self.app(scope, receive, send) File "/home/zzz/anaconda3/envs/cad/lib/python3.9/site-packages/starlette/routing.py", line 718, in call await route.handle(scope, receive, send) File "/home/zzz/anaconda3/envs/cad/lib/python3.9/site-packages/starlette/routing.py", line 276, in handle await self.app(scope, receive, send) File "/home/zzz/anaconda3/envs/cad/lib/python3.9/site-packages/starlette/routing.py", line 66, in app response = await func(request) File "/home/zzz/anaconda3/envs/cad/lib/python3.9/site-packages/fastapi/routing.py", line 274, in app raw_response = await run_endpoint_function( File "/home/zzz/anaconda3/envs/cad/lib/python3.9/site-packages/fastapi/routing.py", line 193, in run_endpoint_function return await run_in_threadpool(dependant.call, *values) File "/home/zzz/anaconda3/envs/cad/lib/python3.9/site-packages/starlette/concurrency.py", line 41, in run_in_threadpool return await anyio.to_thread.run_sync(func, args) File "/home/zzz/anaconda3/envs/cad/lib/python3.9/site-packages/anyio/to_thread.py", line 33, in run_sync return await get_asynclib().run_sync_in_worker_thread( File "/home/zzz/anaconda3/envs/cad/lib/python3.9/site-packages/anyio/_backends/_asyncio.py", line 877, in run_sync_in_worker_thread return await future File "/home/zzz/anaconda3/envs/cad/lib/python3.9/site-packages/anyio/_backends/_asyncio.py", line 807, in run result = context.run(func, *args) File "/home/zzz/anaconda3/envs/cad/lib/python3.9/site-packages/gradio/routes.py", line 263, in api_info return gradio.blocks.get_api_info(config, serialize) # type: ignore File "/home/zzz/anaconda3/envs/cad/lib/python3.9/site-packages/gradio/blocks.py", line 504, in get_api_info serializer = serializing.COMPONENT_MAPPING[type]() KeyError: 'dataset'

JuneCly commented 11 months ago

您好,我也遇到了同样的问题,请问您现在解决了吗?

abandonnnnn commented 11 months ago

我用的是linux系统,输入这个解决了。如果你使用的也是linux, 1.在设置里更改我的网络代理,如下图 批注 2023-12-05 125727

2.在终端里输入这行命令(注意引号要输入英文的): export https_proxy=“http://127.0.0.1:7890

然后就可以了,但是有时候回答的字数太长会失败....... 说一个我的题外话:很头疼,我自己用简短代码测试简单问题的时候是可以调用的,key也是正常的,但是一放进chatcad的网页就说我的key'不正确,,,,,,,如果你也遇到这个问题的话,欢迎你与我沟通!!!

2279915269 commented 1 month ago

你好,我也遇到了api key错误的问题,请问应该如何解决呢?

zhaozh10 commented 1 month ago

你好,我也遇到了api key错误的问题,请问应该如何解决呢?

如还是无法解决,请考虑将ChatGPT替换为LLaMA2-13B

2279915269 commented 3 weeks ago

您能详细讲解一下需要更改哪个文件吗,谢谢您

zhaozh10 commented 2 weeks ago

您能详细讲解一下需要更改哪个文件吗,谢谢您

chat_bot.py中self.agent是一个chatgpt对象,其需要具有“重置状态”的self.agent.reset()和“回答问题并记忆问答历史的”self.agent.ask()的方法,可以将 self.agent = Chatbot(engine=self.engine,api_key=self.api_key,system_prompt=system_prompt,proxy="127.0.0.1:7890") 内容改为初始化一个LLaMA或Mistral(见huggingface),并进行适当修改为其添加reset()和ask()的功能