mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-18 01:10:14 +01:00
🤖 feat: Add Agents librechat.yaml Configuration (#4953)
* feat: CONFIG_VERSION v1.1.9, agents config * refactor: Assistants Code Interpreter Toggle Improved Accessibility * feat: Agents Config
This commit is contained in:
parent
51e016ef2c
commit
e82af236bc
13 changed files with 65 additions and 48 deletions
|
|
@ -173,6 +173,7 @@ export type AgentPanelProps = {
|
|||
setAction: React.Dispatch<React.SetStateAction<t.Action | undefined>>;
|
||||
endpointsConfig?: t.TEndpointsConfig;
|
||||
setCurrentAgentId: React.Dispatch<React.SetStateAction<string | undefined>>;
|
||||
agentsConfig?: t.TAgentsEndpoint | null;
|
||||
};
|
||||
|
||||
export type AgentModelPanelProps = {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import {
|
|||
PermissionTypes,
|
||||
AgentCapabilities,
|
||||
} from 'librechat-data-provider';
|
||||
import type { TConfig, TPlugin } from 'librechat-data-provider';
|
||||
import type { TPlugin } from 'librechat-data-provider';
|
||||
import type { AgentForm, AgentPanelProps } from '~/common';
|
||||
import { cn, defaultTextProps, removeFocusOutlines, getEndpointField, getIconKey } from '~/utils';
|
||||
import { useCreateAgentMutation, useUpdateAgentMutation } from '~/data-provider';
|
||||
|
|
@ -43,7 +43,7 @@ export default function AgentConfig({
|
|||
endpointsConfig,
|
||||
setActivePanel,
|
||||
setCurrentAgentId,
|
||||
}: AgentPanelProps & { agentsConfig?: TConfig | null }) {
|
||||
}: AgentPanelProps) {
|
||||
const { user } = useAuthContext();
|
||||
const fileMap = useFileMapContext();
|
||||
const queryClient = useQueryClient();
|
||||
|
|
@ -69,19 +69,19 @@ export default function AgentConfig({
|
|||
});
|
||||
|
||||
const toolsEnabled = useMemo(
|
||||
() => agentsConfig?.capabilities?.includes(AgentCapabilities.tools),
|
||||
() => agentsConfig?.capabilities.includes(AgentCapabilities.tools),
|
||||
[agentsConfig],
|
||||
);
|
||||
const actionsEnabled = useMemo(
|
||||
() => agentsConfig?.capabilities?.includes(AgentCapabilities.actions),
|
||||
() => agentsConfig?.capabilities.includes(AgentCapabilities.actions),
|
||||
[agentsConfig],
|
||||
);
|
||||
const fileSearchEnabled = useMemo(
|
||||
() => agentsConfig?.capabilities?.includes(AgentCapabilities.file_search) ?? false,
|
||||
() => agentsConfig?.capabilities.includes(AgentCapabilities.file_search) ?? false,
|
||||
[agentsConfig],
|
||||
);
|
||||
const codeEnabled = useMemo(
|
||||
() => agentsConfig?.capabilities?.includes(AgentCapabilities.execute_code) ?? false,
|
||||
() => agentsConfig?.capabilities.includes(AgentCapabilities.execute_code) ?? false,
|
||||
[agentsConfig],
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import {
|
|||
isAssistantsEndpoint,
|
||||
defaultAgentFormValues,
|
||||
} from 'librechat-data-provider';
|
||||
import type { TConfig } from 'librechat-data-provider';
|
||||
import type { AgentForm, AgentPanelProps, StringOption } from '~/common';
|
||||
import {
|
||||
useCreateAgentMutation,
|
||||
|
|
@ -33,7 +32,7 @@ export default function AgentPanel({
|
|||
setCurrentAgentId,
|
||||
agentsConfig,
|
||||
endpointsConfig,
|
||||
}: AgentPanelProps & { agentsConfig?: TConfig | null }) {
|
||||
}: AgentPanelProps) {
|
||||
const localize = useLocalize();
|
||||
const { user } = useAuthContext();
|
||||
const { showToast } = useToastContext();
|
||||
|
|
|
|||
|
|
@ -30,26 +30,29 @@ export default function Code({ version }: { version: number | string }) {
|
|||
checked={field.value}
|
||||
onCheckedChange={field.onChange}
|
||||
className="relative float-left mr-2 inline-flex h-4 w-4 cursor-pointer"
|
||||
value={field?.value?.toString()}
|
||||
value={field.value.toString()}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
<div className="flex items-center space-x-2">
|
||||
<button
|
||||
type="button"
|
||||
className="flex items-center space-x-2"
|
||||
onClick={() =>
|
||||
setValue(Capabilities.code_interpreter, !getValues(Capabilities.code_interpreter), {
|
||||
shouldDirty: true,
|
||||
})
|
||||
}
|
||||
>
|
||||
<label
|
||||
className="form-check-label text-token-text-primary w-full cursor-pointer"
|
||||
htmlFor={Capabilities.code_interpreter}
|
||||
onClick={() =>
|
||||
setValue(Capabilities.code_interpreter, !getValues(Capabilities.code_interpreter), {
|
||||
shouldDirty: true,
|
||||
})
|
||||
}
|
||||
>
|
||||
{localize('com_assistants_code_interpreter')}
|
||||
</label>
|
||||
<HoverCardTrigger>
|
||||
<CircleHelpIcon className="h-5 w-5 text-gray-500" />
|
||||
</HoverCardTrigger>
|
||||
</div>
|
||||
</button>
|
||||
<HoverCardPortal>
|
||||
<HoverCardContent side={ESide.Top} className="w-80">
|
||||
<div className="space-y-2">
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ export default function useSideNavLinks({
|
|||
hasAccessToCreateAgents &&
|
||||
isAgentsEndpoint(endpoint) &&
|
||||
agents &&
|
||||
// agents.disableBuilder !== true &&
|
||||
agents.disableBuilder !== true &&
|
||||
keyProvided &&
|
||||
interfaceConfig.parameters === true
|
||||
) {
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ export default {
|
|||
com_agents_enable_file_search: 'Enable File Search',
|
||||
com_agents_file_search_info:
|
||||
'When enabled, the agent will be informed of the exact filenames listed below, allowing it to retrieve relevant context from these files.',
|
||||
com_agents_code_interpreter_title: 'Code Interpreter',
|
||||
com_agents_code_interpreter_title: 'Code Interpreter API',
|
||||
com_agents_by_librechat: 'by LibreChat',
|
||||
com_agents_code_interpreter:
|
||||
'When enabled, allows your agent to leverage the LibreChat Code Interpreter API to run generated code, including file processing, securely. Requires a valid API key.',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue