fix jest error

This commit is contained in:
code-october
2024-10-12 06:41:08 +00:00
parent fe9c31c3b7
commit b0236f7b19
2 changed files with 69 additions and 3 deletions

View File

@@ -739,6 +739,7 @@ export const useChatStore = createPersistStore(
if (typeof message !== "string") {
return false;
}
message = message.trim();
if (message.startsWith("```") && message.endsWith("```")) {
const codeBlockContent = message.slice(3, -3).trim();
const jsonString = codeBlockContent.replace(/^json\s*/i, '').trim();