mirror of https://github.com/openclaw/openclaw.git
refactor: share tts auto mode normalization
This commit is contained in:
parent
138a92373b
commit
5445bc68b9
|
|
@ -38,6 +38,7 @@ import type {
|
|||
TtsDirectiveOverrides,
|
||||
TtsDirectiveParseResult,
|
||||
} from "./provider-types.js";
|
||||
import { normalizeTtsAutoMode } from "./tts-auto-mode.js";
|
||||
import { scheduleCleanup, summarizeText } from "./tts-core.js";
|
||||
|
||||
export type { TtsDirectiveOverrides, TtsDirectiveParseResult } from "./provider-types.js";
|
||||
|
|
@ -63,8 +64,6 @@ const DEFAULT_OUTPUT = {
|
|||
voiceCompatible: false,
|
||||
};
|
||||
|
||||
const TTS_AUTO_MODES = new Set<TtsAutoMode>(["off", "always", "inbound", "tagged"]);
|
||||
|
||||
export type ResolvedTtsConfig = {
|
||||
auto: TtsAutoMode;
|
||||
mode: TtsMode;
|
||||
|
|
@ -133,17 +132,6 @@ type TtsStatusEntry = {
|
|||
|
||||
let lastTtsAttempt: TtsStatusEntry | undefined;
|
||||
|
||||
export function normalizeTtsAutoMode(value: unknown): TtsAutoMode | undefined {
|
||||
if (typeof value !== "string") {
|
||||
return undefined;
|
||||
}
|
||||
const normalized = value.trim().toLowerCase();
|
||||
if (TTS_AUTO_MODES.has(normalized as TtsAutoMode)) {
|
||||
return normalized as TtsAutoMode;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function resolveModelOverridePolicy(
|
||||
overrides: TtsModelOverrideConfig | undefined,
|
||||
): ResolvedTtsModelOverrides {
|
||||
|
|
|
|||
Loading…
Reference in New Issue