mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-28 22:28:51 +01:00
fix: change MCP config components to better handle servers without customUserVars
- removes the subtle reinitialize button from config components of servers without customUserVars or OAuth - adds a placeholder message for components where servers have no customUserVars configured
This commit is contained in:
parent
37701d3e9b
commit
f68c61d148
5 changed files with 21 additions and 4 deletions
|
|
@ -114,9 +114,13 @@ export default function CustomUserVarsSection({
|
|||
reset();
|
||||
};
|
||||
|
||||
// Don't render if no fields to configure
|
||||
// Show message if no fields to configure
|
||||
if (!fields || Object.keys(fields).length === 0) {
|
||||
return null;
|
||||
return (
|
||||
<div className="p-4 text-center text-sm text-gray-500">
|
||||
{localize('com_sidepanel_mcp_no_custom_vars', { '0': serverName })}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -132,6 +132,7 @@ export default function MCPConfigDialog({
|
|||
<ServerInitializationSection
|
||||
serverName={serverName}
|
||||
requiresOAuth={serverStatus?.requiresOAuth || false}
|
||||
hasCustomUserVars={fieldsSchema && Object.keys(fieldsSchema).length > 0}
|
||||
/>
|
||||
</OGDialogContent>
|
||||
</OGDialog>
|
||||
|
|
|
|||
|
|
@ -7,11 +7,13 @@ import { useLocalize } from '~/hooks';
|
|||
interface ServerInitializationSectionProps {
|
||||
serverName: string;
|
||||
requiresOAuth: boolean;
|
||||
hasCustomUserVars?: boolean;
|
||||
}
|
||||
|
||||
export default function ServerInitializationSection({
|
||||
serverName,
|
||||
requiresOAuth,
|
||||
hasCustomUserVars = false,
|
||||
}: ServerInitializationSectionProps) {
|
||||
const localize = useLocalize();
|
||||
|
||||
|
|
@ -39,8 +41,8 @@ export default function ServerInitializationSection({
|
|||
cancelOAuthFlow(serverName);
|
||||
}, [cancelOAuthFlow, serverName]);
|
||||
|
||||
// Show subtle reinitialize option if connected
|
||||
if (isConnected) {
|
||||
// Show subtle reinitialize option if connected AND server has OAuth or custom user vars
|
||||
if (isConnected && (requiresOAuth || hasCustomUserVars)) {
|
||||
return (
|
||||
<div className="flex justify-start">
|
||||
<button
|
||||
|
|
@ -55,6 +57,11 @@ export default function ServerInitializationSection({
|
|||
);
|
||||
}
|
||||
|
||||
// Don't show anything for connected servers that don't need OAuth or custom vars
|
||||
if (isConnected) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="rounded-lg border border-[#991b1b] bg-[#2C1315] p-4">
|
||||
<div className="flex items-center justify-between">
|
||||
|
|
|
|||
|
|
@ -146,6 +146,10 @@ function MCPPanelContent() {
|
|||
<ServerInitializationSection
|
||||
serverName={selectedServerNameForEditing}
|
||||
requiresOAuth={serverStatus?.requiresOAuth || false}
|
||||
hasCustomUserVars={
|
||||
serverBeingEdited.config.customUserVars &&
|
||||
Object.keys(serverBeingEdited.config.customUserVars).length > 0
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -506,6 +506,7 @@
|
|||
"com_sidepanel_hide_panel": "Hide Panel",
|
||||
"com_sidepanel_manage_files": "Manage Files",
|
||||
"com_sidepanel_mcp_no_servers_with_vars": "No MCP servers with configurable variables.",
|
||||
"com_sidepanel_mcp_no_custom_vars": "No custom user variables set for {{0}}",
|
||||
"com_sidepanel_mcp_variables_for": "MCP Variables for {{0}}",
|
||||
"com_sidepanel_parameters": "Parameters",
|
||||
"com_sources_image_alt": "Search result image",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue