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