fix: Matrix改用HTTP API,修复HTTPS不可用问题,网页端消息同步到Matrix
This commit is contained in:
8
main.py
8
main.py
@@ -256,6 +256,10 @@ async def websocket_endpoint(websocket: WebSocket, user_id: str, db: Session = D
|
||||
}
|
||||
})
|
||||
|
||||
# 同步到Matrix(如果有房间)
|
||||
if matrix_bot.is_running and matrix_bot.last_room_id:
|
||||
await matrix_bot.send_message(matrix_bot.last_room_id, f"[网页] {message}")
|
||||
|
||||
# 获取对话历史
|
||||
history = conv_service.get_conversation_history(conversation_id, limit=20)
|
||||
|
||||
@@ -284,6 +288,10 @@ async def websocket_endpoint(websocket: WebSocket, user_id: str, db: Session = D
|
||||
}
|
||||
})
|
||||
|
||||
# 同步AI回复到Matrix
|
||||
if matrix_bot.is_running and matrix_bot.last_room_id:
|
||||
await matrix_bot.send_message(matrix_bot.last_room_id, ai_response)
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"AI调用失败: {e}")
|
||||
await websocket.send_json({
|
||||
|
||||
Reference in New Issue
Block a user