import { ModelIcon } from "@/components/models/model-icon" import { ChatSettingsForm } from "@/components/ui/chat-settings-form" import { Input } from "@/components/ui/input" import { Label } from "@/components/ui/label" import { PRESET_NAME_MAX } from "@/db/limits" import { LLM_LIST } from "@/lib/models/llm/llm-list" import { Tables } from "@/supabase/types" import { FC, useState } from "react" import { SidebarItem } from "../all/sidebar-display-item" interface PresetItemProps { preset: Tables<"presets"> } export const PresetItem: FC = ({ preset }) => { const [name, setName] = useState(preset.name) const [isTyping, setIsTyping] = useState(false) const [description, setDescription] = useState(preset.description) const [presetChatSettings, setPresetChatSettings] = useState({ model: preset.model, prompt: preset.prompt, temperature: preset.temperature, contextLength: preset.context_length, includeProfileContext: preset.include_profile_context, includeWorkspaceInstructions: preset.include_workspace_instructions }) const modelDetails = LLM_LIST.find(model => model.modelId === preset.model) return ( } updateState={{ name, description, include_profile_context: presetChatSettings.includeProfileContext, include_workspace_instructions: presetChatSettings.includeWorkspaceInstructions, context_length: presetChatSettings.contextLength, model: presetChatSettings.model, prompt: presetChatSettings.prompt, temperature: presetChatSettings.temperature }} renderInputs={() => ( <>
setName(e.target.value)} maxLength={PRESET_NAME_MAX} />
)} /> ) }