fix(ai): prevent marked parse error from crashing chat during streaming
This commit is contained in:
1 parent
f1b8579994
commit
03e5e27c79
2 files changed
+6
-8
No files matched your search
@@ -858,7 +858,11 @@ const markedInstance = new Marked({
|
||||
});
|
||||
|
||||
function formatInlineText(text: string): string {
|
||||
return markedInstance.parse(text) as string;
|
||||
try {
|
||||
return markedInstance.parse(text) as string;
|
||||
} catch {
|
||||
return text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
||||
}
|
||||
}
|
||||
|
||||
const messageRenderer = computed(() => {
|
||||
|
||||
Reference in new issue
Block a user