cubenlp / ChatSQL

自然语言转SQL,直接连接数据库查询
Apache License 2.0
365 stars 48 forks source link

main_gui.py 报错 local variable 'In_context_prompt' referenced before assignment #22

Open xsw1006931693 opened 7 months ago

xsw1006931693 commented 7 months ago

python F:\chat\ChatSQL-main\main_gui.py Loading checkpoint shards: 14%|████████▏ | 1/7 [00:02<00:12, 2Loading checkpoint shards: 29%|████████████████▎ | 2/7 [00:03<0Loading checkpoint shards: 43%|████████████████████████▍ | 3/7 Loading checkpoint shards: 57%|████████████████████████████████▌ Loading checkpoint shards: 71%|████████████████████████████████████████▋ Loading checkpoint shards: 86%|████████████████████████████████████████████Loading checkpoint shards: 100%|████████████████████████████████████████████Loading checkpoint shards: 100%|█████████████████████████████████████████████████████████| 7/7 [00:13<00:00, 1.89s/it] F:\chat\ChatSQL-main\main_gui.py:107: GradioDeprecationWarning: The style method is deprecated. Please set these arguments in the constructor instead. user_input = gr.Textbox(show_label=False, placeholder="Input...", lines=10).style( Running on local URL: http://127.0.0.1:7860

To create a public link, set share=True in launch(). Traceback (most recent call last): File "D:\work\miniconda3\envs\chatsql\lib\site-packages\gradio\routes.py", line 442, in run_predict output = await app.get_blocks().process_api( File "D:\work\miniconda3\envs\chatsql\lib\site-packages\gradio\blocks.py", line 1392, in process_api result = await self.call_function( File "D:\work\miniconda3\envs\chatsql\lib\site-packages\gradio\blocks.py", line 1097, in call_function prediction = await anyio.to_thread.run_sync( File "D:\work\miniconda3\envs\chatsql\lib\site-packages\anyio\to_thread.py", line 56, in run_sync return await get_async_backend().run_sync_in_worker_thread( File "D:\work\miniconda3\envs\chatsql\lib\site-packages\anyio_backends_asyncio.py", line 2134, in run_sync_in_worker_thread return await future File "D:\work\miniconda3\envs\chatsql\lib\site-packages\anyio_backends_asyncio.py", line 851, in run result = context.run(func, args) File "D:\work\miniconda3\envs\chatsql\lib\site-packages\gradio\utils.py", line 703, in wrapper response = f(args, **kwargs) File "F:\chat\ChatSQL-main\main_gui.py", line 76, in predict input_prompt = retrieval_related_table(input_prompt, input, history, top_k=3) File "F:\chat\ChatSQL-main\utils.py", line 28, in retrieval_related_table input_prompt += In_context_prompt UnboundLocalError: local variable 'In_context_prompt' referenced before assignment

uebhh commented 6 months ago

先输入Hi,问答一下后面不报错。或者在utils.pyde 25行追加语句: global In_context_prompt