소스 검색

Merge pull request #5522 from ConnectAI-E/fix/5494

fix: prevent title update on invalid message response
Lloyd Zhou 1 년 전
부모
커밋
4c84182e7a
1개의 변경된 파일5개의 추가작업 그리고 0개의 파일을 삭제
  1. 5 0
      app/store/chat.ts

+ 5 - 0
app/store/chat.ts

@@ -615,6 +615,7 @@ export const useChatStore = createPersistStore(
               providerName,
             },
             onFinish(message) {
+              if (!isValidMessage(message)) return;
               get().updateCurrentSession(
                 (session) =>
                   (session.topic =
@@ -690,6 +691,10 @@ export const useChatStore = createPersistStore(
             },
           });
         }
+
+        function isValidMessage(message: any): boolean {
+          return typeof message === "string" && !message.startsWith("```json");
+        }
       },
 
       updateStat(message: ChatMessage) {