refactor(main): 重构字幕引擎启动和错误处理逻辑

- 修改了字幕引擎的启动条件,增加了对环境变量和自定义应用的检查
- 优化了错误处理机制,通过控制窗口发送错误消息
- 在前端增加了错误通知功能
This commit is contained in:
himeditator
2025-06-26 18:59:53 +08:00
parent c086725d98
commit 147e328d8c
3 changed files with 133 additions and 91 deletions

View File

@@ -1,6 +1,9 @@
import { ref } from 'vue'
import { defineStore } from 'pinia'
import { notification } from 'ant-design-vue'
import { ExclamationCircleOutlined } from '@ant-design/icons-vue'
import { h } from 'vue'
export const useCaptionControlStore = defineStore('captionControl', () => {
const captionEngine = ref([
@@ -109,6 +112,16 @@ export const useCaptionControlStore = defineStore('captionControl', () => {
});
})
window.electron.ipcRenderer.on('control.error.send', (_, message) => {
notification.open({
message: '发生错误',
description: message,
duration: null,
placement: 'topLeft',
icon: () => h(ExclamationCircleOutlined, { style: 'color: #ff4d4f' })
});
})
return {
captionEngine, // 字幕引擎
audioType, // 音频类型