Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

服务异常 #4

Open
b0ldfrev opened this issue Jun 8, 2023 · 7 comments
Open

服务异常 #4

b0ldfrev opened this issue Jun 8, 2023 · 7 comments

Comments

@b0ldfrev
Copy link

b0ldfrev commented Jun 8, 2023

搭建new-bing服务

1.使用Dockerfile自行build,服务起来后执行curl -X POST 'http://127.0.0.1:8000/bing/chat' -H 'content-type: application/json' --data '{"q":"你是谁?","t":1,"sid":"1"}' 报错 {"description":"Internal Server Error","status":500,"message":"The application encountered an unexpected error and could not continue."}
在docker容器里面调试,得到报错信息:

[2023-06-08 16:30:12 +0800] [40] [WARNING] Sanic is running in PRODUCTION mode. Consider using '--debug' or '--dev' while actively developing your application.
[2023-06-08 16:30:13 +0800] [49] [INFO] Starting worker [49]
[2023-06-08 16:30:15 +0800] [49] [ERROR] Exception occurred while handling uri: 'http://127.0.0.1:8000/bing/chat'
Traceback (most recent call last):
  File "handle_request", line 97, in handle_request
    from sanic_ext.extensions.base import Extension  # type: ignore
                       ^^^^^^^^^^^^^^
  File "/sanic/app.py", line 380, in chat
    raise Exception(NO_ACCESS)
Exception: 暂时无法为你提供服务!

2.使用start.sh拉镜像,服务起来后执行curl -X POST 'http://127.0.0.1:8000/bing/chat' -H 'content-type: application/json' --data '{"q":"你是谁?","t":1,"sid":"1"}' 报错 {"description":"Not Found","status":404,"message":"Requested URL /bing/chat not found"}

我的env文件内容如下:
COOKIE_FILES=["/sanic/cookies/cookie0.json"]
ALL_PROXY=socks5://172.17.0.1:1080
REDIS_HOST=172.17.0.1
REDIS_PORT=6379
REDIS_PASSWD=12345678

@bujnlc8
Copy link
Owner

bujnlc8 commented Jun 8, 2023

加了referer校验,curl -X POST 'http://127.0.0.1:8000/bing/chat' -H 'content-type: application/json' -H 'Referer: servicewechat.com/wxee7496be5b68b740' --data '{"q":"你是谁?","t":1,"sid":"1"}'

@Code365Yes
Copy link

Code365Yes commented Jun 27, 2023

我这个也是同样的错误,都配置了,服务器是国外的,没设置代理

外面提示这个500的错误
{"description":"Internal Server Error","status":500,"message":"The application encountered an unexpected error and could not continue."}

容器内是这个错误
iShot_2023-06-27_23.24.09.png

@Code365Yes
Copy link

宿主机器已经开启redis了,不知道在这个docker里面为啥连不上,不能是127.0.0.1吗?
redis.exceptions.ConnectionError: Error 111 connecting to 127.0.0.1:6379. Connection refused.

@Code365Yes
Copy link

Code365Yes commented Jun 27, 2023

开放外网访问redis了,但是有一个这个报错

[2023-06-27 16:53:09 +0000] [1] [INFO] Sanic v23.3.0
[2023-06-27 16:53:09 +0000] [1] [INFO] Goin' Fast @ http://0.0.0.0:8000
[2023-06-27 16:53:09 +0000] [1] [INFO] mode: production, single worker
[2023-06-27 16:53:09 +0000] [1] [INFO] server: sanic, HTTP/1.1
[2023-06-27 16:53:09 +0000] [1] [INFO] python: 3.11.2
[2023-06-27 16:53:09 +0000] [1] [INFO] platform: Linux-5.15.0-1030-oracle-x86_64-with
[2023-06-27 16:53:09 +0000] [1] [INFO] packages: sanic-routing==22.8.0
[2023-06-27 16:53:11 +0000] [15] [INFO] Starting worker [15]
2023-06-27 16:53:57,826 /sanic/app.py [line:347] INFO: [bing] Http request payload: {'q': '你是谁?', 't': 1, 'sid': '1'}
[2023-06-27 16:53:57 +0000] [15] [ERROR] Exception occurred while handling uri: 'http://127.0.0.1:8000/bing/chat'
Traceback (most recent call last):
  File "handle_request", line 97, in handle_request
    from sanic_ext.extensions.base import Extension  # type: ignore
                       ^^^^^^^^^^^^^^
  File "/sanic/app.py", line 427, in chat
    res = await do_chat(request)
          ^^^^^^^^^^^^^^^^^^^^^^
  File "/sanic/app.py", line 349, in do_chat
    return await get_bot(request.json.get('sid')).ask(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/sanic/app.py", line 118, in get_bot
    cookie_path = cookie_path or get_cookie_file(sid, COOKIE_FILES)
                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/sanic/app.py", line 104, in get_cookie_file
    return cookie_files[(
                        ^
ZeroDivisionError: integer modulo by zero

配置文件指向json啊,应该是对的
COOKIE_FILES=["/sanic/cookies/cookie0.json"]

@bujnlc8
Copy link
Owner

bujnlc8 commented Jun 28, 2023

重新拉一下镜像

@Code365Yes
Copy link

Code365Yes commented Jun 29, 2023

重新拉一下镜像

谢谢大佬,问题都解决了,也跑起来了,但是还有一个问题,为啥会返回很多无关的数据啊,这个能去除吗?

image.png

@lw1290537863
Copy link

镜像怎么拉取?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants