1
0
forked from Leaf/amber-ui

改进 如果不支持高亮,则默认纯文本

This commit is contained in:
Twilight 2024-10-05 21:38:06 +08:00
parent bd91bc5040
commit 7e915ff63f
2 changed files with 4 additions and 3 deletions

View File

@ -254,7 +254,7 @@ type Prompt = {
}; };
const isMobile = useIsMobile(); const isMobile = useIsMobile();
const userStore = useUserStore(); // const userStore = useUserStore();
const chatStore = useChatStore(); const chatStore = useChatStore();
const compositionStart = ref(false); const compositionStart = ref(false);
const inputContainer: any = ref(null); const inputContainer: any = ref(null);

View File

@ -135,10 +135,11 @@ import config from "@/config/config";
const mdIt = markdownIt(); const mdIt = markdownIt();
const mdInited = ref(true); const mdInited = ref(true);
const unsupportedLanguages = ["assembly"]; const unsupportedLanguages = ["assembly", "blade"];
mdIt.options.highlight = function (str: string, lang: string) { mdIt.options.highlight = function (str: string, lang: string) {
if (!lang || unsupportedLanguages.includes(lang)) { if (!lang || unsupportedLanguages.includes(lang)) {
return str; // return str;
lang = "text"
} }
return hljs.highlight(str, { language: lang }).value; return hljs.highlight(str, { language: lang }).value;