update:优化稳定训练
This commit is contained in:
+3
-1
@@ -79,6 +79,7 @@ function createWebSocket(token, onMessage) {
|
||||
|
||||
const { data, event } = JSON.parse(res.data);
|
||||
if (event === "pong") return;
|
||||
if (!data || typeof data !== "object") return;
|
||||
if (data.type) {
|
||||
if (ENABLE_REALTIME_MESSAGE_LOG) {
|
||||
console.log("收到 WebSocket 消息", getMessageTypeName(data.type));
|
||||
@@ -86,7 +87,8 @@ function createWebSocket(token, onMessage) {
|
||||
if (onMessage) onMessage({ ...(data.data || {}), type: data.type });
|
||||
return;
|
||||
}
|
||||
if (onMessage && data.updates) onMessage(data.updates);
|
||||
if (!Array.isArray(data.updates)) return;
|
||||
if (onMessage) onMessage(data.updates);
|
||||
const msg = data.updates[0];
|
||||
if (msg) {
|
||||
if (ENABLE_REALTIME_MESSAGE_LOG) {
|
||||
|
||||
Reference in New Issue
Block a user