






























@@ -351,13 +351,15 @@ function resolveTtsRuntimeConfig(cfg: OpenClawConfig): OpenClawConfig {
351351352352function asProviderConfig(value: unknown): SpeechProviderConfig {
353353return typeof value === "object" && value !== null && !Array.isArray(value)
354- ? (value as SpeechProviderConfig)
354+ ? // oxlint-disable-next-line typescript/no-unsafe-type-assertion -- Speech provider configs are open JSON records normalized at the plugin boundary.
355+(value as SpeechProviderConfig)
355356 : {};
356357}
357358358359function asProviderConfigMap(value: unknown): Record<string, unknown> {
359360return typeof value === "object" && value !== null && !Array.isArray(value)
360- ? (value as Record<string, unknown>)
361+ ? // oxlint-disable-next-line typescript/no-unsafe-type-assertion -- TTS provider config maps are open JSON records keyed by provider id.
362+(value as Record<string, unknown>)
361363 : {};
362364}
363365@@ -728,6 +730,7 @@ function readPrefs(prefsPath: string): TtsUserPrefs {
728730if (!existsSync(prefsPath)) {
729731return {};
730732}
733+// oxlint-disable-next-line typescript/no-unsafe-type-assertion -- User prefs are trusted local JSON and unknown keys are ignored by readers.
731734return JSON.parse(readFileSync(prefsPath, "utf8")) as TtsUserPrefs;
732735} catch {
733736return {};
@@ -900,12 +903,14 @@ export function resolveExplicitTtsOverrides(params: {
900903`TTS provider "${selectedProvider}" ignored the requested model or voice overrides.`,
901904);
902905}
906+if (!providerOverrides) {
907+throw new Error(`TTS provider "${selectedProvider}" did not return talk overrides.`);
908+}
903909904-const overridesRecord = providerOverrides as SpeechProviderOverrides;
905910return {
906911provider: selectedProvider,
907912providerOverrides: {
908-[provider.id]: overridesRecord,
913+[provider.id]: providerOverrides,
909914},
910915};
911916}
@@ -1815,9 +1820,10 @@ export async function textToSpeechTelephony(params: {
18151820 config,
18161821provider: resolvedProvider.provider,
18171822});
1818-const synthesizeTelephony = resolvedProvider.provider.synthesizeTelephony as NonNullable<
1819-typeof resolvedProvider.provider.synthesizeTelephony
1820->;
1823+const synthesizeTelephony = resolvedProvider.provider.synthesizeTelephony;
1824+if (!synthesizeTelephony) {
1825+throw new Error(`TTS provider "${resolvedProvider.provider.id}" lost telephony support`);
1826+}
18211827const prepared = await prepareSpeechSynthesis({
18221828provider: resolvedProvider.provider,
18231829text: params.text,
@@ -2044,6 +2050,7 @@ export async function maybeApplyTtsToPayload(params: {
20442050textForAudio = `${textForAudio.slice(0, config.maxTextLength - 3)}...`;
20452051}
20462052} catch (err) {
2053+// oxlint-disable-next-line typescript/no-unsafe-type-assertion -- Only the message is used for verbose diagnostics after a caught summarizer failure.
20472054const error = err as Error;
20482055logVerbose(`TTS: summarization failed, truncating instead: ${error.message}`);
20492056textForAudio = `${textForAudio.slice(0, maxLength - 3)}...`;
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。