/*
Copyright (C) 2023-2026 QuantumNous
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see .
For commercial licensing, please contact support@quantumnous.com
*/
import { SlidersHorizontalIcon } from 'lucide-react'
import { useTranslation } from 'react-i18next'
import { PromptInputButton } from '@/components/ai-elements/prompt-input'
import { Input } from '@/components/design-system/input'
import { StatusBadge } from '@/components/status-badge'
import {
Popover,
PopoverContent,
PopoverTrigger,
} from '@/components/ui/popover'
import {
Sheet,
SheetContent,
SheetHeader,
SheetTitle,
SheetTrigger,
} from '@/components/ui/sheet'
import { Slider } from '@/components/ui/slider'
import { Switch } from '@/components/ui/switch'
import {
Tooltip,
TooltipContent,
TooltipTrigger,
} from '@/components/ui/tooltip'
import { useIsMobile } from '@/hooks/use-mobile'
import { cn } from '@/lib/utils'
import {
getParameterControlValueText,
normalizeParameterNumberValue,
PLAYGROUND_PARAMETER_CONTROLS,
PLAYGROUND_PARAMETER_PANEL_SCROLL_CLASS,
type PlaygroundParameterKey,
} from '../../lib/parameters/playground-parameters'
import type { ParameterEnabled, PlaygroundConfig } from '../../types'
type PlaygroundParameterPanelProps = {
config: PlaygroundConfig
disabled?: boolean
onConfigChange: (
key: K,
value: PlaygroundConfig[K]
) => void
onParameterEnabledChange: (
key: PlaygroundParameterKey,
value: boolean
) => void
parameterEnabled: ParameterEnabled
}
type PlaygroundParameterContentProps = PlaygroundParameterPanelProps & {
compact?: boolean
}
function PlaygroundParameterContent({
compact = false,
config,
disabled,
onConfigChange,
onParameterEnabledChange,
parameterEnabled,
}: PlaygroundParameterContentProps) {
const { t } = useTranslation()
const updateParameterConfig = (
key: PlaygroundParameterKey,
value: number | null
) => {
if (key === 'seed') {
onConfigChange('seed', value)
return
}
onConfigChange(key, value ?? 0)
}
return (