diff --git a/ui/litellm-dashboard/src/components/playground/chat_ui/AdditionalModelSettings.tsx b/ui/litellm-dashboard/src/components/playground/chat_ui/AdditionalModelSettings.tsx index 6d5442fedc9..1e8453ea63a 100644 --- a/ui/litellm-dashboard/src/components/playground/chat_ui/AdditionalModelSettings.tsx +++ b/ui/litellm-dashboard/src/components/playground/chat_ui/AdditionalModelSettings.tsx @@ -1,6 +1,19 @@ -import { InfoCircleOutlined } from "@ant-design/icons"; -import { Text } from "@tremor/react"; -import { Checkbox, InputNumber, Popover, Slider, Tooltip, Typography } from "antd"; +import { Checkbox } from "@/components/ui/checkbox"; +import { Input } from "@/components/ui/input"; +import { + Popover, + PopoverContent, + PopoverTrigger, +} from "@/components/ui/popover"; +import { Slider } from "@/components/ui/slider"; +import { + Tooltip, + TooltipContent, + TooltipProvider, + TooltipTrigger, +} from "@/components/ui/tooltip"; +import { cn } from "@/lib/utils"; +import { Info } from "lucide-react"; import React, { useEffect, useState } from "react"; interface AdditionalModelSettingsProps { @@ -24,13 +37,15 @@ const AdditionalModelSettings: React.FC = ({ mockTestFallbacks, onMockTestFallbacksChange, }) => { - const [internalUseAdvancedParams, setInternalUseAdvancedParams] = useState(false); + const [internalUseAdvancedParams, setInternalUseAdvancedParams] = + useState(false); const useAdvancedParams = - externalUseAdvancedParams !== undefined ? externalUseAdvancedParams : internalUseAdvancedParams; + externalUseAdvancedParams !== undefined + ? externalUseAdvancedParams + : internalUseAdvancedParams; const [localTemperature, setLocalTemperature] = useState(temperature); const [localMaxTokens, setLocalMaxTokens] = useState(maxTokens); - // Sync local state with props when they change useEffect(() => { setLocalTemperature(temperature); }, [temperature]); @@ -39,21 +54,16 @@ const AdditionalModelSettings: React.FC = ({ setLocalMaxTokens(maxTokens); }, [maxTokens]); - const handleTemperatureChange = (value: number | null) => { - const newValue = value ?? 1.0; - setLocalTemperature(newValue); - onTemperatureChange?.(newValue); + const handleTemperatureChange = (value: number) => { + setLocalTemperature(value); + onTemperatureChange?.(value); }; - const handleMaxTokensChange = (value: number | null) => { - const newValue = value ?? 1000; - setLocalMaxTokens(newValue); - onMaxTokensChange?.(newValue); + const handleMaxTokensChange = (value: number) => { + setLocalMaxTokens(value); + onMaxTokensChange?.(value); }; - const disabledOpacity = useAdvancedParams ? 1 : 0.4; - const disabledTextColor = useAdvancedParams ? "text-gray-700" : "text-gray-400"; - const handleUseAdvancedParamsChange = (checked: boolean) => { if (onUseAdvancedParamsChange) { onUseAdvancedParamsChange(checked); @@ -62,115 +72,172 @@ const AdditionalModelSettings: React.FC = ({ } }; + const disabledTextColor = useAdvancedParams + ? "text-foreground" + : "text-muted-foreground"; + return (
- handleUseAdvancedParamsChange(e.target.checked)}> + {onMockTestFallbacksChange && (
- onMockTestFallbacksChange(e.target.checked)} - > - Simulate failure to test fallbacks - - - - Causes the first request to fail so the router tries fallbacks (if configured). Use - this to verify your fallback setup. - - - Behavior can differ when keys, teams, or router settings are configured.{" "} - - Learn more - - -
- } - > - + + onMockTestFallbacksChange(c === true) + } /> + + Simulate failure to test fallbacks + + + + + + + +

+ Causes the first request to fail so the router tries + fallbacks (if configured). Use this to verify your fallback + setup. +

+

+ Behavior can differ when keys, teams, or router settings are + configured.{" "} + + Learn more + +

+
)} -
+
- Temperature - - - + + Temperature + + + + + + + + Controls randomness. Lower values make output more + deterministic, higher values more creative. + + +
- { + const v = parseFloat(e.target.value); + handleTemperatureChange(isNaN(v) ? 1.0 : v); + }} disabled={!useAdvancedParams} - precision={1} - className="w-20" + className="w-20 h-8" />
handleTemperatureChange(v)} disabled={!useAdvancedParams} - marks={{ - 0: "0", - 1: "1.0", - 2: "2.0", - }} /> +
+ 0 + 1.0 + 2.0 +
- Max Tokens - - - + + Max Tokens + + + + + + + + Maximum number of tokens to generate in the response. + + +
- { + const v = parseInt(e.target.value, 10); + handleMaxTokensChange(isNaN(v) ? 1000 : v); + }} disabled={!useAdvancedParams} + className="w-24 h-8" />
handleMaxTokensChange(v)} disabled={!useAdvancedParams} - marks={{ - 1: "1", - 32768: "32768", - }} /> +
+ 1 + 32768 +