Commit c4dd0a91 authored by ali's avatar ali

feat: vosk asr 加载模型

parent fb08372c
...@@ -8,13 +8,12 @@ export default class IPCs { ...@@ -8,13 +8,12 @@ export default class IPCs {
static browserWindows: Map<string, BrowserWindow[]> = new Map() static browserWindows: Map<string, BrowserWindow[]> = new Map()
static initialize(window: BrowserWindow): void { static initialize(window: BrowserWindow): void {
ipcMain.on('mesGetUserData', () => { ipcMain.on('mesGetUserData', () => {
window.webContents.send('msgReceivedUserData', app.getPath('userData')); window.webContents.send('msgReceivedUserData', app.getPath('userData'))
}) })
ipcMain.on('mesGetAppData', () => { ipcMain.on('mesGetAppData', () => {
window.webContents.send('msgReceivedAppData', app.getPath('appData')); window.webContents.send('msgReceivedAppData', app.getPath('appData'))
}) })
ipcMain.on('mesGetFilePath', () => { ipcMain.on('mesGetFilePath', () => {
......
...@@ -10,7 +10,12 @@ const mainAvailChannels: string[] = [ ...@@ -10,7 +10,12 @@ const mainAvailChannels: string[] = [
'mesGetUserData', 'mesGetUserData',
'mesGetAppData' 'mesGetAppData'
] ]
const rendererAvailChannels: string[] = ['msgReceivedVersion', 'msgReceivedFilePath', 'msgReceivedUserData', 'msgReceivedAppData'] const rendererAvailChannels: string[] = [
'msgReceivedVersion',
'msgReceivedFilePath',
'msgReceivedUserData',
'msgReceivedAppData'
]
contextBridge.exposeInMainWorld('mainApi', { contextBridge.exposeInMainWorld('mainApi', {
send: (channel: string, ...data: any[]): void => { send: (channel: string, ...data: any[]): void => {
......
...@@ -7,8 +7,7 @@ const router = useRouter() ...@@ -7,8 +7,7 @@ const router = useRouter()
const isHeader = ref(true) const isHeader = ref(true)
router.beforeEach((to) => { router.beforeEach((to) => {
isHeader.value = isHeader.value = typeof to.meta.isHeader === 'boolean' ? (to.meta.isHeader as boolean) : true
typeof to.meta.isHeader === 'boolean' ? (to.meta.isHeader as boolean) : true
}) })
</script> </script>
......
...@@ -12,7 +12,7 @@ const setting = storeToRefs(settings) ...@@ -12,7 +12,7 @@ const setting = storeToRefs(settings)
settings.tts === 'xf_tts' && settings.getSource() settings.tts === 'xf_tts' && settings.getSource()
function init(){ function init() {
window.mainApi.send('mesGetFilePath') window.mainApi.send('mesGetFilePath')
window.mainApi.receive('msgReceivedFilePath', (event: Event, path: string) => { window.mainApi.receive('msgReceivedFilePath', (event: Event, path: string) => {
setting.filePath.value = path setting.filePath.value = path
...@@ -27,8 +27,8 @@ function init(){ ...@@ -27,8 +27,8 @@ function init(){
window.mainApi.receive('msgReceivedAppData', (event: Event, path: string) => { window.mainApi.receive('msgReceivedAppData', (event: Event, path: string) => {
setting.appData.value = path setting.appData.value = path
}) })
}; }
init(); init()
const handleRoute = (path: string): void => { const handleRoute = (path: string): void => {
router.push(path) router.push(path)
......
This diff is collapsed.
The Developer of the ASR models is Alpha Cephei Inc (https://alphacephei.com/e).
Copyright 2019 Alpha Cephei Inc. All Rights Reserved.
\ No newline at end of file
...@@ -314,7 +314,7 @@ async function runTTSTask(tasks: string[]) { ...@@ -314,7 +314,7 @@ async function runTTSTask(tasks: string[]) {
const res = await localTTS({ url: settings.ttsHost, text: task }) const res = await localTTS({ url: settings.ttsHost, text: task })
console.log('----------------> TTS:', res) console.log('----------------> TTS:', res)
console.timeEnd(task + ' TTS: ') console.timeEnd(task + ' TTS: ')
console.log('---------------->', ttsAudios); console.log('---------------->', ttsAudios)
} }
} catch (error) { } catch (error) {
console.error(error) console.error(error)
......
...@@ -78,7 +78,7 @@ const useSettingsStore = defineStore('settings', { ...@@ -78,7 +78,7 @@ const useSettingsStore = defineStore('settings', {
} }
const model = await Vosk.createModel( const model = await Vosk.createModel(
`https://resources.laihua.com/2023-11-29/${this.$state.voskSelectModel}` `${this.$state.filePath}./../vosk/models/${this.$state.voskSelectModel}`
) )
voskModelMap.set(this.$state.voskSelectModel, model) voskModelMap.set(this.$state.voskSelectModel, model)
......
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