打字机效率变更

This commit is contained in:
朱浩 2025-02-13 14:25:18 +08:00
parent 159cb75ca9
commit 0beae0b035
2 changed files with 31 additions and 7 deletions

View File

@ -23,7 +23,7 @@
</el-button>
<el-button type="primary" link :disabled="!(templateList.length)" @click="onAdd">
<i class="iconfont icon-jiahao"></i>
添加提示词
{{curTemplate.ex3 === '1' ? '复制并创建个人模板' : '添加提示词'}}
</el-button>
<el-button type="primary" :disabled="!(childTempList.length)" @click="getCompletion">一键研读</el-button>
</div>
@ -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(/<think>[\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

View File

@ -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;
}
</style>
</style>