fix: assistant topic not exist

This commit is contained in:
kangfenmao
2024-07-10 20:07:50 +08:00
parent 0ccb92e7f6
commit f615a5688f
+1 -1
View File
@@ -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])