tmp
This commit is contained in:
@@ -2,6 +2,7 @@ import WebSocket, { WebSocketServer } from 'ws';
|
||||
import http from 'http';
|
||||
import { DBModel } from "./models/index.js";
|
||||
import { chatTask } from "./agent/escort/task.js";
|
||||
import { adminAgent } from "./agent/escort-admin/agent.js"
|
||||
|
||||
export default class WebSocketServerManager {
|
||||
constructor(port = 8080) {
|
||||
@@ -80,6 +81,10 @@ export default class WebSocketServerManager {
|
||||
|
||||
if (msg.type === 'chat' || msg.type === 'clear') {
|
||||
if (msg.agent === 'escort-admin') {
|
||||
const userInfo = await this.getUserInfo(msg.userId);
|
||||
adminAgent.streamChat(userInfo, [msg], (source, type, content, id) => {
|
||||
ws.send(JSON.stringify({ source, type, content, id }));
|
||||
});
|
||||
} else {
|
||||
const userInfo = await this.getUserInfo(msg.userId);
|
||||
chatTask.streamChat(userInfo, msg, (source, type, content, id) => {
|
||||
|
||||
Reference in New Issue
Block a user