import { type ReactNode } from "react"; import { ImageSettingsTheme } from "@/components/image-settings-panel"; import { audioFormatOptions, audioSpeedLabel, audioVoiceOptions, normalizeAudioFormatValue, normalizeAudioSpeedValue, normalizeAudioVoiceValue } from "@/lib/audio-generation"; import { type CanvasTheme } from "@/lib/canvas-theme"; import type { AiConfig } from "@/stores/use-config-store"; const speedOptions = ["0.75", "1", "1.25", "1.5"]; type AudioSettingKey = "audioVoice" | "audioFormat" | "audioSpeed" | "audioInstructions"; type AudioSettingsPanelProps = { config: AiConfig; onConfigChange: (key: AudioSettingKey, value: string) => void; theme: CanvasTheme; showTitle?: boolean; className?: string; }; export function AudioSettingsPanel({ config, onConfigChange, theme, showTitle = true, className = "w-[320px] space-y-4 rounded-2xl px-1 py-0.5" }: AudioSettingsPanelProps) { const voice = normalizeAudioVoiceValue(config.audioVoice); const format = normalizeAudioFormatValue(config.audioFormat); const speed = normalizeAudioSpeedValue(config.audioSpeed); return (
event.stopPropagation()}> {showTitle ?
音频设置
: null}
{audioVoiceOptions.map((item) => ( onConfigChange("audioVoice", item.value)}> {item.label} ))}
{audioFormatOptions.map((item) => ( onConfigChange("audioFormat", item.value)}> {item.label} ))}
{speedOptions.map((value) => ( onConfigChange("audioSpeed", value)}> {audioSpeedLabel(value)} ))}
onConfigChange("audioSpeed", event.target.value)} onBlur={(event) => onConfigChange("audioSpeed", normalizeAudioSpeedValue(event.target.value))} onMouseDown={(event) => event.stopPropagation()} />