From b845b1ca01363d511f7f6f3e65a628e8e6190b4c Mon Sep 17 00:00:00 2001 From: Henry Li Date: Mon, 12 May 2025 20:56:38 +0800 Subject: [PATCH] fix: add error handling for podcast generation (#59) Co-authored-by: Jiang Feng --- .../app/chat/components/message-list-view.tsx | 45 ++++++++++++------- web/src/core/store/store.ts | 22 ++++++++- 2 files changed, 50 insertions(+), 17 deletions(-) diff --git a/web/src/app/chat/components/message-list-view.tsx b/web/src/app/chat/components/message-list-view.tsx index c4f2bf8..8d8c279 100644 --- a/web/src/app/chat/components/message-list-view.tsx +++ b/web/src/app/chat/components/message-list-view.tsx @@ -328,7 +328,7 @@ function PlanCard({ - + {`### ${ plan.title !== undefined && plan.title !== "" ? plan.title @@ -404,6 +404,9 @@ function PodcastCard({ const isGenerating = useMemo(() => { return message.isStreaming; }, [message.isStreaming]); + const hasError = useMemo(() => { + return data?.error !== undefined; + }, [data]); const [isPlaying, setIsPlaying] = useState(false); return ( @@ -411,15 +414,21 @@ function PodcastCard({
{isGenerating ? : } - - {isGenerating - ? "Generating podcast..." - : isPlaying - ? "Now playing podcast..." - : "Podcast"} - + {!hasError ? ( + + {isGenerating + ? "Generating podcast..." + : isPlaying + ? "Now playing podcast..." + : "Podcast"} + + ) : ( +
+ Error when generating podcast. Please try again. +
+ )}
- {!isGenerating && ( + {!hasError && !isGenerating && (