update:加了一点注释
This commit is contained in:
1 parent
dba43836b6
commit
d885684533
3 files changed
+14
-10
No files matched your search
@@ -172,7 +172,7 @@ async def streaming_chat(ws: WebSocket,db=Depends(get_db)):
|
||||
await ws.accept()
|
||||
logger.debug("WebSocket连接成功")
|
||||
try:
|
||||
agent = Agent(asr_type=Config.ASR, llm_type=Config.LLM, tts_type=Config.TTS)
|
||||
agent = None
|
||||
assistant = None
|
||||
asr_results = []
|
||||
llm_text = ""
|
||||
@@ -182,6 +182,8 @@ async def streaming_chat(ws: WebSocket,db=Depends(get_db)):
|
||||
if assistant is None:
|
||||
assistant = db.query(Assistant).filter(Assistant.id == chunk['meta_info']['session_id']).first()
|
||||
agent.init_recorder(assistant.user_id)
|
||||
if not agent:
|
||||
agent = Agent(asr_type=Config.ASR, llm_type=Config.LLM, tts_type=Config.TTS)
|
||||
chunk["audio"] = agent.user_audio_process(chunk["audio"], db)
|
||||
asr_results = await agent.stream_recognize(chunk, db)
|
||||
kid_text = asr_results[0]['text'] #asr结果的[0]默认为孩子(主要用户)的asr结果
|
||||
|
||||
Reference in new issue
Block a user