This commit is contained in:
lik
2026-06-01 15:48:50 +08:00
parent 24b56b1875
commit 40c45c6db7
51 changed files with 2079 additions and 9 deletions

View File

@@ -1,7 +1,7 @@
import WebSocket, { WebSocketServer } from 'ws';
import http from 'http';
import { DBModel } from "./models/index.js";
import { chatTask } from "./agent/task.js";
import { chatTask } from "./agent/escort/task.js";
export default class WebSocketServerManager {
constructor(port = 8080) {
@@ -79,10 +79,13 @@ export default class WebSocketServerManager {
}
if (msg.type === 'chat' || msg.type === 'clear') {
const userInfo = await this.getUserInfo(msg.userId);
chatTask.streamChat(userInfo, msg, (source, type, content, id) => {
ws.send(JSON.stringify({ source, type, content, id }));
});
if (msg.agent === 'escort') {
const userInfo = await this.getUserInfo(msg.userId);
chatTask.streamChat(userInfo, msg, (source, type, content, id) => {
ws.send(JSON.stringify({ source, type, content, id }));
});
} else if (msg.agent === 'escort-admin') {
}
return;
}