Przeglądaj źródła

Do not create thread if aiAssistantId does not exist

Shun Miyazawa 1 rok temu
rodzic
commit
f33a49eb5e

+ 3 - 2
apps/app/src/features/openai/client/components/AiAssistant/AiAssistantChatSidebar/AiAssistantChatSidebar.tsx

@@ -94,9 +94,10 @@ const AiAssistantChatSidebarSubstance: React.FC<AiAssistantChatSidebarSubstanceP
 
 
     // create thread
     // create thread
     let currentThreadId = threadId;
     let currentThreadId = threadId;
-    if (threadId == null) {
+    const aiAssistantId = aiAssistantData?._id;
+    if (threadId == null && aiAssistantId) {
       try {
       try {
-        const res = await apiv3Post('/openai/thread', { aiAssistantId: aiAssistantData?._id });
+        const res = await apiv3Post('/openai/thread', { aiAssistantId });
         const thread = res.data.thread;
         const thread = res.data.thread;
 
 
         setThreadId(thread.id);
         setThreadId(thread.id);