File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change 99from db .db_service import DBService
1010from workflow import Workflow
1111from nlu .llm_azure import model
12+ from nlu .llm_client import llm
1213from sqlcoder .llm_sqlcoder import SqlCoderLLM
1314from service import DataLinguaService
1415
@@ -35,15 +36,15 @@ class QARequest(BaseModel):
3536
3637from fastapi import Cookie
3738
38- @app .post ("/qa" )
39- def qa_endpoint (req : QARequest , sid : Optional [str ] = Cookie (None )):
39+ @app .post ("/qa/{model_name} " )
40+ def qa_endpoint (req : QARequest , sid : Optional [str ] = Cookie (None ), model_name : str = "client" ):
4041 # sid从cookie读取,conversation_id由前端传入
4142 conversation_id = req .conversation_id
4243 # 记录sid->conversation_id映射
4344 if sid :
4445 sid_conversation_map .setdefault (sid , []).append (conversation_id )
4546 # 每次新建 workflow
46- nlu_agent = NLUAgent (model )
47+ nlu_agent = NLUAgent (model if model_name == 'remote' else llm )
4748 sqlcoder_llm = SqlCoderLLM ()
4849 sqlcoder_agent = SQLCoderAgent (sqlcoder_llm )
4950 db_service = DBService (db_path = "Chinook.db" )
Original file line number Diff line number Diff line change 22
33def run_api ():
44 import uvicorn
5- uvicorn .run ("api:app" , host = "0 .0.0.0 " , port = 8000 , reload = True )
5+ uvicorn .run ("api:app" , host = "127 .0.0.1 " , port = 8000 , reload = True )
66
77if __name__ == "__main__" :
88 run_api ()
You can’t perform that action at this time.
0 commit comments