import { Switch } from '@/components/ui/switch' import { Slider } from '@/components/ui/slider' import { useTextGeneration, GenerationConfigState } from '../../contexts/TextGenerationContext' import { useModel } from '../../contexts/ModelContext' function TextGenerationConfig() { const { config, setConfig, messages, updateSystemMessage } = useTextGeneration() const { modelInfo } = useModel() const handleConfigChange = ( field: keyof GenerationConfigState, value: number | boolean ) => { setConfig((prev) => ({ ...prev, [field]: value })) } return (

Text Generation Settings

handleConfigChange('temperature', value[0]) } className="w-full rounded-lg" />

Controls randomness in generation (lower = more focused, higher = more creative)

handleConfigChange('maxTokens', value[0])} className="w-full rounded-lg" />

Maximum number of tokens to generate in the response

handleConfigChange('topP', value[0])} className="w-full rounded-lg" />

Nucleus sampling - considers tokens with cumulative probability up to this value

handleConfigChange('topK', value[0])} className="w-full rounded-lg" />

Only consider the top K most likely tokens at each step

handleConfigChange('doSample', checked) } />

Enable sampling-based generation (disable for deterministic output)

{/* System Message for Chat */} {modelInfo?.hasChatTemplate && (

System Message