Open b0ldfrev opened 1 year ago
加了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"}'
我这个也是同样的错误,都配置了,服务器是国外的,没设置代理
外面提示这个500的错误
{"description":"Internal Server Error","status":500,"message":"The application encountered an unexpected error and could not continue."}
容器内是这个错误
宿主机器已经开启redis了,不知道在这个docker里面为啥连不上,不能是127.0.0.1吗?
redis.exceptions.ConnectionError: Error 111 connecting to 127.0.0.1:6379. Connection refused.
开放外网访问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"]
重新拉一下镜像
重新拉一下镜像
谢谢大佬,问题都解决了,也跑起来了,但是还有一个问题,为啥会返回很多无关的数据啊,这个能去除吗?
镜像怎么拉取?
搭建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容器里面调试,得到报错信息:
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