mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-01-21 17:56:13 +01:00
44 lines
1.3 KiB
TypeScript
44 lines
1.3 KiB
TypeScript
|
|
import { useFormContext, Controller } from 'react-hook-form';
|
||
|
|
import { Capabilities } from 'librechat-data-provider';
|
||
|
|
import type { AssistantForm } from '~/common';
|
||
|
|
import { Checkbox, QuestionMark } from '~/components/ui';
|
||
|
|
import { useLocalize } from '~/hooks';
|
||
|
|
|
||
|
|
export default function ImageVision() {
|
||
|
|
const localize = useLocalize();
|
||
|
|
const methods = useFormContext<AssistantForm>();
|
||
|
|
const { control, setValue, getValues } = methods;
|
||
|
|
|
||
|
|
return (
|
||
|
|
<div className="flex items-center">
|
||
|
|
<Controller
|
||
|
|
name={Capabilities.image_vision}
|
||
|
|
control={control}
|
||
|
|
render={({ field }) => (
|
||
|
|
<Checkbox
|
||
|
|
{...field}
|
||
|
|
checked={field.value}
|
||
|
|
onCheckedChange={field.onChange}
|
||
|
|
className="relative float-left mr-2 inline-flex h-4 w-4 cursor-pointer"
|
||
|
|
value={field?.value?.toString()}
|
||
|
|
/>
|
||
|
|
)}
|
||
|
|
/>
|
||
|
|
<label
|
||
|
|
className="form-check-label text-token-text-primary w-full cursor-pointer"
|
||
|
|
htmlFor={Capabilities.image_vision}
|
||
|
|
onClick={() =>
|
||
|
|
setValue(Capabilities.image_vision, !getValues(Capabilities.image_vision), {
|
||
|
|
shouldDirty: true,
|
||
|
|
})
|
||
|
|
}
|
||
|
|
>
|
||
|
|
<div className="flex items-center">
|
||
|
|
{localize('com_assistants_image_vision')}
|
||
|
|
<QuestionMark />
|
||
|
|
</div>
|
||
|
|
</label>
|
||
|
|
</div>
|
||
|
|
);
|
||
|
|
}
|