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
1 changed files with 7 additions and 4 deletions

View File

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