mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-01-12 13:38:51 +01:00
* ✨ style: Adjust z-index for popover UI and update className in ConvoOptions * ✨ feat: Add 'spec' field to conversation query selection * 🛠️ fix: add back conversationId to use Constants.PENDING_CONVO in useSSE hook on submission to allow text drafts to clear * ✨ chore: add .clineignore to .gitignore for Cline configuration * ✨ refactor: memoize FileSearchCheckbox component for performance optimization * fix: agent resource management by adding tool_resource to agent's tools if missing
72 lines
2.3 KiB
TypeScript
72 lines
2.3 KiB
TypeScript
import { memo } from 'react';
|
|
import { AgentCapabilities } from 'librechat-data-provider';
|
|
import { useFormContext, Controller } from 'react-hook-form';
|
|
import type { AgentForm } from '~/common';
|
|
import {
|
|
Checkbox,
|
|
HoverCard,
|
|
HoverCardContent,
|
|
HoverCardPortal,
|
|
HoverCardTrigger,
|
|
} from '~/components/ui';
|
|
import { CircleHelpIcon } from '~/components/svg';
|
|
import { useLocalize } from '~/hooks';
|
|
import { ESide } from '~/common';
|
|
|
|
function FileSearchCheckbox() {
|
|
const localize = useLocalize();
|
|
const methods = useFormContext<AgentForm>();
|
|
const { control, setValue, getValues } = methods;
|
|
|
|
return (
|
|
<>
|
|
<HoverCard openDelay={50}>
|
|
<div className="my-2 flex items-center">
|
|
<Controller
|
|
name={AgentCapabilities.file_search}
|
|
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()}
|
|
/>
|
|
)}
|
|
/>
|
|
<button
|
|
type="button"
|
|
className="flex items-center space-x-2"
|
|
onClick={() =>
|
|
setValue(AgentCapabilities.file_search, !getValues(AgentCapabilities.file_search), {
|
|
shouldDirty: true,
|
|
})
|
|
}
|
|
>
|
|
<label
|
|
className="form-check-label text-token-text-primary w-full cursor-pointer"
|
|
htmlFor={AgentCapabilities.file_search}
|
|
>
|
|
{localize('com_agents_enable_file_search')}
|
|
</label>
|
|
<HoverCardTrigger>
|
|
<CircleHelpIcon className="h-4 w-4 text-text-tertiary" />
|
|
</HoverCardTrigger>
|
|
</button>
|
|
<HoverCardPortal>
|
|
<HoverCardContent side={ESide.Top} className="w-80">
|
|
<div className="space-y-2">
|
|
<p className="text-sm text-text-secondary">
|
|
{localize('com_agents_file_search_info')}
|
|
</p>
|
|
</div>
|
|
</HoverCardContent>
|
|
</HoverCardPortal>
|
|
</div>
|
|
</HoverCard>
|
|
</>
|
|
);
|
|
}
|
|
|
|
export default memo(FileSearchCheckbox);
|