"use client"; import type { ReactNode } from "react"; import { HelpCircle, Settings2 } from "lucide-react"; import { Input } from "@/components/ui/input"; import { Switch } from "@/components/ui/switch"; import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, DialogTrigger, } from "@/components/ui/dialog"; import { Popover, PopoverContent, PopoverTrigger, } from "@/components/ui/popover"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "@/components/ui/select"; import type { TurnConfig } from "@/lib/api"; type Props = { enabled: boolean; config: TurnConfig; onEnabledChange: (enabled: boolean) => void; onConfigChange: (config: TurnConfig) => void; }; export function TurnConfigEditor({ enabled, config, onEnabledChange, onConfigChange, }: Props) { const updateBargeIn = (patch: Partial) => onConfigChange({ ...config, bargeIn: { ...config.bargeIn, ...patch }, }); const updateVad = (patch: Partial) => onConfigChange({ ...config, vad: { ...config.vad, ...patch }, }); const updateTurnDetection = ( patch: Partial, ) => onConfigChange({ ...config, turnDetection: { ...config.turnDetection, ...patch }, }); return (
允许用户打断 高级交互配置 配置 Pipeline 的语音活动检测、用户抢话与对话轮次结束策略。
updateVad({ confidence })} /> updateVad({ minVolume })} /> updateVad({ startSecs })} /> updateVad({ stopSecs })} />
{config.turnDetection.strategy === "silence" && ( updateTurnDetection({ silenceTimeoutSecs }) } /> )}
); } function ConfigSection({ title, children }: { title: string; children: ReactNode }) { return (
{title}
{children}
); } function HelpHint({ text }: { text: string }) { return ( {text} ); } function NumberField({ label, value, min, max, step, onChange }: { label: string; value: number; min: number; max: number; step: number; onChange: (value: number) => void }) { return ( ); }