Skip to content

Commit

Permalink
Fix max iterations (#4949)
Browse files Browse the repository at this point in the history
  • Loading branch information
tofarr authored Nov 12, 2024
1 parent 123fb4b commit 59f7093
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions frontend/src/components/event-handler.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import { base64ToBlob } from "#/utils/base64-to-blob";
import { setCurrentAgentState } from "#/state/agentSlice";
import AgentState from "#/types/AgentState";
import { getSettings } from "#/services/settings";
import { generateAgentStateChangeEvent } from "#/services/agentStateService";

interface ServerError {
error: boolean | string;
Expand Down Expand Up @@ -96,6 +97,14 @@ export function EventHandler({ children }: React.PropsWithChildren) {
return;
}

if (event.type === "error") {
const message: string = `${event.message}`;
if (message.startsWith("Agent reached maximum")) {
// We set the agent state to paused here - if the user clicks resume, it auto updates the max iterations
send(generateAgentStateChangeEvent(AgentState.PAUSED));
}
}

if (isErrorObservation(event)) {
dispatch(
addErrorMessage({
Expand Down

0 comments on commit 59f7093

Please sign in to comment.