Commit 3d9e9744 authored by ali's avatar ali

feat: vosk 配置提前加载

parent 0aff8cf0
......@@ -101,6 +101,14 @@ changeVoskModel();
required
></v-select>
<v-select
v-model="setting.tts.value"
:items="['xf_tts', 'local_tts']"
:rules="[(v) => !!v || '请选择 TTS']"
label="文字转语音(TTS)"
required
></v-select>
<template v-if="asrSelect === 'vosk_asr'">
<v-select
v-model="setting.voskSelectModel.value"
......@@ -113,22 +121,24 @@ changeVoskModel();
></v-select>
</template>
<v-text-field
label="TTS 域名"
:rules="[(value) => !!value || 'TTS 域名必填']"
hide-details="auto"
:model-value="setting.ttsHost"
></v-text-field>
<template v-if="setting.tts.value === 'xf_tts'">
<v-select
v-model="setting.selectSource.value"
class="mt-6"
:items="source"
:rules="[(v) => !!v || '请选择音色']"
label="TTS 音色"
required
@update:model-value="changeSource"
></v-select>
</template>
<v-text-field
label="TTS 域名"
:rules="[(value) => !!value || 'TTS 域名必填']"
hide-details="auto"
:model-value="setting.ttsHost"
></v-text-field>
<v-switch
v-model="setting.isFullscreen.value"
......
......@@ -24,11 +24,9 @@ router.beforeEach((g) => {
const microphoneState = ref<'waitInput' | 'input' | 'loading' | 'disabled'>('waitInput')
async function initVosk({
modelPath,
result,
partialResult
}: {
modelPath: string
result?: (string) => void
partialResult?: (string) => void
}) {
......@@ -102,7 +100,6 @@ async function startAudioInput() {
microphoneState.value = 'loading'
const { recognizer, channel } = await initVosk({
modelPath: `https://resources.laihua.com/2023-11-29/${settings.voskSelectModel}`,
result: async (text) => {
console.log('----------------> text:', text)
const tone = settings.source.find(({ sourceId }) => settings.selectSource === sourceId)
......
......@@ -10,6 +10,7 @@ export type ISettings = {
asr: 'vosk_asr' | 'xf_asr'
voskModels: string[]
voskSelectModel: string
tts: 'xf_tts' | 'local_tts',
ttsHost: string
source: {
sourceName: string
......@@ -28,6 +29,7 @@ const useSettingsStore = defineStore('settings', {
state: () =>
({
asr: 'vosk_asr',
tts: 'xf_tts',
voskModels: [
'vosk-model-small-ca-0.4.tar.gz',
'vosk-model-small-cn-0.3.tar.gz',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment