33 lines
955 B
TypeScript
33 lines
955 B
TypeScript
import { FormField, FormItem, FormLabel } from "~/components/ui/form";
|
|
import { FunctionSelector } from "~/components/function/FunctionSelector";
|
|
import { useAllFunctionConfigs } from "~/context/config";
|
|
import type { Control } from "react-hook-form";
|
|
import type { InferenceQueryBuilderFormValues } from "./InferenceQueryBuilder";
|
|
|
|
interface FunctionFormFieldProps {
|
|
control: Control<InferenceQueryBuilderFormValues>;
|
|
}
|
|
|
|
export default function FunctionFormField({ control }: FunctionFormFieldProps) {
|
|
const functions = useAllFunctionConfigs();
|
|
|
|
return (
|
|
<FormField
|
|
control={control}
|
|
name="function"
|
|
render={({ field }) => (
|
|
<FormItem>
|
|
<FormLabel>Function</FormLabel>
|
|
<FunctionSelector
|
|
selected={field.value}
|
|
onSelect={(value) => {
|
|
field.onChange(value);
|
|
}}
|
|
functions={functions}
|
|
/>
|
|
</FormItem>
|
|
)}
|
|
/>
|
|
);
|
|
}
|