MCPcopy
hub / github.com/ElricLiu/AutoGPT-Next-Web / startGoal

Method startGoal

src/components/AutonomousAgent.ts:101–132  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

99 }
100
101 async startGoal() {
102 const { isGuestMode, isValidGuest } = this.guestSettings;
103 if (isGuestMode && !isValidGuest && !this.modelSettings.customApiKey) {
104 this.sendErrorMessage(
105 `${i18n?.t("errors.invalid-guest-key", { ns: "chat" })}`
106 );
107 this.stopAgent();
108 return;
109 }
110 this.sendGoalMessage();
111 this.sendThinkingMessage();
112
113 // Initialize by getting taskValues
114 try {
115 const taskValues = await this.getInitialTasks();
116 for (const value of taskValues) {
117 await new Promise((r) => setTimeout(r, TIMOUT_SHORT));
118 const task: Task = {
119 taskId: v1().toString(),
120 value,
121 status: TASK_STATUS_STARTED,
122 type: MESSAGE_TYPE_TASK,
123 };
124 this.sendMessage(task);
125 }
126 } catch (e) {
127 console.log(e);
128 this.sendErrorMessage(getMessageFromError(e));
129 this.shutdown();
130 return;
131 }
132 }
133
134 async loop() {
135 this.conditionalPause();

Callers 1

runMethod · 0.95

Calls 7

sendErrorMessageMethod · 0.95
stopAgentMethod · 0.95
sendGoalMessageMethod · 0.95
sendThinkingMessageMethod · 0.95
getInitialTasksMethod · 0.95
sendMessageMethod · 0.95
getMessageFromErrorFunction · 0.85

Tested by

no test coverage detected