diff --git a/src/components/dialoguePanel/DialoguePanel.vue b/src/components/dialoguePanel/DialoguePanel.vue
index 4154c27ea74348d766b2ef28a728a1eb95fd437a..947990a35911ad17581f174ce28f5542e4f03225 100644
--- a/src/components/dialoguePanel/DialoguePanel.vue
+++ b/src/components/dialoguePanel/DialoguePanel.vue
@@ -250,9 +250,20 @@ const contentAfterMark = computed(() => {
str = str.slice(0, tableStart) + '
' + str.slice(tableStart, str.indexOf('') + ''.length).replace('', '
') + str.slice(str.indexOf('') + ''.length);
}
//仅获取第一个遇到的 think 标签
- if(str.match(/([\s\S]*?)<\/think>/)){
- thoughtContent.value = str.match(/([\s\S]*?)<\/think>/)[1];
+ // if(str.match(/([\s\S]*?)<\/think>/)){
+ // thoughtContent.value = str.match(/([\s\S]*?)<\/think>/)[1];
+ // }
+ let thinkStart = str.indexOf('');
+ if (thinkStart !== -1) {
+ let thinkEnd = str.indexOf('', thinkStart);
+ if (thinkEnd !== -1) {
+ // 提取 标签中的内容
+ thoughtContent.value = str.slice(thinkStart + 7, thinkEnd);
+ // 将 标签替换为空
+ str = str.slice(0, thinkStart) + str.slice(thinkEnd + 8);
+ }
}
+
//将标签替换为空
return str.replace(/([\s\S]*?)<\/think>/g,'');
});
diff --git a/src/components/dialoguePanel/DialogueThought.vue b/src/components/dialoguePanel/DialogueThought.vue
index ef948fb134a2cdda83c690f0299a26364652ca16..17241a24f193ab60d913ced4fe52aa4b8affa2c5 100644
--- a/src/components/dialoguePanel/DialogueThought.vue
+++ b/src/components/dialoguePanel/DialogueThought.vue
@@ -34,8 +34,11 @@ const contentAfterMark = computed(() => {
if (!props.content) {
return '';
}
+ console.log(props.content);
//xxs将大于号转为html实体以防歧义;将< >替换为正常字符;
let str = marked.parse(xss(props.content).replace(/>/g, '>').replace(/</g, '<'));
+ console.log(str);
+
return str;
});