mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-03 16:30:23 +00:00
refactor: genericize speech provider config surface
This commit is contained in:
@@ -2,7 +2,7 @@ import { readConfigFileSnapshot } from "../../config/config.js";
|
||||
import { redactConfigObject } from "../../config/redact-snapshot.js";
|
||||
import { buildTalkConfigResponse, resolveActiveTalkProviderConfig } from "../../config/talk.js";
|
||||
import type { TalkProviderConfig } from "../../config/types.gateway.js";
|
||||
import type { OpenClawConfig, TtsConfig } from "../../config/types.js";
|
||||
import type { OpenClawConfig, TtsConfig, TtsProviderConfigMap } from "../../config/types.js";
|
||||
import { canonicalizeSpeechProviderId, getSpeechProvider } from "../../tts/provider-registry.js";
|
||||
import { synthesizeSpeech, type TtsDirectiveOverrides } from "../../tts/tts.js";
|
||||
import {
|
||||
@@ -32,6 +32,12 @@ function trimString(value: unknown): string | undefined {
|
||||
return trimmed.length > 0 ? trimmed : undefined;
|
||||
}
|
||||
|
||||
function asRecord(value: unknown): Record<string, unknown> | undefined {
|
||||
return typeof value === "object" && value !== null && !Array.isArray(value)
|
||||
? (value as Record<string, unknown>)
|
||||
: undefined;
|
||||
}
|
||||
|
||||
function normalizeAliasKey(value: string): string {
|
||||
return value.trim().toLowerCase();
|
||||
}
|
||||
@@ -87,7 +93,10 @@ function buildTalkTtsConfig(
|
||||
...baseTts,
|
||||
auto: "always",
|
||||
provider,
|
||||
[provider]: resolvedProviderConfig,
|
||||
providers: {
|
||||
...((asRecord(baseTts.providers) ?? {}) as TtsProviderConfigMap),
|
||||
[provider]: resolvedProviderConfig,
|
||||
},
|
||||
};
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user