mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-04 11:20:21 +00:00
fix: hydrate lazy tts provider config from source config
This commit is contained in:
@@ -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,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user