import { ipcMain } from 'electron' import { DEFINE_STRING } from '../../define/define_string' import { LOGGER_DEFINE } from '../../define/logger_define' import { TTS } from '../Service/tts' const tts = new TTS() export function TTSIpc() { // 获取当前的TTS配置数据 ipcMain.handle(DEFINE_STRING.TTS.GET_TTS_CONFIG, async () => await tts.GetTTSCOnfig()) // 保存TTS配置 ipcMain.handle( DEFINE_STRING.TTS.SAVE_TTS_CONFIG, async (event, data) => await tts.SaveTTSConfig(data) ) // 生成音频 ipcMain.handle( DEFINE_STRING.TTS.GENERATE_AUDIO, async (event, text) => await tts.GenerateAudio(text) ) // 生成SRT字幕文件 ipcMain.handle( DEFINE_STRING.TTS.GENERATE_SRT, async (event, ttsId) => await tts.GenerateSRT(ttsId) ) // 删除配音历史记录 ipcMain.handle( DEFINE_STRING.TTS.DELETE_TTS_HISTORY, async (event, ttsId) => await tts.DeleteTTSHistory(ttsId) ) // 获取配音的历史记录 ipcMain.handle( DEFINE_STRING.TTS.GET_TTS_HISTORY_DATA, async (event, queryCondition) => await tts.GetTTSHistoryData(queryCondition) ) ipcMain.handle( DEFINE_STRING.TTS.GET_TTS_OPTIONS, async (event, key) => await tts.GetTTSOptions(key)) }