partial commit of AI-Agents work. Need to refactor out keys to commit the rest.
This commit is contained in:
28
AI-agents/_studio_dependencies/GlobalVariable/router.js
Normal file
28
AI-agents/_studio_dependencies/GlobalVariable/router.js
Normal file
@@ -0,0 +1,28 @@
|
||||
const { recognizedObject: r = {} } = this;
|
||||
|
||||
class Router {
|
||||
constructor() {
|
||||
r.router = {
|
||||
agents: [],
|
||||
};
|
||||
}
|
||||
|
||||
setAgents(agents) {
|
||||
r.router.agents = agents;
|
||||
}
|
||||
|
||||
hasNext() {
|
||||
return r.router.agents.some((agent) => agent.state === "submitted");
|
||||
}
|
||||
|
||||
next() {
|
||||
return r.router.agents.find((agent) => agent.state === "submitted");
|
||||
}
|
||||
|
||||
setState(id, state) {
|
||||
const agent = r.router.agents.find((agent) => agent.id === id);
|
||||
if (agent) agent.state = state;
|
||||
}
|
||||
}
|
||||
|
||||
return new Router();
|
||||
Reference in New Issue
Block a user