mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 17:00:15 +01:00
refactor stuff into the MCP dir
This commit is contained in:
parent
389ab1db77
commit
2717bdc36a
4 changed files with 5 additions and 8 deletions
|
|
@ -2,7 +2,7 @@ import { useCallback } from 'react';
|
||||||
import { useLocalize } from '~/hooks';
|
import { useLocalize } from '~/hooks';
|
||||||
import { useToastContext } from '~/Providers';
|
import { useToastContext } from '~/Providers';
|
||||||
import { useAgentPanelContext } from '~/Providers/AgentPanelContext';
|
import { useAgentPanelContext } from '~/Providers/AgentPanelContext';
|
||||||
import MCP from '~/components/SidePanel/Builder/MCP';
|
import { MCPItem } from '~/components/SidePanel/MCP/MCPItem';
|
||||||
import { Panel } from '~/common';
|
import { Panel } from '~/common';
|
||||||
|
|
||||||
export default function MCPSection() {
|
export default function MCPSection() {
|
||||||
|
|
@ -30,7 +30,7 @@ export default function MCPSection() {
|
||||||
{mcps
|
{mcps
|
||||||
.filter((mcp) => mcp.agent_id === agent_id)
|
.filter((mcp) => mcp.agent_id === agent_id)
|
||||||
.map((mcp, i) => (
|
.map((mcp, i) => (
|
||||||
<MCP
|
<MCPItem
|
||||||
key={i}
|
key={i}
|
||||||
mcp={mcp}
|
mcp={mcp}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@ import {
|
||||||
} from '~/components/ui/Accordion';
|
} from '~/components/ui/Accordion';
|
||||||
import { DropdownPopup } from '~/components/ui';
|
import { DropdownPopup } from '~/components/ui';
|
||||||
import { useLocalize } from '~/hooks';
|
import { useLocalize } from '~/hooks';
|
||||||
import { cn } from '~/utils';
|
|
||||||
|
|
||||||
interface UserInfoPlaceholder {
|
interface UserInfoPlaceholder {
|
||||||
label: string;
|
label: string;
|
||||||
|
|
@ -31,14 +30,12 @@ const userInfoPlaceholders: UserInfoPlaceholder[] = [
|
||||||
{ label: 'role', value: '{{LIBRECHAT_USER_ROLE}}', description: 'User role' },
|
{ label: 'role', value: '{{LIBRECHAT_USER_ROLE}}', description: 'User role' },
|
||||||
];
|
];
|
||||||
|
|
||||||
export default function MCPAuth() {
|
export function MCPAuth() {
|
||||||
const localize = useLocalize();
|
const localize = useLocalize();
|
||||||
const { register, watch, setValue } = useFormContext();
|
const { register, watch, setValue } = useFormContext();
|
||||||
const [isHeadersMenuOpen, setIsHeadersMenuOpen] = useState(false);
|
const [isHeadersMenuOpen, setIsHeadersMenuOpen] = useState(false);
|
||||||
|
|
||||||
const customHeaders = watch('customHeaders') || [];
|
const customHeaders = watch('customHeaders') || [];
|
||||||
const requestTimeout = watch('requestTimeout') || '';
|
|
||||||
const connectionTimeout = watch('connectionTimeout') || '';
|
|
||||||
|
|
||||||
const addCustomHeader = () => {
|
const addCustomHeader = () => {
|
||||||
const newHeader = {
|
const newHeader = {
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import { useState, useEffect } from 'react';
|
import { useState, useEffect } from 'react';
|
||||||
import { useFormContext, Controller } from 'react-hook-form';
|
import { useFormContext, Controller } from 'react-hook-form';
|
||||||
import type { MCP } from 'librechat-data-provider';
|
import type { MCP } from 'librechat-data-provider';
|
||||||
import MCPAuth from '~/components/SidePanel/Builder/MCPAuth';
|
import { MCPAuth } from '~/components/SidePanel/MCP/MCPAuth';
|
||||||
import MCPIcon from '~/components/SidePanel/Agents/MCPIcon';
|
import MCPIcon from '~/components/SidePanel/Agents/MCPIcon';
|
||||||
import { Label, Checkbox } from '~/components/ui';
|
import { Label, Checkbox } from '~/components/ui';
|
||||||
import useLocalize from '~/hooks/useLocalize';
|
import useLocalize from '~/hooks/useLocalize';
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ type MCPProps = {
|
||||||
onClick: () => void;
|
onClick: () => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function MCP({ mcp, onClick }: MCPProps) {
|
export function MCPItem({ mcp, onClick }: MCPProps) {
|
||||||
const [isHovering, setIsHovering] = useState(false);
|
const [isHovering, setIsHovering] = useState(false);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
Loading…
Add table
Add a link
Reference in a new issue