|
@@ -82,7 +82,7 @@ async function handleSendMessage(q?: string, isInput?: boolean) {
|
|
|
chatList.value.push({
|
|
|
left: false,
|
|
|
name: '我',
|
|
|
- d: encodeURIComponent(q),
|
|
|
+ d: (q),
|
|
|
t,
|
|
|
})
|
|
|
nextTick(() => {
|
|
@@ -136,6 +136,8 @@ async function handleSendMessage(q?: string, isInput?: boolean) {
|
|
|
name: '智能备课助手',
|
|
|
d: '思考中',
|
|
|
t: t + 1,
|
|
|
+ q,
|
|
|
+ res: undefined,
|
|
|
})
|
|
|
// bigModel.onWillResultChange = (resultData) => {
|
|
|
// chatList.value[i - 1].d += encodeURIComponent(resultData)
|
|
@@ -145,9 +147,12 @@ async function handleSendMessage(q?: string, isInput?: boolean) {
|
|
|
// }
|
|
|
bigModel.onWillResultFinish = (resultData) => {
|
|
|
chatList.value[i - 1].d = ''
|
|
|
+ chatList.value[i - 1].res = resultData
|
|
|
|
|
|
- console.log('handleStartAudioTts', resultData)
|
|
|
- const fullAnswerList = resultData.match(/.{1,3}/g) ?? []
|
|
|
+ // console.log('handleStartAudioTts', resultData)
|
|
|
+ // window.str = resultData.replace(/\n/g, '<br>')
|
|
|
+
|
|
|
+ const fullAnswerList = resultData.replace(/\n/g, '<br>').match(/.{1,3}/g) ?? []
|
|
|
const timer = setInterval(() => {
|
|
|
if (fullAnswerList.length === 0) {
|
|
|
clearInterval(timer)
|
|
@@ -155,7 +160,8 @@ async function handleSendMessage(q?: string, isInput?: boolean) {
|
|
|
return
|
|
|
}
|
|
|
const item = fullAnswerList!.shift()
|
|
|
- chatList.value[i - 1].d += encodeURIComponent(item)
|
|
|
+ // chatList.value[i - 1].d += encodeURIComponent(item)
|
|
|
+ chatList.value[i - 1].d += (item)
|
|
|
nextTick(() => {
|
|
|
scrollbarRef.value.setScrollTop(99999999)
|
|
|
})
|
|
@@ -213,23 +219,17 @@ function handleChangeTab() {
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
|
- <div
|
|
|
- class="fixed bottom-200px right-40px h-200px w-200px flex cursor-pointer items-center justify-center"
|
|
|
- @click="openDrawer"
|
|
|
- >
|
|
|
+ <div class="fixed bottom-200px right-40px h-200px w-200px flex cursor-pointer items-center justify-center"
|
|
|
+ @click="openDrawer">
|
|
|
<!-- <div ref="anim" /> -->
|
|
|
<img :src="placeImg" alt="">
|
|
|
</div>
|
|
|
- <el-drawer
|
|
|
- v-model="ifDrawer" direction="rtl" append-to-body :size="880" title="智能备课助手" :z-index="201"
|
|
|
- style="background-color: #f0f0f0;" class="no-mb"
|
|
|
- >
|
|
|
+ <el-drawer v-model="ifDrawer" direction="rtl" append-to-body :size="880" title="智能备课助手" :z-index="201"
|
|
|
+ style="background-color: #f0f0f0;" class="no-mb">
|
|
|
<div class="flex">
|
|
|
<div v-loading="!videoLoaded" element-loading-text="助手形象生成中..." class="h-820px w-400px">
|
|
|
- <video
|
|
|
- ref="videoRef" src="https://ossdownload.bozedu.net/static/webm/preview.webm "
|
|
|
- class="h-full flex items-center justify-center" loop muted @loadedmetadata="handleLoadedMetadata"
|
|
|
- />
|
|
|
+ <video ref="videoRef" src="https://ossdownload.bozedu.net/static/webm/preview.webm "
|
|
|
+ class="h-full flex items-center justify-center" loop muted @loadedmetadata="handleLoadedMetadata" />
|
|
|
</div>
|
|
|
<div class="w-440px flex flex-col justify-between rounded bg-white px-10px py-10px">
|
|
|
<el-tabs v-model="modelVersion" stretch @tab-change="handleChangeTab">
|
|
@@ -243,16 +243,14 @@ function handleChangeTab() {
|
|
|
您可以试着问我:
|
|
|
</div>
|
|
|
<ul class="space-y-3">
|
|
|
- <li
|
|
|
- v-for="item in optionInputs" :key="item"
|
|
|
+ <li v-for="item in optionInputs" :key="item"
|
|
|
class="flex cursor-pointer items-center justify-between rounded-16px bg-white px-18px py-8px text-12px leading-16px text-black"
|
|
|
- @click="handleSendMessage(item)"
|
|
|
- >
|
|
|
+ @click="handleSendMessage(item)">
|
|
|
{{ item }}
|
|
|
</li>
|
|
|
</ul>
|
|
|
</div>
|
|
|
- <info-item v-for="item in chatList" :key="item.t" :left="item.left" :name="item.name" :d="item.d" />
|
|
|
+ <info-item v-for="item in chatList" :key="item.t" :left="item.left" :name="item.name" :d="item.d" :res="item.res" />
|
|
|
</div>
|
|
|
</el-scrollbar>
|
|
|
<div class="flex items-start justify-between space-x-14px">
|
|
@@ -262,16 +260,12 @@ function handleChangeTab() {
|
|
|
<Microphone class="h-20px w-20px" />
|
|
|
</div> -->
|
|
|
<el-tooltip class="" effect="dark" content="一次语音识别时长不能超过60秒" placement="top-start">
|
|
|
- <el-button
|
|
|
- :icon="Microphone" circle
|
|
|
+ <el-button :icon="Microphone" circle
|
|
|
:color="(iatStatus === 'UNDEFINED' || iatStatus === 'CLOSED') ? '#626aef' : '#f56c6c'"
|
|
|
- :disabled="isWorking" style="--color: #fff;" @click="handleStartIat"
|
|
|
- />
|
|
|
+ :disabled="isWorking" style="--color: #fff;" @click="handleStartIat" />
|
|
|
</el-tooltip>
|
|
|
- <el-input
|
|
|
- v-model="questionInput" size="large" type="textarea" placeholder="请输入您的问题"
|
|
|
- :autosize="{ minRows: 1, maxRows: 4 }"
|
|
|
- />
|
|
|
+ <el-input v-model="questionInput" size="large" type="textarea" placeholder="请输入您的问题"
|
|
|
+ :autosize="{ minRows: 1, maxRows: 4 }" />
|
|
|
<el-button color="#626aef" :disabled="isWorking" @click="handleSendMessage(questionInput, true)">
|
|
|
发送
|
|
|
</el-button>
|