Skip to content

Commit

Permalink
refactor: Change the default host to 0.0.0.0 to prevent the front end…
Browse files Browse the repository at this point in the history
… from being inaccessible when mapping remote services.
  • Loading branch information
xixihahaliu committed Apr 10, 2024
1 parent 0aa1e3d commit 2de1de5
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ bash scripts/run_for_3B_in_M1_mac.sh
```

## USE WITH WEB UI
Open http://127.0.0.1:8777/qanything/ in the browser to use the UI interface,
Open http://0.0.0.0:8777/qanything/ in the browser to use the UI interface,

or open http://{your host ip}:8777/qanything/ in the browser to use the UI interface

Expand Down
2 changes: 1 addition & 1 deletion README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ bash scripts/run_for_3B_in_M1_mac.sh
```

## 访问前端页面
在浏览器中打开http://127.0.0.1:8777/qanything/
在浏览器中打开http://0.0.0.0:8777/qanything/

或者打开http://{主机ip地址}:8777/qanything/

Expand Down
4 changes: 2 additions & 2 deletions qanything_kernel/configs/model_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@
ZH_TITLE_ENHANCE = False

# MILVUS向量数据库地址
MILVUS_HOST_LOCAL = '127.0.0.1'
MILVUS_HOST_ONLINE = '127.0.0.1'
MILVUS_HOST_LOCAL = '0.0.0.0'
MILVUS_HOST_ONLINE = '0.0.0.0'
MILVUS_PORT = 19530
MILVUS_USER = ''
MILVUS_PASSWORD = ''
Expand Down
4 changes: 2 additions & 2 deletions qanything_kernel/qanything_server/sanic_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
from modelscope.hub.file_download import model_file_download
import subprocess

parser.add_argument('--host', dest='host', default='127.0.0.1', help='set host for qanything server')
parser.add_argument('--host', dest='host', default='0.0.0.0', help='set host for qanything server')
parser.add_argument('--port', dest='port', default=8777, type=int, help='set port for qanything server')
parser.add_argument('--workers', dest='workers', default=4, type=int, help='sanic server workers number')
# 是否使用GPU
Expand Down Expand Up @@ -180,7 +180,7 @@ async def init_local_doc_qa(app, loop):

@app.after_server_start
async def print_info(app, loop):
print("已启动后端服务,请复制[http://127.0.0.1:8777/qanything/]到浏览器进行测试。", flush=True)
print("已启动后端服务,请复制[http://0.0.0.0:8777/qanything/]到浏览器进行测试。", flush=True)

app.add_route(document, "/api/docs", methods=['GET'])
app.add_route(new_knowledge_base, "/api/local_doc_qa/new_knowledge_base", methods=['POST']) # tags=["新建知识库"]
Expand Down
6 changes: 3 additions & 3 deletions scripts/base_run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,13 @@ else
use_openai_api_option=""
fi

echo -e "即将启动后端服务,启动成功后请复制[\033[32mhttp://127.0.0.1:$qanything_port/qanything/\033[0m]到浏览器进行测试。"
echo -e "即将启动后端服务,启动成功后请复制[\033[32mhttp://0.0.0.0:$qanything_port/qanything/\033[0m]到浏览器进行测试。"
echo "运行qanything-server的命令是:"
echo "python3 -m qanything_kernel.qanything_server.sanic_api --host 127.0.0.1 --port $qanything_port --model_size $model_size $use_cpu_option $use_openai_api_option ${openai_api_base:+--openai_api_base "$openai_api_base"} ${openai_api_key:+--openai_api_key "$openai_api_key"} ${openai_api_model_name:+--openai_api_model_name "$openai_api_model_name"} ${openai_api_context_length:+--openai_api_context_length "$openai_api_context_length"} ${workers:+--workers "$workers"}"
echo "python3 -m qanything_kernel.qanything_server.sanic_api --host 0.0.0.0 --port $qanything_port --model_size $model_size $use_cpu_option $use_openai_api_option ${openai_api_base:+--openai_api_base "$openai_api_base"} ${openai_api_key:+--openai_api_key "$openai_api_key"} ${openai_api_model_name:+--openai_api_model_name "$openai_api_model_name"} ${openai_api_context_length:+--openai_api_context_length "$openai_api_context_length"} ${workers:+--workers "$workers"}"

sleep 5
# 启动qanything-server服务
python3 -m qanything_kernel.qanything_server.sanic_api --host 127.0.0.1 --port $qanything_port --model_size $model_size \
python3 -m qanything_kernel.qanything_server.sanic_api --host 0.0.0.0 --port $qanything_port --model_size $model_size \
$use_cpu_option $use_openai_api_option \
${openai_api_base:+--openai_api_base "$openai_api_base"} \
${openai_api_key:+--openai_api_key "$openai_api_key"} \
Expand Down

0 comments on commit 2de1de5

Please sign in to comment.