From f615a5688f5ede501cf4cba39e259e86509d66d3 Mon Sep 17 00:00:00 2001 From: kangfenmao Date: Wed, 10 Jul 2024 20:07:50 +0800 Subject: [PATCH] fix: assistant topic not exist --- src/renderer/src/hooks/useTopic.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/renderer/src/hooks/useTopic.ts b/src/renderer/src/hooks/useTopic.ts index 2dd7d42119..9f5ee5139e 100644 --- a/src/renderer/src/hooks/useTopic.ts +++ b/src/renderer/src/hooks/useTopic.ts @@ -7,7 +7,7 @@ export function useActiveTopic(assistant: Assistant) { useEffect(() => { // activeTopic not in assistant.topics - if (!find(assistant.topics, { id: activeTopic?.id })) { + if (assistant && !find(assistant.topics, { id: activeTopic?.id })) { setActiveTopic(assistant.topics[0]) } }, [activeTopic?.id, assistant])