fix: hydrate lazy tts provider config from source config

This commit is contained in:
Peter Steinberger
2026-03-28 12:56:27 +00:00
parent 3bb199aa43
commit bccbfdebfe

View File

@@ -58,6 +58,7 @@ export type ResolvedTtsConfig = {
maxTextLength: number; maxTextLength: number;
timeoutMs: number; timeoutMs: number;
rawConfig?: TtsConfig; rawConfig?: TtsConfig;
sourceConfig?: OpenClawConfig;
}; };
type TtsUserPrefs = { type TtsUserPrefs = {
@@ -216,15 +217,16 @@ function resolveLazyProviderConfig(
const canonical = const canonical =
normalizeConfiguredSpeechProviderId(providerId) ?? providerId.trim().toLowerCase(); normalizeConfiguredSpeechProviderId(providerId) ?? providerId.trim().toLowerCase();
const existing = config.providerConfigs[canonical]; const existing = config.providerConfigs[canonical];
if (existing) { const effectiveCfg = cfg ?? config.sourceConfig;
if (existing && !effectiveCfg) {
return existing; return existing;
} }
const rawConfig = resolveRawProviderConfig(config.rawConfig, canonical); const rawConfig = resolveRawProviderConfig(config.rawConfig, canonical);
const resolvedProvider = getSpeechProvider(canonical, cfg); const resolvedProvider = getSpeechProvider(canonical, effectiveCfg);
const next = const next =
cfg && resolvedProvider?.resolveConfig effectiveCfg && resolvedProvider?.resolveConfig
? resolvedProvider.resolveConfig({ ? resolvedProvider.resolveConfig({
cfg, cfg: effectiveCfg,
rawConfig: { rawConfig: {
...(config.rawConfig as Record<string, unknown> | undefined), ...(config.rawConfig as Record<string, unknown> | undefined),
providers: asProviderConfigMap(config.rawConfig?.providers), providers: asProviderConfigMap(config.rawConfig?.providers),
@@ -299,6 +301,7 @@ export function resolveTtsConfig(cfg: OpenClawConfig): ResolvedTtsConfig {
maxTextLength: raw.maxTextLength ?? DEFAULT_MAX_TEXT_LENGTH, maxTextLength: raw.maxTextLength ?? DEFAULT_MAX_TEXT_LENGTH,
timeoutMs, timeoutMs,
rawConfig: raw, rawConfig: raw,
sourceConfig: cfg,
}; };
} }