Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/deploy-doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Build docs using Writerside Docker builder
uses: JetBrains/writerside-github-action@v4
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
runs-on: ${{ matrix.os.image }}
steps:
- name: Github checkout
uses: actions/checkout@v4
uses: actions/checkout@v6
- name: Build whisper.cpp CLI (all platforms)
shell: bash
run: |
Expand Down Expand Up @@ -184,7 +184,7 @@ jobs:
fi
ls -la "${ARCHIVE}"
- name: Use Node.js
uses: actions/setup-node@v4
uses: actions/setup-node@v6
with:
node-version: 22.12.0
cache: yarn
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "dash-player",
"productName": "DashPlayer",
"version": "6.0.0",
"version": "6.0.1",
"description": "My Electron application description",
"main": ".vite/build/main.js",
"scripts": {
Expand Down
18 changes: 3 additions & 15 deletions src/backend/application/services/impl/TranslateServiceImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,16 +311,12 @@ export default class TranslateServiceImpl implements TranslateService {

const engine = await this.settingService.getCurrentTranslationProvider();
if (!engine) {
this.logger.error('没有启用的翻译服务');
this.logger.info('字幕翻译服务未启用,忽略本次翻译请求');
this.notifySubtitleTranslationFailed({
fileHash,
keys: requestedKeys,
provider: 'openai',
});
this.showSubtitleTranslationToast({
message: '未启用字幕翻译服务,请在设置中配置后重试',
dedupeKey: 'subtitle-translation:engine-not-enabled',
});
return;
}
const openAiMode: TranslationMode | null = engine === 'openai'
Expand Down Expand Up @@ -426,16 +422,12 @@ export default class TranslateServiceImpl implements TranslateService {
private async processTencentBatch(tasks: Sentence[], storageMode: SubtitleTranslationStorageMode): Promise<void> {
const currentProvider = await this.settingService.getCurrentTranslationProvider();
if (currentProvider !== 'tencent') {
this.logger.error('腾讯翻译服务未启用');
this.logger.info('腾讯字幕翻译服务已关闭,忽略本次翻译请求');
this.notifySubtitleTranslationFailed({
fileHash: tasks[0]?.fileHash ?? '',
keys: tasks.map((task) => task.translationKey),
provider: 'tencent',
});
this.showSubtitleTranslationToast({
message: '腾讯字幕翻译未启用,请检查设置',
dedupeKey: 'subtitle-translation:tencent-not-enabled',
});
return;
}

Expand Down Expand Up @@ -527,17 +519,13 @@ export default class TranslateServiceImpl implements TranslateService {
): Promise<void> {
const currentProvider = await this.settingService.getCurrentTranslationProvider();
if (currentProvider !== 'openai') {
this.logger.error('OpenAI 翻译服务未启用');
this.logger.info('OpenAI 字幕翻译服务已关闭,忽略本次翻译请求');
this.notifySubtitleTranslationFailed({
fileHash: tasks[0]?.fileHash ?? '',
keys: tasks.map((task) => task.translationKey),
provider: 'openai',
mode: openAiMode,
});
this.showSubtitleTranslationToast({
message: 'OpenAI 字幕翻译未启用,请检查设置',
dedupeKey: 'subtitle-translation:openai-not-enabled',
});
return;
}

Expand Down
16 changes: 15 additions & 1 deletion src/fronted/hooks/useTranslation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ const useTranslation = create(
}

const state = get();
if (state.engine === 'none') {
return;
}

const fileHash = sentences[0]?.fileHash;

if (!fileHash) {
Expand Down Expand Up @@ -173,8 +177,18 @@ const useTranslation = create(
});
},

// 强制重新翻译
/**
* 强制重新翻译指定字幕句。
*
* @param fileHash 当前字幕文件哈希。
* @param indices 需要重新翻译的字幕索引列表。
* @param useCache 是否允许使用已有缓存,默认强制请求新结果。
*/
retranslate: (fileHash: string, indices: number[], useCache = false) => {
if (get().engine === 'none') {
return;
}

set(state => {
const newStatus = new Map(state.translationStatus);
indices.forEach((index) => {
Expand Down