From 4e060598631df77668ea6fdd2c9b61992d9093a5 Mon Sep 17 00:00:00 2001 From: Louis Date: Mon, 23 Dec 2024 14:09:42 +0700 Subject: [PATCH] fix: update thread's title edge cases --- web/hooks/useCreateNewThread.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/web/hooks/useCreateNewThread.ts b/web/hooks/useCreateNewThread.ts index 40e554945e..1094ec621d 100644 --- a/web/hooks/useCreateNewThread.ts +++ b/web/hooks/useCreateNewThread.ts @@ -191,9 +191,11 @@ export const useCreateNewThread = () => { async (thread: Thread) => { updateThread(thread) - setActiveAssistant(thread.assistants[0]) updateThreadCallback(thread) - updateAssistantCallback(thread.id, thread.assistants[0]) + if (thread.assistants && thread.assistants?.length > 0) { + setActiveAssistant(thread.assistants[0]) + updateAssistantCallback(thread.id, thread.assistants[0]) + } }, [ updateThread,