This commit is contained in:
weipengfei 2023-10-13 17:48:46 +08:00
parent 0a71909df0
commit c3799d8eb7
6 changed files with 32 additions and 10 deletions

View File

@ -26,7 +26,7 @@
.dots > div {
width: 4em;
height: 4em;
background-color: #3cefff;
background-color: #7fe7c4;
border-radius: 50%;
animation: fade 1.5s alternate ease-in-out infinite;
}

View File

@ -19,7 +19,7 @@ div::before {
left: -3px;
width: 20em;
height: 20em;
background-color: hsla(185, 100%, 62%, 0.75);
background-color: hsla(185, 65%, 58%, 0.75);
transform-origin: center bottom;
transform: scaleY(1);
animation: fill 3s linear infinite;

View File

@ -25,8 +25,8 @@
.middle,
.inner {
border: 3px solid transparent;
border-top-color: #3cefff;
border-right-color: #3cefff;
border-top-color: #7fe7c4;
border-right-color: #7fe7c4;
border-radius: 50%;
position: absolute;
top: 50%;

View File

@ -19,7 +19,7 @@
span {
width: 3em;
height: 6em;
background-color: #3cefff;
background-color: #7fe7c4;
}
span:nth-of-type(1) {

View File

@ -21,6 +21,7 @@ interface Props {
interface Emit {
(ev: 'regenerate'): void
(ev: 'delete'): void
(ev: 'changeNowStatus'): string
}
const props = defineProps<Props>()
@ -97,6 +98,7 @@ let sok = false
async function radioPlay() {
console.log('播放', props.mp3)
audioElements.length = 0
emit('changeNowStatus', 'loding')
const socket = new WebSocket('wss://chat.lihaink.cn/zhanti/tts')
sok = true
@ -166,8 +168,12 @@ const onAudioEnd = (index: any) => {
if (playing < audioElements.length) {
playFlag = true
audioElements[playing].play()
emit('changeNowStatus', 'playing')
}
else { playStatus.value = 'end' }
else {
playStatus.value = 'end';
emit('changeNowStatus', 'input')
}
}
//
const audioElements = reactive([])
@ -175,6 +181,7 @@ const audioElements = reactive([])
const playAudio = (playIndex: any) => {
// for (let i = 0; i < audioElements.length; i++)
audioElements[0].play()
emit('changeNowStatus', 'playing')
}
watch(() => audioElements.length, (newVal, oldVal) => {
@ -191,11 +198,13 @@ let pauseIndex = -1
const pauseAudio = () => {
pauseIndex = playing + 0
playStatus.value = 'pause'
emit('changeNowStatus', 'input')
for (let i = 0; i < audioElements.length; i++)
audioElements[i].pause()
}
const noPauseAudio = () => {
playStatus.value = 'playing'
emit('changeNowStatus', 'playing')
audioElements[pauseIndex].play()
pauseIndex = -1
}

View File

@ -218,7 +218,7 @@ async function onConversation() {
// console.log(`: `, msg.payload.choices.text[0].content);
// console.log(`: `, dataSources.value[dataSources.value.length - 1].text);
lastText += msg.payload.choices.text[0].content
const loading = true
const loading = false
nowStart.value = false
updateChat(
+uuid,
@ -588,6 +588,18 @@ const footerClass = computed(() => {
return classes
})
//
const changeNowStatus = (e:any)=>{
console.log('收到数据',e);
if(e!=nowStatus.value){
switch(e){
case 'playing': nowStatus.value = 'record';break;
case 'loding': nowStatus.value = 'loding';break;
default: nowStatus.value = 'input';break;
}
}
}
onMounted(() => {
scrollToBottom()
if (inputRef.value && !isMobile.value)
@ -606,9 +618,9 @@ window.addEventListener('test', (e) => {
prompt.value = window.winText
})
// setTimeout(() => {
// nowStart.value = false
// }, 800)
setTimeout(() => {
nowStart.value = false
}, 800)
</script>
<template>
@ -669,6 +681,7 @@ window.addEventListener('test', (e) => {
:inversion="item.inversion"
:error="item.error"
:loading="item.loading"
@changeNowStatus="changeNowStatus"
@regenerate="onRegenerate(index)"
@delete="handleDelete(index)"
/>