This commit is contained in:
parent
92d1685688
commit
1df3187214
8
index.js
8
index.js
|
@ -211,3 +211,11 @@ function RecordXunfei() {
|
||||||
recorder.stop()
|
recorder.stop()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 重新录制
|
||||||
|
function reRecordXunfei() {
|
||||||
|
if (btnStatus === 'CONNECTING' || btnStatus === 'OPEN') {
|
||||||
|
console.log('重新录制')
|
||||||
|
connectWebSocket()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 572 KiB |
Binary file not shown.
After Width: | Height: | Size: 567 KiB |
Binary file not shown.
After Width: | Height: | Size: 572 KiB |
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.box {
|
.box {
|
||||||
width: 22em;
|
width: 24em;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
border-radius: 20px;
|
border-radius: 20px;
|
||||||
/* background-color: rgba(97, 161, 140, 0.3); */
|
/* background-color: rgba(97, 161, 140, 0.3); */
|
||||||
|
|
|
@ -15,7 +15,7 @@ export interface UserState {
|
||||||
export function defaultSetting(): UserState {
|
export function defaultSetting(): UserState {
|
||||||
return {
|
return {
|
||||||
userInfo: {
|
userInfo: {
|
||||||
avatar: 'https://raw.githubusercontent.com/Chanzhaoyu/chatgpt-web/main/src/assets/avatar.jpg',
|
avatar: 'public/ai.png',
|
||||||
name: 'ChenZhaoYu',
|
name: 'ChenZhaoYu',
|
||||||
description: 'Star on <a href="https://github.com/Chanzhaoyu/chatgpt-bot" class="text-blue-500" target="_blank" >GitHub</a>',
|
description: 'Star on <a href="https://github.com/Chanzhaoyu/chatgpt-bot" class="text-blue-500" target="_blank" >GitHub</a>',
|
||||||
},
|
},
|
||||||
|
|
|
@ -20,9 +20,12 @@ const avatar = computed(() => userStore.userInfo.avatar)
|
||||||
<NAvatar v-if="isString(avatar) && avatar.length > 0" :src="avatar" :fallback-src="defaultAvatar" />
|
<NAvatar v-if="isString(avatar) && avatar.length > 0" :src="avatar" :fallback-src="defaultAvatar" />
|
||||||
<NAvatar v-else round :src="defaultAvatar" />
|
<NAvatar v-else round :src="defaultAvatar" />
|
||||||
</template>
|
</template>
|
||||||
<span v-else class="text-[28px] dark:text-white">
|
<template v-else>
|
||||||
|
<NAvatar src="public/avatar.png" :fallback-src="defaultAvatar" />
|
||||||
|
</template>
|
||||||
|
<!-- <span v-else class="text-[28px] dark:text-white">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" aria-hidden="true" width="1em" height="1em">
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" aria-hidden="true" width="1em" height="1em">
|
||||||
<path d="M29.71,13.09A8.09,8.09,0,0,0,20.34,2.68a8.08,8.08,0,0,0-13.7,2.9A8.08,8.08,0,0,0,2.3,18.9,8,8,0,0,0,3,25.45a8.08,8.08,0,0,0,8.69,3.87,8,8,0,0,0,6,2.68,8.09,8.09,0,0,0,7.7-5.61,8,8,0,0,0,5.33-3.86A8.09,8.09,0,0,0,29.71,13.09Zm-12,16.82a6,6,0,0,1-3.84-1.39l.19-.11,6.37-3.68a1,1,0,0,0,.53-.91v-9l2.69,1.56a.08.08,0,0,1,.05.07v7.44A6,6,0,0,1,17.68,29.91ZM4.8,24.41a6,6,0,0,1-.71-4l.19.11,6.37,3.68a1,1,0,0,0,1,0l7.79-4.49V22.8a.09.09,0,0,1,0,.08L13,26.6A6,6,0,0,1,4.8,24.41ZM3.12,10.53A6,6,0,0,1,6.28,7.9v7.57a1,1,0,0,0,.51.9l7.75,4.47L11.85,22.4a.14.14,0,0,1-.09,0L5.32,18.68a6,6,0,0,1-2.2-8.18Zm22.13,5.14-7.78-4.52L20.16,9.6a.08.08,0,0,1,.09,0l6.44,3.72a6,6,0,0,1-.9,10.81V16.56A1.06,1.06,0,0,0,25.25,15.67Zm2.68-4-.19-.12-6.36-3.7a1,1,0,0,0-1.05,0l-7.78,4.49V9.2a.09.09,0,0,1,0-.09L19,5.4a6,6,0,0,1,8.91,6.21ZM11.08,17.15,8.38,15.6a.14.14,0,0,1-.05-.08V8.1a6,6,0,0,1,9.84-4.61L18,3.6,11.61,7.28a1,1,0,0,0-.53.91ZM12.54,14,16,12l3.47,2v4L16,20l-3.47-2Z" fill="currentColor" />
|
<path d="M29.71,13.09A8.09,8.09,0,0,0,20.34,2.68a8.08,8.08,0,0,0-13.7,2.9A8.08,8.08,0,0,0,2.3,18.9,8,8,0,0,0,3,25.45a8.08,8.08,0,0,0,8.69,3.87,8,8,0,0,0,6,2.68,8.09,8.09,0,0,0,7.7-5.61,8,8,0,0,0,5.33-3.86A8.09,8.09,0,0,0,29.71,13.09Zm-12,16.82a6,6,0,0,1-3.84-1.39l.19-.11,6.37-3.68a1,1,0,0,0,.53-.91v-9l2.69,1.56a.08.08,0,0,1,.05.07v7.44A6,6,0,0,1,17.68,29.91ZM4.8,24.41a6,6,0,0,1-.71-4l.19.11,6.37,3.68a1,1,0,0,0,1,0l7.79-4.49V22.8a.09.09,0,0,1,0,.08L13,26.6A6,6,0,0,1,4.8,24.41ZM3.12,10.53A6,6,0,0,1,6.28,7.9v7.57a1,1,0,0,0,.51.9l7.75,4.47L11.85,22.4a.14.14,0,0,1-.09,0L5.32,18.68a6,6,0,0,1-2.2-8.18Zm22.13,5.14-7.78-4.52L20.16,9.6a.08.08,0,0,1,.09,0l6.44,3.72a6,6,0,0,1-.9,10.81V16.56A1.06,1.06,0,0,0,25.25,15.67Zm2.68-4-.19-.12-6.36-3.7a1,1,0,0,0-1.05,0l-7.78,4.49V9.2a.09.09,0,0,1,0-.09L19,5.4a6,6,0,0,1,8.91,6.21ZM11.08,17.15,8.38,15.6a.14.14,0,0,1-.05-.08V8.1a6,6,0,0,1,9.84-4.61L18,3.6,11.61,7.28a1,1,0,0,0-.53.91ZM12.54,14,16,12l3.47,2v4L16,20l-3.47-2Z" fill="currentColor" />
|
||||||
</svg>
|
</svg>
|
||||||
</span>
|
</span> -->
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -165,11 +165,12 @@ const watchTTS = watch(() => props.tts, async (n: any, o: any) => {
|
||||||
// 停止播放音频
|
// 停止播放音频
|
||||||
const stopPlay = () => {
|
const stopPlay = () => {
|
||||||
console.log('停止播放音频')
|
console.log('停止播放音频')
|
||||||
|
watchTTS()
|
||||||
audioElements.forEach((item: any) => {
|
audioElements.forEach((item: any) => {
|
||||||
item.pause()
|
item.pause()
|
||||||
item.currentTime = 0
|
item.currentTime = 0
|
||||||
})
|
})
|
||||||
|
audioElements.length = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
onUpdated(() => {
|
onUpdated(() => {
|
||||||
|
|
|
@ -33,7 +33,7 @@ import playing from '@/components/animation/playing.vue'
|
||||||
|
|
||||||
// let socket = new WebSocket("wss://chat.lihaink.cn/chat");
|
// let socket = new WebSocket("wss://chat.lihaink.cn/chat");
|
||||||
|
|
||||||
const maxWeight = ref(2500)
|
const maxWeight = ref(1200)
|
||||||
|
|
||||||
const messageRef = ref(null)
|
const messageRef = ref(null)
|
||||||
|
|
||||||
|
@ -102,21 +102,25 @@ const endOrder = () => {
|
||||||
|
|
||||||
const reOrder = () => {
|
const reOrder = () => {
|
||||||
if (recordFalg.value == 1) {
|
if (recordFalg.value == 1) {
|
||||||
RecordXunfei() // 结束
|
// RecordXunfei() // 结束
|
||||||
recordFalg.value = 0
|
recordFalg.value = 0
|
||||||
nowStatus.value = 'run'
|
nowStatus.value = 'run'
|
||||||
prompt.value = ''
|
prompt.value = ''
|
||||||
if (messageRef.value?.length > 0)
|
if (messageRef.value?.length > 0)
|
||||||
messageRef.value[messageRef.value.length - 1].stopPlay()
|
messageRef.value[messageRef.value.length - 1].stopPlay()
|
||||||
setTimeout(() => {
|
// setTimeout(() => {
|
||||||
prompt.value = ''
|
// prompt.value = ''
|
||||||
RecordXunfei() // 重新开始
|
// RecordXunfei() // 重新开始
|
||||||
setTimeout(() => {
|
// setTimeout(() => {
|
||||||
|
// prompt.value = ''
|
||||||
|
// recordFalg.value = 1
|
||||||
|
// nowStatus.value = 'record'
|
||||||
|
// }, 500)
|
||||||
|
// }, 2500)
|
||||||
|
reRecordXunfei()
|
||||||
prompt.value = ''
|
prompt.value = ''
|
||||||
recordFalg.value = 1
|
recordFalg.value = 1
|
||||||
nowStatus.value = 'record'
|
nowStatus.value = 'record'
|
||||||
}, 500)
|
|
||||||
}, 2500)
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
console.log('无效指令')
|
console.log('无效指令')
|
||||||
|
@ -764,9 +768,9 @@ window.addEventListener('test', (e) => {
|
||||||
prompt.value = window.winText
|
prompt.value = window.winText
|
||||||
})
|
})
|
||||||
|
|
||||||
setTimeout(() => {
|
// setTimeout(() => {
|
||||||
nowStart.value = false
|
// nowStart.value = false
|
||||||
}, 800)
|
// }, 800)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -827,7 +831,7 @@ setTimeout(() => {
|
||||||
:date-time="item.dateTime"
|
:date-time="item.dateTime"
|
||||||
:text="item.text"
|
:text="item.text"
|
||||||
:tts="item.tts"
|
:tts="item.tts"
|
||||||
:autoplay="index % 2 === 0 ? false : true"
|
:autoplay="dataSources.length - 1 === index"
|
||||||
:inversion="item.inversion"
|
:inversion="item.inversion"
|
||||||
:error="item.error"
|
:error="item.error"
|
||||||
:loading="item.loading"
|
:loading="item.loading"
|
||||||
|
|
Loading…
Reference in New Issue