import Link from 'next/link'; import { APPLE_PRESETS, NVIDIA_PRESETS, QUANTS } from '@/components/hardware/fit-form'; import { BTN_GHOST, CTRL, Field } from './bits'; /* GET form for /run-locally (no JavaScript needed). Memory presets by platform + a free field; GPU count; quantization; context; batch; use-case filter. In "hardware mode" (`?hardware=`) the memory select lists the device's own memory options. */ export const AMD_PRESETS = [16, 24, 32, 48, 128, 192, 256]; export const GPU_COUNTS = [1, 2, 4, 8]; export const PLATFORMS = [ { value: 'any', label: 'Any platform' }, { value: 'apple', label: 'Apple silicon (MLX, llama.cpp)' }, { value: 'nvidia', label: 'NVIDIA (CUDA, vLLM, TensorRT-LLM)' }, { value: 'amd', label: 'AMD (ROCm)' }, ]; export const CONTEXT_PRESETS = [ { value: 4096, label: '4K' }, { value: 8192, label: '8K' }, { value: 32768, label: '32K' }, { value: 131072, label: '128K' }, { value: 262144, label: '256K' }, { value: 1000000, label: '1M' }, ]; export const BATCHES = [1, 2, 4, 8, 16]; export const USE_CASES = [ { value: '', label: 'Any use case' }, { value: 'chat', label: 'Chat' }, { value: 'coding', label: 'Coding' }, { value: 'reasoning', label: 'Reasoning' }, { value: 'agentic', label: 'Agentic / tool use' }, { value: 'vision', label: 'Vision' }, { value: 'embeddings', label: 'Embeddings' }, { value: 'long_context', label: 'Long context' }, ]; export type RunLocallyInputs = { memory: number | null; gpuCount: number; quant: string; context: number; batch: number; platform: string; useCase: string; openness: string; hardware: string | null; fitsOnly: boolean }; export function RunLocallyForm({ v, hardwareName, memoryOptions, className }: { v: RunLocallyInputs; hardwareName?: string | null; memoryOptions?: number[]; className?: string }) { const presets = [...APPLE_PRESETS, ...NVIDIA_PRESETS, ...AMD_PRESETS]; const presetSelected = v.memory !== null && (memoryOptions?.includes(v.memory) || presets.includes(v.memory)) ? String(v.memory) : ''; return (
{v.hardware && (
Device: {hardwareName ?? v.hardware}{' '} change
)} {!v.hardware && ( )} {!v.hardware && ( )}
Reset
); }