过滤>>>>>>>>

This commit is contained in:
2024-12-31 11:27:48 +08:00
parent 85538118bf
commit 34f1a581ab
2 changed files with 59 additions and 110 deletions

View File

@@ -67,6 +67,10 @@ class ChatConsumer(AsyncWebsocketConsumer):
print(f" - Connected to server on {uri}", flush=True)
print(" - Sending message to server.", flush=True)
print(text_data)
# json_data = json.loads(text_data)
# chat_id = json_data['chat_id']
# websocket.send(json_data['message'])
websocket.send(text_data)
import re
@@ -116,7 +120,7 @@ class ChatConsumer(AsyncWebsocketConsumer):
if current_agent in ['analysis_executor','analysis_pl_uv', 'analysis_picturer', 'Experiment_Optimizer', 'optimizer_critic', 'Outer_Analysis_Admin']:
group_name = 'Optimizer'
content = {"group_name": group_name, "agent_name": current_agent.replace("_", " ").title(), "content": cleaned_string}
content = {"group_name": group_name, "agent_name": current_agent.replace("_", " ").title(), "content": cleaned_string.replace('>>>>>>>>', '')}
# 通过 WebSocket 消费者发送消息
asyncio.run(self.send(text_data=json.dumps(content)))