feat: add error handling

This commit is contained in:
Li Xin
2025-04-30 21:09:14 +08:00
parent 98494dddbf
commit f841df834f
4 changed files with 44 additions and 1 deletions

View File

@@ -2,6 +2,7 @@
// SPDX-License-Identifier: MIT
import { nanoid } from "nanoid";
import { toast } from "sonner";
import { create } from "zustand";
import { chatStream, generatePodcast } from "../api";
@@ -136,6 +137,7 @@ export async function sendMessage(
}
}
} catch {
toast("An error occurred while generating the response. Please try again.");
// Update message status.
// TODO: const isAborted = (error as Error).name === "AbortError";
if (messageId != null) {