diff --git a/web/package-lock.json b/web/package-lock.json index 7bae0ed0f..1dfe8280a 100644 --- a/web/package-lock.json +++ b/web/package-lock.json @@ -86,6 +86,7 @@ "react-infinite-scroll-component": "^6.1.0", "react-markdown": "^9.0.1", "react-pdf-highlighter": "^6.1.0", + "react-resizable-panels": "^3.0.6", "react-string-replace": "^1.1.1", "react-syntax-highlighter": "^15.5.0", "react18-json-view": "^0.2.8", @@ -30306,6 +30307,16 @@ } } }, + "node_modules/react-resizable-panels": { + "version": "3.0.6", + "resolved": "https://registry.npmmirror.com/react-resizable-panels/-/react-resizable-panels-3.0.6.tgz", + "integrity": "sha512-b3qKHQ3MLqOgSS+FRYKapNkJZf5EQzuf6+RLiq1/IlTHw99YrZ2NJZLk4hQIzTnnIkRg2LUqyVinu6YWWpUYew==", + "license": "MIT", + "peerDependencies": { + "react": "^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc", + "react-dom": "^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc" + } + }, "node_modules/react-rnd": { "version": "10.4.1", "resolved": "https://registry.npmmirror.com/react-rnd/-/react-rnd-10.4.1.tgz", diff --git a/web/package.json b/web/package.json index ab24212c5..7f5e3f8dd 100644 --- a/web/package.json +++ b/web/package.json @@ -99,6 +99,7 @@ "react-infinite-scroll-component": "^6.1.0", "react-markdown": "^9.0.1", "react-pdf-highlighter": "^6.1.0", + "react-resizable-panels": "^3.0.6", "react-string-replace": "^1.1.1", "react-syntax-highlighter": "^15.5.0", "react18-json-view": "^0.2.8", diff --git a/web/src/components/originui/select-with-search.tsx b/web/src/components/originui/select-with-search.tsx index 4b87792d7..3434ba36b 100644 --- a/web/src/components/originui/select-with-search.tsx +++ b/web/src/components/originui/select-with-search.tsx @@ -219,7 +219,11 @@ export const SelectWithSearch = forwardRef< value={group.value} disabled={group.disabled} onSelect={handleSelect} - className="min-h-10" + className={ + value === group.value + ? 'bg-bg-card min-h-10' + : 'min-h-10' + } > {group.label} diff --git a/web/src/components/similarity-slider/index.tsx b/web/src/components/similarity-slider/index.tsx index 73666b504..d4c07e4d3 100644 --- a/web/src/components/similarity-slider/index.tsx +++ b/web/src/components/similarity-slider/index.tsx @@ -159,7 +159,7 @@ export function SimilaritySliderFormField({ ( className, )} style={{ - paddingLeft: !!prefix ? `${prefixWidth}px` : '', + paddingLeft: !!prefix && prefixWidth ? `${prefixWidth}px` : '', paddingRight: isPasswordInput ? '40px' : !!suffix @@ -144,7 +144,9 @@ export interface ExpandedInputProps extends InputProps {} const ExpandedInput = Input; const SearchInput = (props: InputProps) => { - return } />; + return ( + } /> + ); }; type Value = string | readonly string[] | number | undefined; diff --git a/web/src/components/ui/modal/modal.tsx b/web/src/components/ui/modal/modal.tsx index c40e5f90b..13de06cf8 100644 --- a/web/src/components/ui/modal/modal.tsx +++ b/web/src/components/ui/modal/modal.tsx @@ -200,7 +200,7 @@ const Modal: ModalType = ({ {closeIcon} diff --git a/web/src/components/ui/resizable.tsx b/web/src/components/ui/resizable.tsx new file mode 100644 index 000000000..3ed9da677 --- /dev/null +++ b/web/src/components/ui/resizable.tsx @@ -0,0 +1,54 @@ +import { GripVerticalIcon } from 'lucide-react'; +import * as React from 'react'; +import * as ResizablePrimitive from 'react-resizable-panels'; + +import { cn } from '@/lib/utils'; + +function ResizablePanelGroup({ + className, + ...props +}: React.ComponentProps) { + return ( + + ); +} + +function ResizablePanel({ + ...props +}: React.ComponentProps) { + return ; +} + +function ResizableHandle({ + withHandle, + className, + ...props +}: React.ComponentProps & { + withHandle?: boolean; +}) { + return ( + div]:rotate-90', + className, + )} + {...props} + > + {withHandle && ( + + + + )} + + ); +} + +export { ResizableHandle, ResizablePanel, ResizablePanelGroup }; diff --git a/web/src/pages/user-setting/data-source/index.tsx b/web/src/pages/user-setting/data-source/index.tsx index 6fc3bf9e0..004b540f7 100644 --- a/web/src/pages/user-setting/data-source/index.tsx +++ b/web/src/pages/user-setting/data-source/index.tsx @@ -13,56 +13,16 @@ import { AddedSourceCard } from './component/added-source-card'; import { DataSourceInfo, DataSourceKey } from './contant'; import { useAddDataSource, useListDataSource } from './hooks'; import { IDataSorceInfo } from './interface'; -const dataSourceTemplates = [ - { - id: DataSourceKey.CONFLUENCE, - name: DataSourceInfo[DataSourceKey.CONFLUENCE].name, - description: DataSourceInfo[DataSourceKey.CONFLUENCE].description, - icon: DataSourceInfo[DataSourceKey.CONFLUENCE].icon, - }, - { - id: DataSourceKey.S3, - name: DataSourceInfo[DataSourceKey.S3].name, - description: DataSourceInfo[DataSourceKey.S3].description, - icon: DataSourceInfo[DataSourceKey.S3].icon, - }, - { - id: DataSourceKey.GOOGLE_DRIVE, - name: DataSourceInfo[DataSourceKey.GOOGLE_DRIVE].name, - description: DataSourceInfo[DataSourceKey.GOOGLE_DRIVE].description, - icon: DataSourceInfo[DataSourceKey.GOOGLE_DRIVE].icon, - }, - { - id: DataSourceKey.DISCORD, - name: DataSourceInfo[DataSourceKey.DISCORD].name, - description: DataSourceInfo[DataSourceKey.DISCORD].description, - icon: DataSourceInfo[DataSourceKey.DISCORD].icon, - }, - { - id: DataSourceKey.NOTION, - name: DataSourceInfo[DataSourceKey.NOTION].name, - description: DataSourceInfo[DataSourceKey.NOTION].description, - icon: DataSourceInfo[DataSourceKey.NOTION].icon, - }, - { - id: DataSourceKey.MOODLE, - name: DataSourceInfo[DataSourceKey.MOODLE].name, - description: DataSourceInfo[DataSourceKey.MOODLE].description, - icon: DataSourceInfo[DataSourceKey.MOODLE].icon, - }, - { - id: DataSourceKey.JIRA, - name: DataSourceInfo[DataSourceKey.JIRA].name, - description: DataSourceInfo[DataSourceKey.JIRA].description, - icon: DataSourceInfo[DataSourceKey.JIRA].icon, - }, - { - id: DataSourceKey.DROPBOX, - name: DataSourceInfo[DataSourceKey.DROPBOX].name, - description: DataSourceInfo[DataSourceKey.DROPBOX].description, - icon: DataSourceInfo[DataSourceKey.DROPBOX].icon, - }, -]; + +const dataSourceTemplates = Object.values(DataSourceKey).map((id) => { + return { + id, + name: DataSourceInfo[id].name, + description: DataSourceInfo[id].description, + icon: DataSourceInfo[id].icon, + }; +}); + const DataSource = () => { const { t } = useTranslation(); diff --git a/web/src/pages/user-setting/mcp/edit-mcp-dialog.tsx b/web/src/pages/user-setting/mcp/edit-mcp-dialog.tsx index 3e33c4c2e..c60eb1ecb 100644 --- a/web/src/pages/user-setting/mcp/edit-mcp-dialog.tsx +++ b/web/src/pages/user-setting/mcp/edit-mcp-dialog.tsx @@ -1,14 +1,8 @@ import { Collapse } from '@/components/collapse'; import { Button, ButtonLoading } from '@/components/ui/button'; import { Card, CardContent } from '@/components/ui/card'; -import { - Dialog, - DialogClose, - DialogContent, - DialogFooter, - DialogHeader, - DialogTitle, -} from '@/components/ui/dialog'; +import { DialogClose, DialogFooter } from '@/components/ui/dialog'; +import { Modal } from '@/components/ui/modal/modal'; import { useGetMcpServer, useTestMcpServer } from '@/hooks/use-mcp-request'; import { IModalProps } from '@/interfaces/common'; import { IMCPTool, IMCPToolObject } from '@/interfaces/database/mcp'; @@ -114,50 +108,73 @@ export function EditMcpDialog({ const disabled = !!!tools?.length || testLoading || fieldChanged; return ( - - - - {id ? t('mcp.editMCP') : t('mcp.addMCP')} - - - - - - {nextTools?.length || 0} {t('mcp.toolsAvailable')} - - } - open={collapseOpen} - onOpenChange={setCollapseOpen} - rightContent={ - - - - } - > - - {nextTools?.map((x) => ( - - ))} - - - - + // + // + // + // {id ? t('mcp.editMCP') : t('mcp.addMCP')} + // + // + // + // + // + // {nextTools?.length || 0} {t('mcp.toolsAvailable')} + // + // } + // open={collapseOpen} + // onOpenChange={setCollapseOpen} + // rightContent={ + // + // + // + // } + // > + // + // {nextTools?.map((x) => ( + // + // ))} + // + // + // + // + // + // + // {t('common.cancel')} + // + // + // {t('common.save')} + // + // + // + // + {t('common.cancel')} @@ -172,7 +189,47 @@ export function EditMcpDialog({ {t('common.save')} - - + } + > + + + + + {nextTools?.length || 0} {t('mcp.toolsAvailable')} + + } + open={collapseOpen} + onOpenChange={setCollapseOpen} + rightContent={ + + + + } + > + + {nextTools?.map((x) => ( + + ))} + + + + + ); } diff --git a/web/src/pages/user-setting/mcp/tool-card.tsx b/web/src/pages/user-setting/mcp/tool-card.tsx index 123b4a611..fa82446db 100644 --- a/web/src/pages/user-setting/mcp/tool-card.tsx +++ b/web/src/pages/user-setting/mcp/tool-card.tsx @@ -7,7 +7,7 @@ export type McpToolCardProps = { export function McpToolCard({ data }: McpToolCardProps) { return ( - {data.name} + {data.name} {data.description} diff --git a/web/src/pages/user-setting/setting-model/components/system-setting.tsx b/web/src/pages/user-setting/setting-model/components/system-setting.tsx index 97906a421..398804fcd 100644 --- a/web/src/pages/user-setting/setting-model/components/system-setting.tsx +++ b/web/src/pages/user-setting/setting-model/components/system-setting.tsx @@ -139,7 +139,7 @@ const SystemSetting = ({ onOk, loading }: IProps) => { }) => { return ( - + {isRequired && *} {label} {tooltip && (