dsh-line-bot 0.10.8 → 0.10.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.10.9
2
+
3
+ - 上傳或重設參考音後立即清掉語音偵測快取,面板不會再顯示上一段參考音的秒數。
4
+
1
5
  ## 0.10.8
2
6
 
3
7
  - 上傳自訂參考音後自動去掉開頭靜音並裁切到前 15 秒。13 分鐘的錄音整段丟給 CosyVoice3 會讓語音合成卡住;現在只保留一小段乾淨人聲,上傳後可直接測試。
package/lib/host.mjs CHANGED
@@ -51,7 +51,7 @@ const { createVision } = visionMod
51
51
  const { createTts } = ttsMod
52
52
  const { chunkText, clip, inQuietWindow, jsonFail, jsonOk, maskSecret, readJsonBody, safeArray, sleep, readJsonSafe } = utilMod
53
53
 
54
- export const VERSION = '0.10.8'
54
+ export const VERSION = '0.10.9'
55
55
 
56
56
  // 環境變數提供的 Cloudflare API Token(方便用 shell 注入、不用把 token 寫進設定檔)。
57
57
  // 設定檔裡的 token 優先;兩者都沒有時才用環境變數。
@@ -2866,11 +2866,13 @@ export async function create({ ctx, config: pluginConfig, logger: upstream }) {
2866
2866
  if (buffer.length > 20 * 1024 * 1024) throw new Error('音檔超過 20MB')
2867
2867
  const saved = await tts.saveReferenceBuffer(buffer, String(payload.filename || 'reference'), String(payload.ext || '.wav'))
2868
2868
  store.patch({ voice: { referencePath: saved.path } }, { silent: true })
2869
+ tts.invalidate()
2869
2870
  voiceCache = { at: 0, value: null }
2870
2871
  return { path: saved.path, seconds: saved.seconds }
2871
2872
  }
2872
2873
  case 'voice-reset-reference':
2873
2874
  store.patch({ voice: { referencePath: '' } }, { silent: true })
2875
+ tts.invalidate()
2874
2876
  voiceCache = { at: 0, value: null }
2875
2877
  return { path: tts.referencePath() }
2876
2878
  case 'meme-send': {
package/lib/tts.mjs CHANGED
@@ -279,6 +279,11 @@ export function createTts({ dir, logger, getConfig }) {
279
279
  return crispVersion(bin).ok
280
280
  }
281
281
 
282
+ function invalidate() {
283
+ detectCache = { at: 0, value: null }
284
+ refCache = { at: 0, key: '', value: null }
285
+ }
286
+
282
287
  function detect({ force = false, validate = false } = {}) {
283
288
  const now = Date.now()
284
289
  if (!force && !validate && detectCache.value && now - detectCache.at < 120000) return detectCache.value
@@ -668,5 +673,5 @@ export function createTts({ dir, logger, getConfig }) {
668
673
  }
669
674
  }
670
675
 
671
- return { detect, install, synthesize, status, saveReferenceBuffer, referencePath, paths }
676
+ return { detect, invalidate, install, synthesize, status, saveReferenceBuffer, referencePath, paths }
672
677
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-line-bot",
3
- "version": "0.10.8",
3
+ "version": "0.10.9",
4
4
  "description": "把 LINE 官方帳號(Messaging API)接進 DeepSeek Harness 的插件:內建 Cloudflare Tunnel、人設選擇(大肥魚或插件自訂)、主動傳訊與完整設定面板。",
5
5
  "type": "module",
6
6
  "main": "index.js",