|
@@ -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}) |
|
|
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=await gpt_client_async(request,messages,wxid,callback_to_user) |
|
|
ai_res_content=remove_markdown_symbol(ai_res["choices"][0]["message"]["content"]) |
|
|
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) |
|
|
has_url=contains_url(ai_res_content) |
|
|
if not has_url: |
|
|
if not has_url: |
|
|
voice_during,voice_url=wx_voice(ai_res_content) |
|
|
voice_during,voice_url=wx_voice(ai_res_content) |
|
|