feat(vosk): 为 Vosk 模型添加非实时翻译功能 (#14)

- 添加 Ollama 大模型翻译和 Google 翻译(非实时),支持多种语言
- 为 Vosk 引擎添加非实时翻译
- 为新增的翻译功能添加和修改接口
- 修改 Electron 构建配置,之后不同平台构建无需修改构建文件
This commit is contained in:
himeditator
2025-09-02 23:19:53 +08:00
parent 56fdc348f8
commit 14987cbfc5
16 changed files with 176 additions and 61 deletions

View File

@@ -58,6 +58,18 @@ Electron 主进程通过 TCP Socket 向 Python 进程发送数据。发送的数
Python 端监听到的音频流转换为的字幕数据。
### `translation`
```js
{
command: "translation",
time_s: string,
translation: string
}
```
语音识别的内容的翻译,可以根据起始时间确定对应的字幕。
### `print`
```js
@@ -67,7 +79,7 @@ Python 端监听到的音频流转换为的字幕数据。
}
```
输出 Python 端打印的内容。
输出 Python 端打印的内容,不计入日志
### `info`
@@ -78,7 +90,7 @@ Python 端监听到的音频流转换为的字幕数据。
}
```
Python 端打印的提示信息,比起 `print`,该信息更希望 Electron 端的关注
Python 端打印的提示信息,会计入日志
### `error`