import styled from "styled-components"; import { LLM } from "../../../schema/LLM"; import { Label, Select, Input, defaultBorderRadius, lightGray, vscForeground, } from "."; import { useState } from "react"; import { useFormContext } from "react-hook-form"; import { getFontSize } from "../util"; const Div = styled.div<{ dashed: boolean }>` border: 1px ${(props) => (props.dashed ? "dashed" : "solid")} ${lightGray}; border-radius: ${defaultBorderRadius}; padding: 8px; margin-bottom: 16px; `; type ModelOption = "api_key" | "model" | "context_length"; const DefaultModelOptions: { [key: string]: { [key in ModelOption]?: string }; } = { default: { api_key: "", model: "codellama", }, }; function ModelSettings(props: { llm: any | undefined; role: string }) { const [modelOptions, setModelOptions] = useState<{ [key in ModelOption]?: string; }>(DefaultModelOptions[props.llm?.class_name || "default"]); const { register, setValue, getValues } = useFormContext(); return (