Skip to content

Commit

Permalink
chore: handle llm error in logs
Browse files Browse the repository at this point in the history
  • Loading branch information
cbrzn committed Jan 2, 2024
1 parent ed56e6f commit 1e94d64
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions apps/browser/lib/utils/sanitizeLogsDetails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ export function sanitizeLogs(messages: ChatLog[]): MessageSet[] {
return sanitizedLogs;
}

// Sometimes the LLM request errors and returns "{}"
// This handles the error and explicitly returns an error message to the UI
if (!("title" in currentMessage) || currentMessage.title === "{}") {
currentSet.evoMessage = "An error has happened, please contact team support if this continue happening";
return sanitizedLogs;
}

// Only user message (goal) and evo's answer does not start with #
// Since user message is handled above, we now for sure that its evo's answer
if (!currentMessage.title.startsWith("#")) {
Expand Down

0 comments on commit 1e94d64

Please sign in to comment.