diff --git a/src/components/dialoguePanel/DialoguePanel.vue b/src/components/dialoguePanel/DialoguePanel.vue index a7df31a5b238a4fbfdc141c3fa1b017e66f9bc3c..e6a3f66b352cbc5c539d6f5fbac8ea4310450e49 100644 --- a/src/components/dialoguePanel/DialoguePanel.vue +++ b/src/components/dialoguePanel/DialoguePanel.vue @@ -10,6 +10,7 @@ import dayjs from "dayjs"; import xss from "xss"; import { errorMsg, successMsg } from "src/components/Message"; import ReportPopover from "src/views/dialogue/components/ReportPopover.vue"; +import DialogueThought from "./DialogueThought.vue"; import { onMounted, watch, onBeforeUnmount,reactive } from "vue"; import * as echarts from 'echarts'; import color from 'src/assets/color'; @@ -90,7 +91,7 @@ const props = withDefaults(defineProps(), { // currentSelected: 0, needRegernerate: false, }); - +const thoughtContent = ref(''); const index = ref(0); const isLike = ref(props.isLikeList); const emits = defineEmits<{ @@ -133,6 +134,7 @@ const handlePauseAndReGenerate = (cid?: number) => { emits("clearSuggestion", props.key); if (props.isFinish) { // 重新生成 + thoughtContent.value = ""; reGenerateAnswer(cid, user_selected_app.value); } else { // 停止生成 @@ -240,21 +242,34 @@ const contentAfterMark = computed(() => { if (!props.content) { return ""; } + //xxs将大于号转为html实体以防歧义;将< >替换为正常字符; let str = marked.parse( xss(props.content[props.currentSelected]) .replace(/>/g, ">") .replace(/</g, "<") ) + //将table提取出来中加一个
父节点控制溢出 let tableStart = str.indexOf(''); if(tableStart!== -1){ str = str.slice(0, tableStart) + '
' + str.slice(tableStart, str.indexOf('
') + ''.length).replace('', '
') + str.slice(str.indexOf('') + ''.length); } - //将table提取出来中加一个
父节点控制溢出 - return `
${str}
`; - //xxs将大于号转为html实体以防歧义;将< >替换为正常字符; + //仅获取第一个遇到的 think 标签 + const startIndex = str.indexOf(''); + const endIndex = str.indexOf(''); + if (startIndex !== -1 && endIndex === -1) { + // 计算 之后的字符串 + const contentAfterA = str.substring(startIndex + 7); // +2 是因为我们要跳过 这两个字符 + thoughtContent.value = contentAfterA; + return ""; + } + else if(startIndex !== -1 && endIndex !== -1){ + thoughtContent.value = str.match(/([\s\S]*?)<\/think>/)[1]; + } + return str.replace(/([\s\S]*?)<\/think>/g,''); }); const prePageHandle = (cid: number) => { + thoughtContent.value = ""; prePage(cid); if (index.value === 0) { index.value = 0; @@ -265,6 +280,7 @@ const prePageHandle = (cid: number) => { }; const nextPageHandle = (cid: number) => { + thoughtContent.value = ""; nextPage(cid); if (index.value === (props.isLikeList as number[]).length - 1) { index.value = (props.isLikeList as number[]).length - 1; @@ -452,11 +468,12 @@ const handleSendMessage = async (question, user_selected_flow, user_selected_app
+
补充参数 - +
@@ -478,7 +495,7 @@ const handleSendMessage = async (question, user_selected_flow, user_selected_app {{$t('history.cancel')}}
-
+
{{$t('feedback.eulercopilot_is_thinking')}}
diff --git a/src/components/dialoguePanel/DialogueThought.vue b/src/components/dialoguePanel/DialogueThought.vue new file mode 100644 index 0000000000000000000000000000000000000000..9c2b174fb46c6c8c2378fafd9da6d6d73ed4dcd6 --- /dev/null +++ b/src/components/dialoguePanel/DialogueThought.vue @@ -0,0 +1,108 @@ + + + + + diff --git a/src/components/sessionCard/SessionCard.vue b/src/components/sessionCard/SessionCard.vue index f74406c17650ad55fb5fd29d6c7104bad843f5a9..f12899b83a8186ef118d2d1b755c573fba143165 100644 --- a/src/components/sessionCard/SessionCard.vue +++ b/src/components/sessionCard/SessionCard.vue @@ -57,7 +57,6 @@ const handleHover = async () => { x: rect?.x, y: rect?.y, }; - } else { } }; diff --git a/src/views/createapp/components/workFlowDebug.vue b/src/views/createapp/components/workFlowDebug.vue index 8b24c873ac9fd9d166df73c3a6303ab54025e462..588bbb14386178696ec828ede156f1cbcde2ada6 100644 --- a/src/views/createapp/components/workFlowDebug.vue +++ b/src/views/createapp/components/workFlowDebug.vue @@ -57,15 +57,13 @@