Commit c4dd0a91 authored by ali's avatar ali

feat: vosk asr 加载模型

parent fb08372c
......@@ -8,13 +8,12 @@ export default class IPCs {
static browserWindows: Map<string, BrowserWindow[]> = new Map()
static initialize(window: BrowserWindow): void {
ipcMain.on('mesGetUserData', () => {
window.webContents.send('msgReceivedUserData', app.getPath('userData'));
window.webContents.send('msgReceivedUserData', app.getPath('userData'))
})
ipcMain.on('mesGetAppData', () => {
window.webContents.send('msgReceivedAppData', app.getPath('appData'));
window.webContents.send('msgReceivedAppData', app.getPath('appData'))
})
ipcMain.on('mesGetFilePath', () => {
......
......@@ -10,7 +10,12 @@ const mainAvailChannels: string[] = [
'mesGetUserData',
'mesGetAppData'
]
const rendererAvailChannels: string[] = ['msgReceivedVersion', 'msgReceivedFilePath', 'msgReceivedUserData', 'msgReceivedAppData']
const rendererAvailChannels: string[] = [
'msgReceivedVersion',
'msgReceivedFilePath',
'msgReceivedUserData',
'msgReceivedAppData'
]
contextBridge.exposeInMainWorld('mainApi', {
send: (channel: string, ...data: any[]): void => {
......
......@@ -7,8 +7,7 @@ const router = useRouter()
const isHeader = ref(true)
router.beforeEach((to) => {
isHeader.value =
typeof to.meta.isHeader === 'boolean' ? (to.meta.isHeader as boolean) : true
isHeader.value = typeof to.meta.isHeader === 'boolean' ? (to.meta.isHeader as boolean) : true
})
</script>
......
......@@ -12,7 +12,7 @@ const setting = storeToRefs(settings)
settings.tts === 'xf_tts' && settings.getSource()
function init(){
function init() {
window.mainApi.send('mesGetFilePath')
window.mainApi.receive('msgReceivedFilePath', (event: Event, path: string) => {
setting.filePath.value = path
......@@ -27,8 +27,8 @@ function init(){
window.mainApi.receive('msgReceivedAppData', (event: Event, path: string) => {
setting.appData.value = path
})
};
init();
}
init()
const handleRoute = (path: string): void => {
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[]) {
const res = await localTTS({ url: settings.ttsHost, text: task })
console.log('----------------> TTS:', res)
console.timeEnd(task + ' TTS: ')
console.log('---------------->', ttsAudios);
console.log('---------------->', ttsAudios)
}
} catch (error) {
console.error(error)
......
......@@ -78,7 +78,7 @@ const useSettingsStore = defineStore('settings', {
}
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)
......
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