fix: Handle special cases of LLM output not following markdown syntax (20250525, formated) This commit introduces a utility function to address rendering issues in LLM output, particularly for Chinese characters and parentheses. The function ensures minimal modification of the original text while fixing markdown parsing problems. Changes include: - Added in for handling specific cases. - Updated in to incorporate the new utility. The fix ensures proper rendering of bold/italic text containing Chinese parentheses, improving readability for non-English content.

This commit is contained in:
YuQX
2025-05-25 19:37:43 +08:00
parent 49fe137553
commit 8ef7938c96
2 changed files with 90 additions and 83 deletions
+2 -2
View File
@@ -20,7 +20,7 @@ import markedExtension from '$lib/utils/marked/extension';
import markedKatexExtension from '$lib/utils/marked/katex-extension';
import hljs from 'highlight.js';
import { specialCases } from '$lib/utils/processResponseContent/special-cases'
import { specialCases } from '$lib/utils/processResponseContent/special-cases';
//////////////////////////
// Helper functions
@@ -92,7 +92,7 @@ export const sanitizeResponseContent = (content: string) => {
};
export const processResponseContent = (content: string) => {
// This function is used to process the response content
// This function is used to process the response content
// before the response content is rendered.
content = specialCases(content);
return content.trim();