flux-agent
Version:
FluxAgent - 一个可灵活插拔的AI Agent系统框架,基于TypeScript开发,支持流式执行、事件系统、插件系统、知识库管理等功能 (Protected Release) (Protected Release) (Protected Release) (Protected Release) (Protected Release) (Protected Release) (Protected Release) (Protected Release) (Protected Release) (
26 lines (25 loc) • 684 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.RequestHub = void 0;
class RequestHub {
constructor() {
this.requestMap = new Map();
this.outterListener = () => { };
}
registerResponse(requestId, response) {
this.requestMap.set(requestId, response);
}
sendRequest(requestId, payload) {
this.outterListener(requestId, payload);
}
onRequest(callback) {
this.outterListener = callback;
}
response(requestId, res) {
const response = this.requestMap.get(requestId);
if (response) {
response(res);
}
}
}
exports.RequestHub = RequestHub;