新增部署说明
This commit is contained in:
parent
ceaaf975e1
commit
6927603bca
@ -2,7 +2,7 @@ FROM sanicframework/sanic:3.11-latest
|
||||
|
||||
WORKDIR /sanic
|
||||
|
||||
COPY app.py EdgeGPT.py cookie.json cookie1.json cookie2.json requirements.txt /sanic/
|
||||
COPY app.py EdgeGPT.py requirements.txt /sanic/
|
||||
|
||||
RUN pip install -r requirements.txt
|
||||
|
||||
|
||||
@ -1,3 +1,14 @@
|
||||
[登录 bing 账号](https://login.live.com/), 使用[Cookie-Editor 扩展](https://chrome.google.com/webstore/detail/cookie-editor/hlkenndednhfkekhgcdicdfddnkalmdm)将 cookie 以 json 格式导出,保存为`cookie.json`文件,同时将`COOKIE_FILE`环境变量的值指向该文件。
|
||||
|
||||
## 部署
|
||||
|
||||
```
|
||||
1.新建cookies目录,将cookie.json放入该目录,支持3个cookie,可分别命名为cookie.json,cookie1.json,cookie2.json
|
||||
2.cp env.example env # 根据实际情况修改
|
||||
3.bash start.sh 0.0.1
|
||||
4.curl -X POST 'http://127.0.0.1:8000/chat' -H 'content-type: application/json' --data '{"q":"你是谁?","t":1,"sid":"1"}' 验证是否成功
|
||||
```
|
||||
|
||||
**⚠️ 目前中国大陆的IP会返回404,自备代理** 见[https://github.com/acheong08/EdgeGPT/issues/178](https://github.com/acheong08/EdgeGPT/issues/178)
|
||||
|
||||
`EdgeGPT.py`文件 fork 至[https://github.com/acheong08/EdgeGPT](https://github.com/acheong08/EdgeGPT),并做了些许修改,在此表示感谢!
|
||||
|
||||
@ -26,8 +26,10 @@ def reset_cookie():
|
||||
return
|
||||
cookie = os.environ.get('COOKIE_FILE')
|
||||
if cookie == COOKIE:
|
||||
if BAK_COOKIE:
|
||||
os.environ['COOKIE_FILE'] = BAK_COOKIE
|
||||
elif cookie == BAK_COOKIE:
|
||||
if BAK_COOKIE1:
|
||||
os.environ['COOKIE_FILE'] = BAK_COOKIE1
|
||||
elif cookie == BAK_COOKIE1:
|
||||
os.environ['COOKIE_FILE'] = COOKIE
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
WXAPPID=
|
||||
WXAPPSECRET=
|
||||
COOKIE_FILE=/sanic/cookie.json
|
||||
COOKIE_FILE1=/sanic/cookie1.json
|
||||
COOKIE_FILE2=/sanic/cookie2.json
|
||||
WXAPPID=用不到小程序可以不填
|
||||
WXAPPSECRET=用不到小程序可以不填
|
||||
COOKIE_FILE=/sanic/cookies/cookie.json
|
||||
COOKIE_FILE1=/sanic/cookies/cookie1.json # 备用cookie1, 没有可以删掉
|
||||
COOKIE_FILE2=/sanic/cookies/cookie2.json # 备用cookie2, 没有可以删掉
|
||||
https_proxy=http://127.0.0.1:1080 # 目前中国大陆的IP会返回404,所以最好能加个代理
|
||||
|
||||
@ -1,3 +1,6 @@
|
||||
docker pull yy194131/new-bing:$1
|
||||
count=$(docker ps -a | grep new-bing | wc -l)
|
||||
if [ $count -gt 0 ]; then
|
||||
docker stop new-bing && docker rm new-bing
|
||||
docker run --restart always --name new-bing --env-file $(pwd)/env -p 8000:8000 -d yy194131/new-bing:$1
|
||||
fi
|
||||
docker run --restart always --name new-bing -v $(pwd)/cookies:/sanic/cookies --env-file $(pwd)/env -p 8000:8000 -d yy194131/new-bing:$1
|
||||
|
||||
Loading…
Reference in New Issue
Block a user