update webui.py
This commit is contained in:
parent
5a7973ea42
commit
d82af9ba7a
8
api.py
8
api.py
|
|
@ -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(...)):
|
||||||
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):
|
||||||
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,7 +95,7 @@ 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,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue