feat: 尝试增加一下聊天里面的语音转文字功能

This commit is contained in:
xuncha
2026-01-17 05:14:14 +08:00
parent 095c8f0db6
commit 72e2d82158
18 changed files with 999 additions and 66 deletions

View File

@@ -15,6 +15,7 @@ import { groupAnalyticsService } from './services/groupAnalyticsService'
import { annualReportService } from './services/annualReportService'
import { exportService, ExportOptions } from './services/exportService'
import { KeyService } from './services/keyService'
import { voiceTranscribeService } from './services/voiceTranscribeService'
// 配置自动更新
@@ -442,6 +443,10 @@ function registerIpcHandlers() {
return chatService.getVoiceData(sessionId, msgId)
})
ipcMain.handle('chat:getVoiceTranscript', async (_, sessionId: string, msgId: string) => {
return chatService.getVoiceTranscript(sessionId, msgId)
})
ipcMain.handle('chat:getMessageById', async (_, sessionId: string, localId: number) => {
return chatService.getMessageById(sessionId, localId)
})
@@ -516,6 +521,16 @@ function registerIpcHandlers() {
return { success: true }
})
ipcMain.handle('whisper:downloadModel', async (event, payload: { modelName: string; downloadDir?: string; source?: string }) => {
return voiceTranscribeService.downloadModel(payload, (progress) => {
event.sender.send('whisper:downloadProgress', progress)
})
})
ipcMain.handle('whisper:getModelStatus', async (_, payload: { modelName: string; downloadDir?: string }) => {
return voiceTranscribeService.getModelStatus(payload)
})
// 群聊分析相关
ipcMain.handle('groupAnalytics:getGroupChats', async () => {
return groupAnalyticsService.getGroupChats()