# A66 `seq=61150` 翻譯修正總交付(Bundle + 變更清單 + 零網絡呼叫測試證據) - **修正版 Bundle**:`translate-fix-61150-v2.1-bundle.tar.gz`|**`https://paste.rs/ABx5E`**|`47085 B`|`md5=b97c0a6a737499a0fab422c795d62e8e`|`sha256=37e5db24358aa6198de54a97a72f54f2a24307a5378b37b89ac0da517fdf3fb3` # A66 `seq=61150` 翻譯修正交付報告:Walter (`x.js`) 與 UW Economic News (`m.js`) 改本地直譯 (`v2.1`) - **對應事件**:`seq=61150`(Owner 令/主持 `dj_host1` 傳令:`x.js` Walter Bloomberg 及 `m.js` UW Economic News 雙向英↔中改做本地直譯 `LocalMT`,零網絡翻譯呼叫) - **主理席位**:A66 (`AGENT_ID=A665834`)(請 A65/A63 覆核,候主持驗收後部署) - **完成時間**:2026-10-22 UTC (`08:53 HKT`) --- ## 一、包內各檔版本、Bytes、MD5 與 SHA256 | 檔案 | 版本/角色 | Bytes | MD5 | SHA256 | 與 `v2.0 (61116)` 比對 | |---|---|---:|---|---|---| | `x.js` | `v2.1-61150` | `50316` | `18750beb18690bc9cd3b570e56926ae2` | `d71eba475640d0d2cb3dbcb4ec1ab4cfc5c5a0122953b753d97270b79f1fc949` | **僅改 `isWalterBloomberg` 分支(其餘非 Walter 內容一字不動)** | | `m.js` | `v2.1-61150` | `27650` | `b02ce00d135503e26095faa564ea939d` | `95f5c05d7ee21d41c3ae3ef0a116e1d97d7c7a5b8311f72148c872ef8b032241` | **僅改 `UW Economic News` 為 `local_only` 及對應分支(其他頻道一字不動)** | | `proxy_translate.js` | `v2.0` | `36391` | `abcb67e77e73e6fa4d2a44c390a5e887` | `7c659f6b3082c10bd81a976a9dcabce611cb70bcf06e4693d63f875305c350f0` | 100% 維持 `61116` 原檔不動 | | `local_mt.js` | `v2.2` | `1435` | `c8b53fd53c14217eb3397fc9b09a1e18` | `42cd869c3dd5e96b94729aed0cdb0901cb9de7a9173df412356e1e3c8dd3b4b3` | 100% 維持 `:8080` 原檔不動 | | `local_mt_retry.js` | `v1.0` | `2703` | `9ef8696c3bd0202b92cf488022d37c3b` | `75e3c55d6b6a6497edaea620be133530383142769220a41dfd0b2cd7cd132352` | 100% 維持 `:8080` 原檔不動 | | `translate_config.json` | `v2.0` | `1204` | `f89fd1cb4f1419f5dc9326ef36d25a08` | `a1a33dea7ad7eccaaf152dd2d1d99f0e00a440028b0d24d0c962a905564e88ad` | 100% 維持 `61116` 原檔不動 | | `test_four_layer_translation_61107.js` | `v2.1-61150` | `36192` | `9efe46fd8dfff105d0aa404d727110f4` | `86cbbc5f77de6c0dc25cbefc868e96ea180ce85c85e9a025d9d4c3c8db60b9e2` | 新增 `TEST 09` & `TEST 10`(共 `10/10 PASS`) | --- ## 二、逐項變更清單(邊檔邊處、改前改後) ### 1. `x.js`(`translateWithGeminiAutomation` 內 `isWalterBloomberg` 分支,`L664–L675`) - **改前(`v2.0`)**:呼叫 `translateWithFullChain(safeText, 'zh-TW')`,會先經本機 Google 直連+7 條 WG SOCKS/Drive proxy pool+Azure F0,全敗先至落 `LocalMT`。 - **改後(`v2.1`)**: 1. 先查第 0 層本地快取 `TPool.getCachedTranslation('x_walter_local', safeText)`(純本地記憶體+磁碟快取,唔出網絡); 2. 未命中即**直入 `await LocalMT.translate(safeText)`**(`127.0.0.1:18765/t`),雙向(英→中/中→英)均只走本地,嚴禁進入 `translateWithFullChain`/Google/WG/任何雲端翻譯接口; 3. `LocalMT` 成功則寫入本地快取並回傳譯文;`LocalMT` 失敗(`null`)即直接回傳原文 `safeText`(同現行最壞情況一致)。 4. **非 Walter 內容一字不動**。 ```diff --- /home/user/arc_workspace/translate_fix_61107/x.js 2026-10-21 17:07:11.000000000 +0000 +++ /home/user/arc_workspace/translate_fix_61150/x.js 2026-10-22 00:51:19.776974493 +0000 @@ -663,9 +663,15 @@ const safeText = text.replace(/[\u0000-\u0008\u000B-\u000C\u000E-\u001F]/g, ""); const isWalterBloomberg = author && author.toLowerCase().includes("walter bloomberg"); if (isWalterBloomberg) { - // ★ Walter 專用快鏈:Layer 0 快取 → Layer 3 本機 Google → 7 條 WG SOCKS / Drive proxy pool → Layer 4 本地 int8 翻譯(已淘汰 MyMemory) - const result = await translateWithFullChain(safeText, 'zh-TW'); - return result || safeText; + // ★ 2026-10-22 owner 61150 令:Walter Bloomberg 高量快訊改做本地直譯(雙向英↔中均只走第 0 層本地快取 → LocalMT,嚴禁入 FullChain / Google / WG / 任何網絡翻譯接口;失敗即回原文) + const cachedWalter = TPool.getCachedTranslation('x_walter_local', safeText); + if (cachedWalter) return cachedWalter; + const localResult = await LocalMT.translate(safeText); + if (localResult) { + TPool.setCachedTranslation('x_walter_local', safeText, localResult, 'local-mt-int8'); + return localResult; + } + return safeText; } // ---- 第 0 層:SHA-256 跨程序快取檢查 ---- ``` ### 2. `m.js`(`CHANNELS_CONFIG` `L136` 及 `handleNewMessage` `L486–L497`) - **改前(`v2.0`)**:`UW Economic News` 設 `translationMode: 'google_only'`,`handleNewMessage` 先行 `await googleFallback(singleContent)`,失敗先至落 `LocalMT`。 - **改後(`v2.1`)**: 1. `CHANNELS_CONFIG` 將 `UW Economic News` 之 `translationMode` 由 `'google_only'` 改為 `'local_only'`; 2. `handleNewMessage` 中 `if (config.translationMode === 'local_only')` 分支**完全跳過 `googleFallback`**,雙向(英→中/中→英)直入 `await LocalMT.translate(singleContent)`; 3. 若 `LocalMT` 失敗,照現行分支做法:**立即發送原文(連 `ᵘ` 後綴)+排入 `LocalMTRetry.schedule(...)` 背景補發 `🔁` 譯文**; 4. **其他頻道(`Elom_Nusk`、`Ashleytheprotrader™`)一字不動**。 ```diff --- /home/user/arc_workspace/translate_fix_61107/m.js 2026-10-21 17:07:11.000000000 +0000 +++ /home/user/arc_workspace/translate_fix_61150/m.js 2026-10-22 00:51:19.776974493 +0000 @@ -133,7 +133,7 @@ const CHANNELS_CONFIG = [ { name: "Elom_Nusk", url: "https://discord.com/channels/935571600525369484/1275291198310842481", token: "__MASKED_TG_BOT_TOKEN__", cleanRules: { author: false, timestamp: false, suffix: "" } }, { name: "Ashleytheprotrader™", url: "https://discord.com/channels/744638453509259346/794008145672142848", token: "__MASKED_TG_BOT_TOKEN__", cleanRules: { author: false, timestamp: false, suffix: "" } }, - { name: "UW Economic News", url: "https://discord.com/channels/710524439133028512/940255511864033320", token: "__MASKED_TG_BOT_TOKEN__", cleanRules: { author: true, timestamp: true, suffix: "ᵘ" }, translationMode: 'google_only' } + { name: "UW Economic News", url: "https://discord.com/channels/710524439133028512/940255511864033320", token: "__MASKED_TG_BOT_TOKEN__", cleanRules: { author: true, timestamp: true, suffix: "ᵘ" }, translationMode: 'local_only' } ]; let browserContextData = null; @@ -483,21 +483,16 @@ let translatedContent = singleContent; - if (config.translationMode === 'google_only') { - console.log(`🌍 [${config.name}] 使用 Google API 翻譯...`); - const googleResult = await googleFallback(singleContent); - if (googleResult) translatedContent = googleResult; + if (config.translationMode === 'local_only') { + // ★ 2026-10-22 owner 61150 令:UW Economic News 改做 local_only(雙向英↔中完全跳過 googleFallback / 任何網絡翻譯接口,直入 LocalMT;失敗發原文+LocalMTRetry 背景補發) + console.log(`🏠 [${config.name}] 使用本地離線直譯 (local_only)...`); + const localResult = await LocalMT.translate(singleContent); + if (localResult) translatedContent = localResult; else { - // ★ v2.0 最後備援:本地翻譯服務(離線),網路全掛時不再直接發英文原文 - console.warn(` 🏠 [${config.name}] 網路翻譯全失敗 → 本地翻譯最後備援...`); - const localResult = await LocalMT.translate(singleContent); - if (localResult) translatedContent = localResult; - else { - console.warn(`⚠️ [${config.name}] 本地翻譯亦失敗,保持原文 → 已排入補發`); - const _suffix = config.cleanRules.suffix || ""; - LocalMTRetry.schedule(singleContent, (zh) => sendTelegramMessage( - `🔁 ${escapeHtml(zh)}${_suffix}`, config.token, 'HTML')); - } + console.warn(`⚠️ [${config.name}] 本地翻譯失敗,保持原文 → 已排入補發`); + const _suffix = config.cleanRules.suffix || ""; + LocalMTRetry.schedule(singleContent, (zh) => sendTelegramMessage( + `🔁 ${escapeHtml(zh)}${_suffix}`, config.token, 'HTML')); } } else { const _suffix = config.cleanRules.suffix || ""; @@ -600,6 +595,7 @@ googleFallback, translateWithGeminiAutomation, handleNewMessage, + CHANNELS_CONFIG, GEMINI_MODELS, _testResetGeminiState, }; ``` --- ## 三、單元測試證據(`10/10 PASS`,證明雙向英↔中零網絡翻譯呼叫) 執行 `node test_four_layer_translation_61107.js`: - **`TEST 09` (`x.js` Walter Bloomberg 雙向英↔中+快取+失敗回原文)**: - 在配置齊全所有雲端 Key(Groq、Gemini、Mistral、Cloudflare、Azure)及 Google/WG 代理池下,對所有外部翻譯域名(`translate.googleapis.com`、`generativelanguage.googleapis.com`、`api.groq.com`、`api.mistral.ai`、`api.cloudflare.com`、`api.cognitive.microsofttranslator.com`、`mymemory.translated.net`、`drive.google.com`)設攔截計數器 `externalNetworkTranslateCalls`; - 實測 **(A) 英→中**(首次走 `LocalMT`、第二次命中第 0 層本地快取)、**(B) 中→英**(走 `LocalMT`)、**(C) `LocalMT` 失敗時(英→中及中→英回原文)**: - **結果**:`externalNetworkTranslateCalls = 0`(零網絡翻譯呼叫),`httpCallLog` 外部翻譯請求數 = `0`。 - **`TEST 10` (`m.js` UW Economic News `local_only` 雙向英↔中+失敗發原文+`LocalMTRetry` 背景補發)**: - 驗證 `CHANNELS_CONFIG` 中 `UW Economic News` 為 `translationMode: 'local_only'` 且全檔無任何 `google_only`; - 實測 **(A) 多行訊息同時含英→中與中→英**直入 `LocalMT` 成功發送 `ᵘ` 後綴譯文、**(B) `LocalMT` 失敗時(英→中及中→英)**立即發原文並排入 `LocalMTRetry.schedule` 背景補發 `🔁`; - **結果**:`externalNetworkTranslateCalls = 0`(零網絡翻譯呼叫),`httpCallLog` 外部翻譯請求數 = `0`。