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 +4 -0
- package/lib/host.mjs +3 -1
- package/lib/tts.mjs +6 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
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.
|
|
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
|
}
|