瀏覽代碼

语音不回复处理

develop
H Vs 1 天之前
父節點
當前提交
1e7b609b7c
共有 1 個檔案被更改,包括 6 行新增0 行删除
  1. +6
    -0
      app/endpoints/pipeline_endpoint.py

+ 6
- 0
app/endpoints/pipeline_endpoint.py 查看文件

@@ -945,6 +945,12 @@ async def handle_voice_async(request: Request,token_id,app_id, wxid,msg_data,fro
messages=await request.app.state.gewe_service.save_session_messages_to_cache_async(hash_key, {"role": "user", "content": react_voice_text})
ai_res=await gpt_client_async(request,messages,wxid,callback_to_user)
ai_res_content=remove_markdown_symbol(ai_res["choices"][0]["message"]["content"])

if ai_res_content == '不回复':
logger.warning(f"语音消息,AI回答任务不回复,AI回答<不回复>,跳过微信语音回复")
await request.app.state.gewe_service.save_session_messages_to_cache_async(hash_key, {"role": "assistant", "content": ai_res_content})
return

has_url=contains_url(ai_res_content)
if not has_url:
voice_during,voice_url=wx_voice(ai_res_content)


Loading…
取消
儲存