提交 d82af9ba 作者: imClumsyPanda

update webui.py

上级 5a7973ea
...@@ -42,7 +42,7 @@ async def get_local_doc_qa(): ...@@ -42,7 +42,7 @@ async def get_local_doc_qa():
@app.post("/file") @app.post("/file")
async def upload_file(UserFile: UploadFile=File(...)): async def upload_file(UserFile: UploadFile=File(...),):
global vs_path global vs_path
response = { response = {
"msg": None, "msg": None,
...@@ -67,7 +67,7 @@ async def upload_file(UserFile: UploadFile=File(...)): ...@@ -67,7 +67,7 @@ async def upload_file(UserFile: UploadFile=File(...)):
return response return response
@app.post("/qa") @app.post("/qa")
async def get_answer(UserQuery: Query): async def get_answer(query: str = ""):
response = { response = {
"status": 0, "status": 0,
"message": "", "message": "",
...@@ -76,7 +76,7 @@ async def get_answer(UserQuery: Query): ...@@ -76,7 +76,7 @@ async def get_answer(UserQuery: Query):
global vs_path global vs_path
history = [] history = []
try: try:
resp, history = local_doc_qa.get_knowledge_based_answer(query=UserQuery.query, resp, history = local_doc_qa.get_knowledge_based_answer(query=query,
vs_path=vs_path, vs_path=vs_path,
chat_history=history) chat_history=history)
if REPLY_WITH_SOURCE: if REPLY_WITH_SOURCE:
...@@ -95,9 +95,9 @@ async def get_answer(UserQuery: Query): ...@@ -95,9 +95,9 @@ async def get_answer(UserQuery: Query):
if __name__ == "__main__": if __name__ == "__main__":
uvicorn.run( uvicorn.run(
app='api:app', app=app,
host='0.0.0.0', host='0.0.0.0',
port=8100, port=8100,
reload = True, reload=True,
) )
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论