From 3f10a4f9d2a59bea069d68f17ba6b696395c0015 Mon Sep 17 00:00:00 2001 From: Marco Beretta <81851188+berry-13@users.noreply.github.com> Date: Tue, 6 Jan 2026 01:49:56 +0100 Subject: [PATCH] feat(WebSearch): enhance ApiKeyDialog and InputSection with improved UI components and layout --- .../SidePanel/Agents/Search/ApiKeyDialog.tsx | 153 ++++++++++-------- .../SidePanel/Agents/Search/InputSection.tsx | 100 ++++-------- 2 files changed, 113 insertions(+), 140 deletions(-) diff --git a/client/src/components/SidePanel/Agents/Search/ApiKeyDialog.tsx b/client/src/components/SidePanel/Agents/Search/ApiKeyDialog.tsx index a7ec8fdc17..2ec8aaf107 100644 --- a/client/src/components/SidePanel/Agents/Search/ApiKeyDialog.tsx +++ b/client/src/components/SidePanel/Agents/Search/ApiKeyDialog.tsx @@ -1,5 +1,14 @@ import { useState } from 'react'; -import { Button, OGDialog, OGDialogTemplate } from '@librechat/client'; +import { Globe } from 'lucide-react'; +import { + Button, + OGDialog, + OGDialogClose, + OGDialogTitle, + OGDialogFooter, + OGDialogHeader, + OGDialogContent, +} from '@librechat/client'; import { AuthType, RerankerTypes, @@ -183,84 +192,86 @@ export default function ApiKeyDialog({ triggerRef={triggerRef} triggerRefs={triggerRefs} > - -
{localize('com_ui_web_search')}
-
- {/* Provider Section */} - {providerAuthType !== AuthType.SYSTEM_DEFINED && ( - - setDropdownOpen((prev) => ({ ...prev, provider: open })) - } - dropdownKey="provider" - /> - )} + + +
+
+
+
+ + {localize('com_ui_web_search')} + +
- {/* Scraper Section */} - {scraperAuthType !== AuthType.SYSTEM_DEFINED && ( - - setDropdownOpen((prev) => ({ ...prev, scraper: open })) - } - dropdownKey="scraper" - /> - )} + + {providerAuthType !== AuthType.SYSTEM_DEFINED && ( + setDropdownOpen((prev) => ({ ...prev, provider: open }))} + dropdownKey="provider" + /> + )} - {/* Reranker Section */} - {rerankerAuthType !== AuthType.SYSTEM_DEFINED && ( - - setDropdownOpen((prev) => ({ ...prev, reranker: open })) - } - dropdownKey="reranker" - /> - )} - - - } - selection={{ - selectHandler: handleSubmit(onSubmit), - selectClasses: 'bg-green-500 hover:bg-green-600 text-white', - selectText: localize('com_ui_save'), - }} - buttons={ - isToolAuthenticated && ( + {scraperAuthType !== AuthType.SYSTEM_DEFINED && ( + setDropdownOpen((prev) => ({ ...prev, scraper: open }))} + dropdownKey="scraper" + /> + )} + + {rerankerAuthType !== AuthType.SYSTEM_DEFINED && ( + setDropdownOpen((prev) => ({ ...prev, reranker: open }))} + dropdownKey="reranker" + /> + )} + + + + + + + {isToolAuthenticated && ( - ) - } - showCancelButton={true} - /> + )} + + +
); } diff --git a/client/src/components/SidePanel/Agents/Search/InputSection.tsx b/client/src/components/SidePanel/Agents/Search/InputSection.tsx index caeb5fb1ba..737ae5d5aa 100644 --- a/client/src/components/SidePanel/Agents/Search/InputSection.tsx +++ b/client/src/components/SidePanel/Agents/Search/InputSection.tsx @@ -1,11 +1,9 @@ -import { useState } from 'react'; import * as Menu from '@ariakit/react/menu'; -import { ChevronDown, Eye, EyeOff } from 'lucide-react'; -import { Input, Label, DropdownPopup } from '@librechat/client'; +import { ChevronDown } from 'lucide-react'; +import { Input, Label, SecretInput, DropdownPopup } from '@librechat/client'; import type { SearchApiKeyFormData } from '~/hooks/Plugins/useAuthSearchTool'; import type { UseFormRegister } from 'react-hook-form'; import type { MenuItemProps } from '~/common'; -import { useLocalize } from '~/hooks'; interface InputConfig { placeholder: string; @@ -45,25 +43,16 @@ export default function InputSection({ setDropdownOpen, dropdownKey, }: InputSectionProps) { - const localize = useLocalize(); - const [passwordVisibility, setPasswordVisibility] = useState>({}); const selectedOption = dropdownOptions.find((opt) => opt.key === selectedKey); const dropdownItems: MenuItemProps[] = dropdownOptions.map((option) => ({ label: option.label, onClick: () => onSelectionChange(option.key), })); - const togglePasswordVisibility = (fieldName: string) => { - setPasswordVisibility((prev) => ({ - ...prev, - [fieldName]: !prev[fieldName], - })); - }; - return ( -
-
- +
+
+ {showDropdown ? ( setDropdownOpen(!dropdownOpen)} - className="flex items-center rounded-md border border-border-light px-3 py-1 text-sm text-text-secondary" + className="flex items-center gap-1.5 whitespace-nowrap rounded-lg border border-border-light px-3 py-1.5 text-sm text-text-secondary transition-colors hover:bg-surface-hover" > {selectedOption?.label} - +
- {selectedOption?.inputs && - Object.entries(selectedOption.inputs).map(([name, config], index) => ( -
-
- (e.target.readOnly = false) : undefined - } - className={`${index > 0 ? 'mb-2' : 'mb-2'} ${ - config.type === 'password' ? 'pr-10' : '' - }`} - {...register(name as keyof SearchApiKeyFormData)} - /> - {config.type === 'password' && ( - + {selectedOption?.inputs && ( +
+ {Object.entries(selectedOption.inputs).map(([name, config]) => ( +
+ {config.type === 'password' ? ( + + ) : ( + )} -
- {config.link && ( -
+ {config.link && ( {config.link.text} -
- )} -
- ))} + )} +
+ ))} +
+ )}
); }