From 0beae0b035dcc76a0dc32604b88f30f03ef0a1ae Mon Sep 17 00:00:00 2001 From: zhuhao <979263092@qq.com> Date: Thu, 13 Feb 2025 14:25:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=93=E5=AD=97=E6=9C=BA=E6=95=88=E7=8E=87?= =?UTF-8?q?=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../template-study/container/right.vue | 19 +++++++++++++++---- .../src/components/typing-effect/index.vue | 19 ++++++++++++++++--- 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/src/renderer/src/components/template-study/container/right.vue b/src/renderer/src/components/template-study/container/right.vue index e2cba23..a0efe23 100644 --- a/src/renderer/src/components/template-study/container/right.vue +++ b/src/renderer/src/components/template-study/container/right.vue @@ -23,7 +23,7 @@ - 添加提示词 + {{curTemplate.ex3 === '1' ? '复制并创建个人模板' : '添加提示词'}} 一键研读 @@ -120,6 +120,10 @@ const modeOptions = ref([ label: '知识库模型', value: 2, disabled: false + }, + { + label: 'deepseek模型', + value: 3 } ]) @@ -134,7 +138,7 @@ const modeOptions = ref([ const isWordDialog = ref(false) const editItem = reactive({}) const onAdd = () => { - + console.log(curTemplate) Object.assign(editItem, curTemplate) editItem.isAdd = true isWordDialog.value = true @@ -333,6 +337,9 @@ const againResult = async (index, item) => { }) data = res.data } else { + if (curMode.value == 3) { + params.llm = 'deepseek-r1:8b' + } // 知识库模型 const res = await completion(params) data = res.data @@ -381,6 +388,9 @@ const getCompletion = async () => { } // 知识库模型 else { + if (curMode.value == 3) { + params.llm = 'deepseek-r1:8b' + } const res = await completion(params) data = res.data } @@ -439,6 +449,7 @@ const onSaveTemp = async (item) => { // 去掉字符串中的 ### ** let getResult = (str) => { let newStr = str.replace(/#+|(\*\*)/g, ''); + newStr = newStr.replace(/[\s\S]*?<\/think>/g, ''); return newStr } @@ -485,8 +496,8 @@ onMounted(() => { getTemplateList() let jsonKey = `${modeType.value}-${data.edustage}-${data.edusubject}` - - + + params.dataset_id = dataSetJson[jsonKey] if(!params.dataset_id){ curMode.value = 1 diff --git a/src/renderer/src/components/typing-effect/index.vue b/src/renderer/src/components/typing-effect/index.vue index 2438ce0..d707a45 100644 --- a/src/renderer/src/components/typing-effect/index.vue +++ b/src/renderer/src/components/typing-effect/index.vue @@ -40,9 +40,22 @@ const type = async () => { displayedText.value = props.text return } + //限制多久内打印完ms + let allLength = props.text.length + let allTime = 3000 + let addIndex = allLength/(allTime/props.delay); + //一次添加5个字符 + for (let i = 0; i < addIndex; i++) { + if (index.value <= allLength) { + displayedText.value += props.text.charAt(index.value); + index.value++; + } else { + break; + } + } if (index.value <= props.text.length) { - displayedText.value += props.text.charAt(index.value); - index.value++; + // displayedText.value += props.text.charAt(index.value); + // index.value++; setTimeout(() => { type(); emit('updateScroll', typingEffectRef.value.clientHeight); // 每次添加新字符后滚动到底部 @@ -74,4 +87,4 @@ watch([() => props.text, () => props.delay], resetAndType); :deep(.el-textarea__inner:hover){ box-shadow: none; } - \ No newline at end of file +