fix:修改utf-8解码可能报错

This commit is contained in:
雷雨
2025-08-19 11:34:46 +08:00
parent caa59d2c82
commit 901afdec32

View File

@@ -80,9 +80,9 @@ def do_chat_with_bot(user_query,session_id):
if str(resp.status_code) == '200':
for chunk in resp.iter_content(chunk_size=2048):
if chunk:
text = chunk.decode('utf-8')
logger.debug(f'session {body.get('sessionId')} :\nchat with {body.get('agentCode')}: \ncontent is :{text}')
yield text
#text = chunk.decode('utf-8')
#logger.debug(f'session {body.get('sessionId')} :\nchat with {body.get('agentCode')}: \ncontent is :{text}')
yield chunk
else:
logger.error(f"request chat with bot error,code is : {resp.status_code},\n error body is :{resp.content}")
yield resp.content