From 6208a16f4c614ca84164cdf90061e57d0724d3a8 Mon Sep 17 00:00:00 2001 From: df123 Date: Thu, 2 Oct 2025 22:14:34 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20=E5=AE=9E=E7=8E=B0=E6=89=B9?= =?UTF-8?q?=E9=87=8F=E7=BF=BB=E8=AF=91=E5=92=8C=E4=BC=98=E5=8C=96=E8=BF=9B?= =?UTF-8?q?=E5=BA=A6=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/FloatingBall.vue | 4 +- components/Main.vue | 68 +++++++ components/TranslationStatus.vue | 201 +++++++++++++++++---- entrypoints/background.ts | 9 +- entrypoints/main/trans.ts | 75 +++++++- entrypoints/utils/batchTranslation.ts | 251 ++++++++++++++++++++++++++ entrypoints/utils/model.ts | 4 + entrypoints/utils/option.ts | 4 +- entrypoints/utils/translateApi.ts | 7 +- entrypoints/utils/translateQueue.ts | 95 +++++++++- entrypoints/utils/translationStats.ts | 236 ++++++++++++++++++++++++ 11 files changed, 910 insertions(+), 44 deletions(-) create mode 100644 entrypoints/utils/batchTranslation.ts create mode 100644 entrypoints/utils/translationStats.ts diff --git a/components/FloatingBall.vue b/components/FloatingBall.vue index 706c45d..e66e15a 100644 --- a/components/FloatingBall.vue +++ b/components/FloatingBall.vue @@ -33,12 +33,12 @@
-
+
{{ shortcutTip }}
-
+
diff --git a/components/Main.vue b/components/Main.vue index a4f1bce..ec6e5a3 100644 --- a/components/Main.vue +++ b/components/Main.vue @@ -501,6 +501,43 @@ + + + + + 批量翻译 + + + + + + + + + + + + + + 批量翻译大小 + + + + + + +
建议范围:1024-32768字符
+
+
+ @@ -1048,6 +1085,30 @@ const handleConcurrentChange = (currentValue: number | undefined, oldValue: numb }); }; +// 处理批量翻译大小变化 +const handleBatchSizeChange = (currentValue: number | undefined, oldValue: number | undefined) => { + // 验证批量翻译大小的有效性 + if (currentValue === undefined || currentValue < 1024 || currentValue > 32768) { + ElMessage({ + message: '批量翻译大小必须在 1024-32768 字符之间', + type: 'warning', + duration: 2000 + }); + // 恢复默认值 + config.value.batchTranslationSize = 4096; + return; + } + + // 显示设置已更新的提示 + showRefreshTip.value = true; + + ElMessage({ + message: `批量翻译大小已更新为 ${currentValue} 字符`, + type: 'success', + duration: 2000 + }); +}; + // 显示刷新提示 const showRefreshTip = ref(false); @@ -1599,4 +1660,11 @@ const validateConfig = (configData: any): boolean => { margin-top: 4px; line-height: 1.4; } + +.input-hint { + color: var(--el-text-color-secondary); + font-size: 12px; + margin-top: 4px; + line-height: 1.4; +} diff --git a/components/TranslationStatus.vue b/components/TranslationStatus.vue index 3e6edb1..e3bba50 100644 --- a/components/TranslationStatus.vue +++ b/components/TranslationStatus.vue @@ -2,20 +2,41 @@
-
翻译进度
-
×
+
翻译进度
+
×
-
-
当前活跃任务:
-
{{ status.activeTranslations }} / {{ status.maxConcurrent }}
+ +
+
+
{{ Math.round(status.progressPercentage) }}%
+
+ 剩余: {{ formatRemainingTime(realTimeRemaining) }} +
+
+
+
+
-
-
等待中的任务:
-
{{ status.pendingTranslations }}
-
-
-
+ + +
+
+
当前活跃任务:
+
{{ status.activeTranslations }} / {{ status.maxConcurrent }}
+
+
+
等待中的任务:
+
{{ status.pendingTranslations }}
+
+
+
字符进度:
+
{{ formatNumber(status.completedCharacters) }} / {{ formatNumber(status.totalCharacters) }}
+
+
+
平均速度:
+
{{ status.averageSpeed }} 字符/秒
+
@@ -23,30 +44,60 @@