mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-18 17:30:16 +01:00
make sure types are all right
This commit is contained in:
parent
2717bdc36a
commit
c0ddfefd2a
5 changed files with 20 additions and 9 deletions
|
|
@ -167,13 +167,23 @@ export type ActionAuthForm = {
|
||||||
token_exchange_method: t.TokenExchangeMethodEnum;
|
token_exchange_method: t.TokenExchangeMethodEnum;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type MCPForm = ActionAuthForm & {
|
export type MCPAuthForm = {
|
||||||
|
customHeaders?: Array<{
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
value: string;
|
||||||
|
}>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type MCPForm = MCPAuthForm & {
|
||||||
name?: string;
|
name?: string;
|
||||||
description?: string;
|
description?: string;
|
||||||
url?: string;
|
url?: string;
|
||||||
tools?: string[];
|
tools?: string[];
|
||||||
icon?: string;
|
icon?: string;
|
||||||
trust?: boolean;
|
trust?: boolean;
|
||||||
|
requestTimeout?: number;
|
||||||
|
connectionTimeout?: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type ActionWithNullableMetadata = Omit<t.Action, 'metadata'> & {
|
export type ActionWithNullableMetadata = Omit<t.Action, 'metadata'> & {
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
|
import type { MCP } from 'librechat-data-provider';
|
||||||
import { useAgentPanelContext } from '~/Providers/AgentPanelContext';
|
import { useAgentPanelContext } from '~/Providers/AgentPanelContext';
|
||||||
import { useToastContext } from '~/Providers';
|
import { useToastContext } from '~/Providers';
|
||||||
import { useLocalize } from '~/hooks';
|
import { useLocalize } from '~/hooks';
|
||||||
import { Panel } from '~/common';
|
import { Panel } from '~/common';
|
||||||
import type { MCP } from '~/common';
|
|
||||||
import MCPFormPanel from '../MCP/MCPFormPanel';
|
import MCPFormPanel from '../MCP/MCPFormPanel';
|
||||||
|
|
||||||
// TODO: Add MCP delete (for now mocked for ui)
|
// TODO: Add MCP delete (for now mocked for ui)
|
||||||
|
|
@ -101,7 +101,7 @@ export default function AgentMCPFormPanel() {
|
||||||
return (
|
return (
|
||||||
<MCPFormPanel
|
<MCPFormPanel
|
||||||
mcp={mcp}
|
mcp={mcp}
|
||||||
contextId={agent_id}
|
agent_id={agent_id}
|
||||||
onBack={handleBack}
|
onBack={handleBack}
|
||||||
onDelete={handleDelete}
|
onDelete={handleDelete}
|
||||||
onSave={handleSave}
|
onSave={handleSave}
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,13 @@
|
||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
import { ChevronLeft } from 'lucide-react';
|
import { ChevronLeft } from 'lucide-react';
|
||||||
import { useForm, FormProvider } from 'react-hook-form';
|
import { useForm, FormProvider } from 'react-hook-form';
|
||||||
|
import type { MCP } from 'librechat-data-provider';
|
||||||
|
import type { MCPForm } from '~/common';
|
||||||
import { OGDialog, OGDialogTrigger, Label } from '~/components/ui';
|
import { OGDialog, OGDialogTrigger, Label } from '~/components/ui';
|
||||||
import OGDialogTemplate from '~/components/ui/OGDialogTemplate';
|
import OGDialogTemplate from '~/components/ui/OGDialogTemplate';
|
||||||
import { defaultMCPFormValues } from '~/common/mcp';
|
import { defaultMCPFormValues } from '~/common/mcp';
|
||||||
import useLocalize from '~/hooks/useLocalize';
|
import useLocalize from '~/hooks/useLocalize';
|
||||||
import { TrashIcon } from '~/components/svg';
|
import { TrashIcon } from '~/components/svg';
|
||||||
import type { MCPForm, MCP } from '~/common';
|
|
||||||
import MCPInput from './MCPInput';
|
import MCPInput from './MCPInput';
|
||||||
import {
|
import {
|
||||||
AuthTypeEnum,
|
AuthTypeEnum,
|
||||||
|
|
@ -17,7 +18,7 @@ import {
|
||||||
interface MCPFormPanelProps {
|
interface MCPFormPanelProps {
|
||||||
// Data
|
// Data
|
||||||
mcp?: MCP;
|
mcp?: MCP;
|
||||||
agent_id?: string; // agent_id, conversation_id, etc.
|
agent_id?: string;
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
onBack: () => void;
|
onBack: () => void;
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ interface MCPInputProps {
|
||||||
isLoading?: boolean;
|
isLoading?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function MCPInput({ mcp, a, onSave, isLoading = false }: MCPInputProps) {
|
export default function MCPInput({ mcp, agent_id, onSave, isLoading = false }: MCPInputProps) {
|
||||||
const localize = useLocalize();
|
const localize = useLocalize();
|
||||||
const {
|
const {
|
||||||
handleSubmit,
|
handleSubmit,
|
||||||
|
|
@ -37,7 +37,7 @@ export default function MCPInput({ mcp, a, onSave, isLoading = false }: MCPInput
|
||||||
const saveMCP = handleSubmit(async (data: MCPForm) => {
|
const saveMCP = handleSubmit(async (data: MCPForm) => {
|
||||||
const updatedMCP: MCP = {
|
const updatedMCP: MCP = {
|
||||||
mcp_id: mcp?.mcp_id ?? '',
|
mcp_id: mcp?.mcp_id ?? '',
|
||||||
agent_id: a ?? '', // This will be agent_id, conversation_id, etc.
|
agent_id: agent_id ?? '',
|
||||||
metadata: {
|
metadata: {
|
||||||
...data,
|
...data,
|
||||||
tools: selectedTools,
|
tools: selectedTools,
|
||||||
|
|
@ -78,7 +78,7 @@ export default function MCPInput({ mcp, a, onSave, isLoading = false }: MCPInput
|
||||||
const base64String = reader.result as string;
|
const base64String = reader.result as string;
|
||||||
const updatedMCP: MCP = {
|
const updatedMCP: MCP = {
|
||||||
mcp_id: mcp?.mcp_id ?? '',
|
mcp_id: mcp?.mcp_id ?? '',
|
||||||
agent_id: a ?? '',
|
agent_id: agent_id ?? '',
|
||||||
metadata: {
|
metadata: {
|
||||||
...mcp?.metadata,
|
...mcp?.metadata,
|
||||||
icon: base64String,
|
icon: base64String,
|
||||||
|
|
|
||||||
|
|
@ -4,13 +4,13 @@ import { Constants } from 'librechat-data-provider';
|
||||||
import { useForm, Controller } from 'react-hook-form';
|
import { useForm, Controller } from 'react-hook-form';
|
||||||
import { useUpdateUserPluginsMutation } from 'librechat-data-provider/react-query';
|
import { useUpdateUserPluginsMutation } from 'librechat-data-provider/react-query';
|
||||||
import type { TUpdateUserPlugins } from 'librechat-data-provider';
|
import type { TUpdateUserPlugins } from 'librechat-data-provider';
|
||||||
|
import type { MCP } from 'librechat-data-provider';
|
||||||
import { Button, Input, Label } from '~/components/ui';
|
import { Button, Input, Label } from '~/components/ui';
|
||||||
import { useGetStartupConfig } from '~/data-provider';
|
import { useGetStartupConfig } from '~/data-provider';
|
||||||
import MCPPanelSkeleton from './MCPPanelSkeleton';
|
import MCPPanelSkeleton from './MCPPanelSkeleton';
|
||||||
import { useToastContext } from '~/Providers';
|
import { useToastContext } from '~/Providers';
|
||||||
import { useLocalize } from '~/hooks';
|
import { useLocalize } from '~/hooks';
|
||||||
import MCPFormPanel from './MCPFormPanel';
|
import MCPFormPanel from './MCPFormPanel';
|
||||||
import type { MCP } from '~/common';
|
|
||||||
|
|
||||||
interface ServerConfigWithVars {
|
interface ServerConfigWithVars {
|
||||||
serverName: string;
|
serverName: string;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue