























@@ -351,15 +351,13 @@ function resolveTtsRuntimeConfig(cfg: OpenClawConfig): OpenClawConfig {
351351352352function asProviderConfig(value: unknown): SpeechProviderConfig {
353353return typeof value === "object" && value !== null && !Array.isArray(value)
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)
354+ ? (value as SpeechProviderConfig)
356355 : {};
357356}
358357359358function asProviderConfigMap(value: unknown): Record<string, unknown> {
360359return typeof value === "object" && value !== null && !Array.isArray(value)
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>)
360+ ? (value as Record<string, unknown>)
363361 : {};
364362}
365363@@ -730,7 +728,6 @@ function readPrefs(prefsPath: string): TtsUserPrefs {
730728if (!existsSync(prefsPath)) {
731729return {};
732730}
733-// oxlint-disable-next-line typescript/no-unsafe-type-assertion -- User prefs are trusted local JSON and unknown keys are ignored by readers.
734731return JSON.parse(readFileSync(prefsPath, "utf8")) as TtsUserPrefs;
735732} catch {
736733return {};
@@ -903,14 +900,12 @@ export function resolveExplicitTtsOverrides(params: {
903900`TTS provider "${selectedProvider}" ignored the requested model or voice overrides.`,
904901);
905902}
906-if (!providerOverrides) {
907-throw new Error(`TTS provider "${selectedProvider}" did not return talk overrides.`);
908-}
909903904+const overridesRecord = providerOverrides as SpeechProviderOverrides;
910905return {
911906provider: selectedProvider,
912907providerOverrides: {
913-[provider.id]: providerOverrides,
908+[provider.id]: overridesRecord,
914909},
915910};
916911}
@@ -1820,10 +1815,9 @@ export async function textToSpeechTelephony(params: {
18201815 config,
18211816provider: resolvedProvider.provider,
18221817});
1823-const synthesizeTelephony = resolvedProvider.provider.synthesizeTelephony;
1824-if (!synthesizeTelephony) {
1825-throw new Error(`TTS provider "${resolvedProvider.provider.id}" lost telephony support`);
1826-}
1818+const synthesizeTelephony = resolvedProvider.provider.synthesizeTelephony as NonNullable<
1819+typeof resolvedProvider.provider.synthesizeTelephony
1820+>;
18271821const prepared = await prepareSpeechSynthesis({
18281822provider: resolvedProvider.provider,
18291823text: params.text,
@@ -2050,7 +2044,6 @@ export async function maybeApplyTtsToPayload(params: {
20502044textForAudio = `${textForAudio.slice(0, config.maxTextLength - 3)}...`;
20512045}
20522046} 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.
20542047const error = err as Error;
20552048logVerbose(`TTS: summarization failed, truncating instead: ${error.message}`);
20562049textForAudio = `${textForAudio.slice(0, maxLength - 3)}...`;
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。