cocacola-lab / ChatIE

The online version is temporarily unavailable because we cannot afford the key. You can clone and run it locally. Note: we set defaul openai key. If keys exceed plan and are invalid, please tell us. The response speed depends on openai. ( sometimes, the official is too crowded and slow)
http://124.221.16.143:5000/
Other
787 stars 65 forks source link

项目运行的问题,前端界面报错:SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON #23

Open duxueyuan7802632 opened 6 months ago

duxueyuan7802632 commented 6 months ago

按照项目说明的步骤:

  1. Run npm run start 。 浏览器自动弹出界面。
  2. cd back-end and Run python run.py. 。弹出提示:Running on http://127.0.0.1:3000/ (Press CTRL+C to quit),进入链接http://127.0.0.1:3000,界面内容为:Not Found。The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.
  3. 我的key,openai.proxy都设置完成了。 4.我在前端尝试输入一段话,就报错:http://localhost:5000/ says SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON。后端也报错:TypeError: The view function did not return a valid response. The function either returned None or ended without a return statement.
threeColorFr commented 6 months ago

前端网址端口应该是5000吧? 你是什么平台,linux?,看看包的版本之类的?

duxueyuan7802632 commented 6 months ago

感谢回复,我是windows11,后端启动的时候,有个警告,但我觉得不是这个原因吧

: UserWarning: The current Python is not a recommended version, 3.10+ is recommended import("warnings").warn(

threeColorFr commented 6 months ago

你现在前后端可以打通吗。能看看具体报错位置在哪行代码和原因吗。

duxueyuan7802632 commented 6 months ago

老师!前端执行没问题,http://localhost:5000/,但clear那个按钮失效。后端一直就not found http://127.0.0.1:3000/ (Press CTRL+C to quit)。当我在前端输入一端文字的时候,就报出我上面截图的错误,完后在后端就有如下错误提示: "{\"sentence\":\"你好\",\"type\":\"\",\"access\":\"\",\"task\":\"NER\",\"lang\":\"chinese\"}" <class 'str'> 后端传入数据: {'sentence': '你好', 'type': '', 'access': '', 'task': 'NER', 'lang': 'chinese'} 127.0.0.1 - - [30/Apr/2024 11:13:34] "POST /api/v1/updateStaff HTTP/1.1" 500 - Traceback (most recent call last): File "C:\ProgramData\Anaconda3\Lib\site-packages\flask\app.py", line 2464, in call return self.wsgi_app(environ, start_response) File "C:\ProgramData\Anaconda3\Lib\site-packages\flask\app.py", line 2450, in wsgi_app response = self.handle_exception(e) File "C:\ProgramData\Anaconda3\Lib\site-packages\flask\app.py", line 1867, in handle_exception reraise(exc_type, exc_value, tb) File "C:\ProgramData\Anaconda3\Lib\site-packages\flask_compat.py", line 39, in reraise raise value File "C:\ProgramData\Anaconda3\Lib\site-packages\flask\app.py", line 2447, in wsgi_app response = self.full_dispatch_request() File "C:\ProgramData\Anaconda3\Lib\site-packages\flask\app.py", line 1953, in full_dispatch_request return self.finalize_request(rv) File "C:\ProgramData\Anaconda3\Lib\site-packages\flask\app.py", line 1968, in finalize_request response = self.make_response(rv) File "C:\ProgramData\Anaconda3\Lib\site-packages\flask\app.py", line 2097, in make_response raise TypeError( TypeError: The view function did not return a valid response. The function either returned None or ended without a return statement.

在run.py代码中,我修改了静态模版和动态模版的路径,也没好使:app = Flask(name, template_folder='../front-end/public', static_folder='../front-end/src'),路径设置的有问题啊?

threeColorFr commented 6 months ago

你的意思是前后端可以打通跑出结果,但是clear没用是吗? 这个问题我复现不出来,我之前试的windows上运行也是没问题的。 你看看修改一下port proxy之类的呢。还有你的port有没有开。

截屏2024-04-30 11 31 29
duxueyuan7802632 commented 6 months ago

大佬,跑通了,呵呵!代码问题! 1.可能是我 npm install 之后,直接调试,导致不知名的错误,应该重启电脑,现开启前端,再开启后端。 2.易错的点是KEY,我是买的第三方的key, proxy代理,应该在您 openai.api_base 里面设置,而不是 openai.proxy里面设置。 3.关于clear 按钮,功能没问题,我理解错了,当我跑通了才知道他的作用,他是清理下面的显示,而不是清理输入框的信息。谢谢大佬回复,让我排除了问题!

duxueyuan7802632 commented 6 months ago

老师加个微信好不,我是银行做数据分析的,我觉得垂直领域做三元组抽取非常有前景~ 微信号 18940019791

Original Email

Sender:"threeColorFr"< @.*** >;

Sent Time:2024/4/30 11:41

To:"cocacola-lab/ChatIE"< @.*** >;

Cc recipient:"xueyuandu"< @. >;"Author"< @. >;

Subject:Re: [cocacola-lab/ChatIE] 项目运行的问题,前端界面报错:SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON (Issue #23)

你的意思是前后端可以打通跑出结果,但是clear没用是吗? 这个问题我复现不出来,我之前试的windows上运行也是没问题的。 你看看修改一下port proxy之类的呢。 2024-04-30.11.31.29.png (view on web)

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

ytWu1314 commented 5 months ago

大佬,跑通了,呵呵!代码问题! 1.可能是我 npm install 之后,直接调试,导致不知名的错误,应该重启电脑,现开启前端,再开启后端。 2.易错的点是KEY,我是买的第三方的key, proxy代理,应该在您 openai.api_base 里面设置,而不是 openai.proxy里面设置。 3.关于clear 按钮,功能没问题,我理解错了,当我跑通了才知道他的作用,他是清理下面的显示,而不是清理输入框的信息。谢谢大佬回复,让我排除了问题!

大佬,您的proxy怎么成功的?openai.api_base = "这里要填什么呀?" #或者利用反向代理openai.com(代理获取:https://github.com/justjavac/openai-proxy (注释掉上面那句代码)

反向代理那个教程我只在deno 弄了一个域名,openai api的key我申请了,但是布吉岛怎么用,是填到df_access = []里面吗?(为啥列表要分成两块?)

Snipaste_2024-05-03_11-10-08

Snipaste_2024-05-03_11-10-46

您整体的流程是咋样的?我到现在还是跑不起来作者的这个项目