mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-15 11:11:09 +00:00
refactor: dedupe config cli command trimmed readers
This commit is contained in:
@@ -35,8 +35,11 @@ import {
|
||||
registerMemoryEmbeddingProvider,
|
||||
} from "../plugins/memory-embedding-providers.js";
|
||||
import { writeRuntimeJson, defaultRuntime, type RuntimeEnv } from "../runtime.js";
|
||||
import { normalizeLowercaseStringOrEmpty } from "../shared/string-coerce.js";
|
||||
import { normalizeStringifiedOptionalString } from "../shared/string-coerce.js";
|
||||
import {
|
||||
normalizeLowercaseStringOrEmpty,
|
||||
normalizeOptionalString,
|
||||
normalizeStringifiedOptionalString,
|
||||
} from "../shared/string-coerce.js";
|
||||
import { formatDocsLink } from "../terminal/links.js";
|
||||
import { theme } from "../terminal/theme.js";
|
||||
import { canonicalizeSpeechProviderId, listSpeechProviders } from "../tts/provider-registry.js";
|
||||
@@ -878,7 +881,7 @@ async function runTtsConvert(params: {
|
||||
params: {
|
||||
text: params.text,
|
||||
channel: params.channel,
|
||||
provider: params.provider?.trim() || undefined,
|
||||
provider: normalizeOptionalString(params.provider),
|
||||
modelId: params.modelId,
|
||||
voiceId: params.voiceId,
|
||||
},
|
||||
@@ -921,7 +924,9 @@ async function runTtsConvert(params: {
|
||||
voiceId: params.voiceId,
|
||||
});
|
||||
const hasExplicitSelection = Boolean(
|
||||
overrides.provider || params.modelId?.trim() || params.voiceId?.trim(),
|
||||
overrides.provider ||
|
||||
normalizeOptionalString(params.modelId) ||
|
||||
normalizeOptionalString(params.voiceId),
|
||||
);
|
||||
const result = await textToSpeech({
|
||||
text: params.text,
|
||||
@@ -1004,7 +1009,7 @@ async function runTtsVoices(providerRaw?: string) {
|
||||
const cfg = loadConfig();
|
||||
const config = resolveTtsConfig(cfg);
|
||||
const prefsPath = resolveTtsPrefsPath(config);
|
||||
const provider = providerRaw?.trim() || getTtsProvider(config, prefsPath);
|
||||
const provider = normalizeOptionalString(providerRaw) || getTtsProvider(config, prefsPath);
|
||||
return await listSpeechVoices({
|
||||
provider,
|
||||
cfg,
|
||||
@@ -1106,7 +1111,7 @@ async function runMemoryEmbeddingCreate(params: {
|
||||
ensureMemoryEmbeddingProvidersRegistered();
|
||||
const cfg = loadConfig();
|
||||
const modelRef = resolveModelRefOverride(params.model);
|
||||
const requestedProvider = params.provider?.trim() || modelRef.provider || "auto";
|
||||
const requestedProvider = normalizeOptionalString(params.provider) || modelRef.provider || "auto";
|
||||
const result = await createEmbeddingProvider({
|
||||
config: cfg,
|
||||
agentDir: resolveAgentDir(cfg, resolveDefaultAgentId(cfg)),
|
||||
|
||||
Reference in New Issue
Block a user