From 8830cdd3be73bb830496ac54ee9323057adb9db4 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 2dd7d421..9f5ee513 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])