Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
C
CharIP-Electron
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ali
CharIP-Electron
Commits
3d9e9744
Commit
3d9e9744
authored
Nov 29, 2023
by
ali
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: vosk 配置提前加载
parent
0aff8cf0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
12 deletions
+21
-12
HeaderLayout.vue
src/renderer/components/layout/HeaderLayout.vue
+19
-9
ShowPhoto.vue
src/renderer/screens/ShowPhoto.vue
+0
-3
settings.ts
src/renderer/store/settings.ts
+2
-0
No files found.
src/renderer/components/layout/HeaderLayout.vue
View file @
3d9e9744
...
@@ -101,6 +101,14 @@ changeVoskModel();
...
@@ -101,6 +101,14 @@ changeVoskModel();
required
required
></v-select>
></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'"
>
<template
v-if=
"asrSelect === 'vosk_asr'"
>
<v-select
<v-select
v-model=
"setting.voskSelectModel.value"
v-model=
"setting.voskSelectModel.value"
...
@@ -113,6 +121,17 @@ changeVoskModel();
...
@@ -113,6 +121,17 @@ changeVoskModel();
></v-select>
></v-select>
</
template
>
</
template
>
<
template
v-if=
"setting.tts.value === 'xf_tts'"
>
<v-select
v-model=
"setting.selectSource.value"
:items=
"source"
:rules=
"[(v) => !!v || '请选择音色']"
label=
"TTS 音色"
required
@
update:model-value=
"changeSource"
></v-select>
</
template
>
<v-text-field
<v-text-field
label=
"TTS 域名"
label=
"TTS 域名"
:rules=
"[(value) => !!value || 'TTS 域名必填']"
:rules=
"[(value) => !!value || 'TTS 域名必填']"
...
@@ -120,15 +139,6 @@ changeVoskModel();
...
@@ -120,15 +139,6 @@ changeVoskModel();
:model-value=
"setting.ttsHost"
:model-value=
"setting.ttsHost"
></v-text-field>
></v-text-field>
<v-select
v-model=
"setting.selectSource.value"
class=
"mt-6"
:items=
"source"
:rules=
"[(v) => !!v || '请选择音色']"
label=
"TTS 音色"
required
@
update:model-value=
"changeSource"
></v-select>
<v-switch
<v-switch
v-model=
"setting.isFullscreen.value"
v-model=
"setting.isFullscreen.value"
...
...
src/renderer/screens/ShowPhoto.vue
View file @
3d9e9744
...
@@ -24,11 +24,9 @@ router.beforeEach((g) => {
...
@@ -24,11 +24,9 @@ router.beforeEach((g) => {
const
microphoneState
=
ref
<
'waitInput'
|
'input'
|
'loading'
|
'disabled'
>
(
'waitInput'
)
const
microphoneState
=
ref
<
'waitInput'
|
'input'
|
'loading'
|
'disabled'
>
(
'waitInput'
)
async
function
initVosk
({
async
function
initVosk
({
modelPath
,
result
,
result
,
partialResult
partialResult
}:
{
}:
{
modelPath
:
string
result
?:
(
string
)
=>
void
result
?:
(
string
)
=>
void
partialResult
?:
(
string
)
=>
void
partialResult
?:
(
string
)
=>
void
})
{
})
{
...
@@ -102,7 +100,6 @@ async function startAudioInput() {
...
@@ -102,7 +100,6 @@ async function startAudioInput() {
microphoneState
.
value
=
'loading'
microphoneState
.
value
=
'loading'
const
{
recognizer
,
channel
}
=
await
initVosk
({
const
{
recognizer
,
channel
}
=
await
initVosk
({
modelPath
:
`https://resources.laihua.com/2023-11-29/
${
settings
.
voskSelectModel
}
`
,
result
:
async
(
text
)
=>
{
result
:
async
(
text
)
=>
{
console
.
log
(
'----------------> text:'
,
text
)
console
.
log
(
'----------------> text:'
,
text
)
const
tone
=
settings
.
source
.
find
(({
sourceId
})
=>
settings
.
selectSource
===
sourceId
)
const
tone
=
settings
.
source
.
find
(({
sourceId
})
=>
settings
.
selectSource
===
sourceId
)
...
...
src/renderer/store/settings.ts
View file @
3d9e9744
...
@@ -10,6 +10,7 @@ export type ISettings = {
...
@@ -10,6 +10,7 @@ export type ISettings = {
asr
:
'vosk_asr'
|
'xf_asr'
asr
:
'vosk_asr'
|
'xf_asr'
voskModels
:
string
[]
voskModels
:
string
[]
voskSelectModel
:
string
voskSelectModel
:
string
tts
:
'xf_tts'
|
'local_tts'
,
ttsHost
:
string
ttsHost
:
string
source
:
{
source
:
{
sourceName
:
string
sourceName
:
string
...
@@ -28,6 +29,7 @@ const useSettingsStore = defineStore('settings', {
...
@@ -28,6 +29,7 @@ const useSettingsStore = defineStore('settings', {
state
:
()
=>
state
:
()
=>
({
({
asr
:
'vosk_asr'
,
asr
:
'vosk_asr'
,
tts
:
'xf_tts'
,
voskModels
:
[
voskModels
:
[
'vosk-model-small-ca-0.4.tar.gz'
,
'vosk-model-small-ca-0.4.tar.gz'
,
'vosk-model-small-cn-0.3.tar.gz'
,
'vosk-model-small-cn-0.3.tar.gz'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment