|
@@ -339,6 +339,7 @@ async def handle_client(websocket: WebSocket,
|
|
|
else: # 正常输出
|
|
else: # 正常输出
|
|
|
answer = data.get("answer", "")
|
|
answer = data.get("answer", "")
|
|
|
if isinstance(answer, str):
|
|
if isinstance(answer, str):
|
|
|
|
|
+
|
|
|
answer_str += answer
|
|
answer_str += answer
|
|
|
|
|
|
|
|
elif isinstance(answer, dict):
|
|
elif isinstance(answer, dict):
|
|
@@ -356,7 +357,7 @@ async def handle_client(websocket: WebSocket,
|
|
|
result = {"message": answer_str, "type": "close", "message_files": message_files}
|
|
result = {"message": answer_str, "type": "close", "message_files": message_files}
|
|
|
try:
|
|
try:
|
|
|
SessionService(db).update_session(chat_id,
|
|
SessionService(db).update_session(chat_id,
|
|
|
- message={"role": "assistant", "content": answer_str},conversation_id=data.get("conversation_id"))
|
|
|
|
|
|
|
+ message={"role": "assistant", "content": {"answer":answer_str, "images":[i.get("url") for i in message_files]}},conversation_id=data.get("conversation_id"))
|
|
|
except Exception as e:
|
|
except Exception as e:
|
|
|
logger.error("保存dify的会话异常!")
|
|
logger.error("保存dify的会话异常!")
|
|
|
logger.error(e)
|
|
logger.error(e)
|