#update: Mixed模型
This commit is contained in:
1 parent
55e2d7209c
commit
3f78fcb12c
3 files changed
+117
-115
No files matched your search
@@ -209,10 +209,11 @@ async def streaming_chat(ws: WebSocket):
|
||||
llm_text = ""
|
||||
logger.debug("开始进行ASR识别")
|
||||
while len(asr_results)==0:
|
||||
chunk = json.loads(await asyncio.wait_for(ws.receive_text(),timeout=2))
|
||||
chunk = json.loads(await asyncio.wait_for(ws.receive_text(),timeout=1))
|
||||
if assistant is None:
|
||||
with get_db_context() as db: #使用with语句获取数据库连接,自动关闭数据库连接
|
||||
assistant = db.query(Assistant).filter(Assistant.id == chunk['meta_info']['session_id']).first()
|
||||
logger.debug(f"接收到{assistant.name}的请求")
|
||||
if assistant is None:
|
||||
raise SessionNotFoundError()
|
||||
user_info = json.loads(assistant.user_info)
|
||||
@@ -230,7 +231,7 @@ async def streaming_chat(ws: WebSocket):
|
||||
start_time = time.time()
|
||||
is_first_response = True
|
||||
|
||||
async for llm_frame in llm_frames:
|
||||
for llm_frame in llm_frames:
|
||||
if is_first_response:
|
||||
end_time = time.time()
|
||||
logger.debug(f"第一帧返回耗时:{round(end_time-start_time,3)}s")
|
||||
|
||||
Reference in new issue
Block a user