Spaces:
Runtime error
Runtime error
File size: 815 Bytes
cd6f98e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | import type AgentWork from "./agent-work";
import type AutonomousAgent from "../autonomous-agent";
export default class StartGoalWork implements AgentWork {
tasksValues: string[] = [];
constructor(private parent: AutonomousAgent) {}
run = async () => {
const goalMessage = this.parent.messageService.sendGoalMessage(this.parent.model.getGoal());
this.tasksValues = await this.parent.api.getInitialTasks();
await this.parent.api.createAgent();
this.parent.api.saveMessages([goalMessage]);
};
conclude = async () => {
const messages = await this.parent.createTaskMessages(this.tasksValues);
this.parent.api.saveMessages(messages);
};
onError = (e: unknown): boolean => {
this.parent.messageService.sendErrorMessage(e);
return true;
};
next = () => undefined;
}
|