Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

♻️ refactor: remove unused React components (#17176)

René Wangc74570b3c114
diff --git a/packages/builtin-tool-agent-builder/src/client/Render/components/ConfigCard.tsx b/packages/builtin-tool-agent-builder/src/client/Render/components/ConfigCard.tsx
deleted file mode 100644
index 970bee480be..00000000000
--- a/packages/builtin-tool-agent-builder/src/client/Render/components/ConfigCard.tsx
+++ /dev/null
@@ -1,33 +0,0 @@
-import { Flexbox } from '@lobehub/ui';
-import { memo } from 'react';
-
-interface ConfigCardProps {
- config: Record<string, unknown>;
- title?: string;
-}
-
-const ConfigCard = memo<ConfigCardProps>(({ config, title }) => {
- return (
- <Flexbox gap={8} style={{ fontSize: 13 }}>
- {title && (
- <span style={{ color: 'var(--lobe-text-secondary)', fontWeight: 500 }}>{title}</span>
- )}
- <pre
- style={{
- background: 'var(--lobe-fill-tertiary)',
- borderRadius: 6,
- color: 'var(--lobe-text)',
- fontSize: 12,
- margin: 0,
- maxHeight: 400,
- overflow: 'auto',
- padding: 12,
- }}
- >
- {JSON.stringify(config, null, 2)}
- </pre>
- </Flexbox>
- );
-});
-
-export default ConfigCard;
diff --git a/packages/builtin-tool-cloud-sandbox/src/client/Render/EditLocalFile/index.tsx b/packages/builtin-tool-cloud-sandbox/src/client/Render/EditLocalFile/index.tsx
deleted file mode 100644
index c2591d04991..00000000000
--- a/packages/builtin-tool-cloud-sandbox/src/client/Render/EditLocalFile/index.tsx
+++ /dev/null
@@ -1,109 +0,0 @@
-'use client';
-
-import { CheckCircleFilled, CloseCircleFilled } from '@ant-design/icons';
-import type { BuiltinRenderProps } from '@lobechat/types';
-import { ActionIcon, Block, Flexbox, Highlighter, Text } from '@lobehub/ui';
-import { createStaticStyles, cssVar } from 'antd-style';
-import { ChevronDown, ChevronUp } from 'lucide-react';
-import { memo, useState } from 'react';
-
-import type { EditLocalFileState } from '../../../types';
-
-const styles = createStaticStyles(({ css }) => ({
- container: css`
- overflow: hidden;
- padding-inline: 8px 0;
- `,
- header: css`
- .action-icon {
- opacity: 0;
- transition: opacity 0.2s ease;
- }
-
- &:hover {
- .action-icon {
- opacity: 1;
- }
- }
- `,
- statusIcon: css`
- font-size: 12px;
- `,
-}));
-
-interface EditLocalFileParams {
- all?: boolean;
- path: string;
- replace: string;
- search: string;
-}
-
-const EditLocalFile = memo<BuiltinRenderProps<EditLocalFileParams, EditLocalFileState>>(
- ({ args, pluginState }) => {
- const [expanded, setExpanded] = useState(false);
- const isSuccess = pluginState && pluginState.replacements > 0;
-
- const statsText =
- pluginState?.linesAdded || pluginState?.linesDeleted
- ? `+${pluginState.linesAdded || 0} -${pluginState.linesDeleted || 0}`
- : '';
-
- return (
- <Flexbox className={styles.container} gap={8}>
- {/* Header */}
- <Flexbox horizontal align={'center'} className={styles.header} justify={'space-between'}>
- <Flexbox horizontal align={'center'} gap={8}>
- {pluginState === undefined ? null : isSuccess ? (
- <CheckCircleFilled
- className={styles.statusIcon}
- style={{ color: cssVar.colorSuccess }}
- />
- ) : (
- <CloseCircleFilled
- className={styles.statusIcon}
- style={{ color: cssVar.colorError }}
- />
- )}
- <Text code as={'span'} fontSize={12}>
- {pluginState?.replacements || 0} replacement(s) in {args.path}
- </Text>
- {statsText && (
- <Text code as={'span'} fontSize={11} type={'secondary'}>
- ({statsText})
- </Text>
- )}
- </Flexbox>
- {pluginState?.diffText && (
- <ActionIcon
- className={`action-icon`}
- icon={expanded ? ChevronUp : ChevronDown}
- size={'small'}
- style={{ opacity: expanded ? 1 : undefined }}
- title={expanded ? 'Hide diff' : 'Show diff'}
- onClick={() => setExpanded(!expanded)}
- />
- )}
- </Flexbox>
-
- {/* Diff view */}
- {expanded && pluginState?.diffText && (
- <Block padding={0} variant={'outlined'}>
- <Highlighter
- wrap
- language={'diff'}
- showLanguage={false}
- style={{ maxHeight: 300, overflow: 'auto' }}
- variant={'borderless'}
- >
- {pluginState.diffText}
- </Highlighter>
- </Block>
- )}
- </Flexbox>
- );
- },
-);
-
-EditLocalFile.displayName = 'EditLocalFile';
-
-export default EditLocalFile;
diff --git a/packages/builtin-tool-cloud-sandbox/src/client/Render/ListFiles/index.tsx b/packages/builtin-tool-cloud-sandbox/src/client/Render/ListFiles/index.tsx
deleted file mode 100644
index 0a469ae534a..00000000000
--- a/packages/builtin-tool-cloud-sandbox/src/client/Render/ListFiles/index.tsx
+++ /dev/null
@@ -1,111 +0,0 @@
-'use client';
-
-import type { BuiltinRenderProps } from '@lobechat/types';
-import { Block, Flexbox, Text } from '@lobehub/ui';
-import { createStaticStyles } from 'antd-style';
-import { File, Folder } from 'lucide-react';
-import { memo } from 'react';
-
-import type { ListLocalFilesState } from '../../../types';
-
-const styles = createStaticStyles(({ css, cssVar }) => ({
- container: css`
- overflow: hidden;
- padding-inline: 8px 0;
- `,
- fileIcon: css`
- color: ${cssVar.colorTextSecondary};
- `,
- fileItem: css`
- cursor: default;
- padding-block: 4px;
- padding-inline: 8px;
- border-radius: 4px;
-
- &:hover {
- background: ${cssVar.colorFillTertiary};
- }
- `,
- folderIcon: css`
- color: ${cssVar.colorWarning};
- `,
-}));
-
-interface ListLocalFilesParams {
- directoryPath: string;
-}
-
-/**
- * Format file size to human readable string
- */
-const formatSize = (bytes?: number): string => {
- if (bytes === undefined) return '';
- if (bytes < 1024) return `${bytes} B`;
- if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
- if (bytes < 1024 * 1024 * 1024) return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
- return `${(bytes / (1024 * 1024 * 1024)).toFixed(1)} GB`;
-};
-
-const ListFiles = memo<BuiltinRenderProps<ListLocalFilesParams, ListLocalFilesState>>(
- ({ args, pluginState }) => {
- if (!pluginState?.files) {
- return null;
- }
-
- // Sort: directories first, then files, both alphabetically
- const sortedFiles = [...pluginState.files].sort((a, b) => {
- if (a.isDirectory && !b.isDirectory) return -1;
- if (!a.isDirectory && b.isDirectory) return 1;
- return a.name.localeCompare(b.name);
- });
-
- return (
- <Flexbox className={styles.container} gap={8}>
- {/* Directory path */}
- <Flexbox horizontal align={'center'} justify={'space-between'}>
- <Text code ellipsis as={'span'} fontSize={12}>
- 📁 {args.directoryPath}
- </Text>
- <Text code as={'span'} fontSize={11} type={'secondary'}>
- {pluginState.files.length} items
- </Text>
- </Flexbox>
-
- {/* File list */}
- <Block padding={8} style={{ maxHeight: 300, overflow: 'auto' }} variant={'outlined'}>
- <Flexbox gap={2}>
- {sortedFiles.map((file, index) => (
- <Flexbox
- horizontal
- align={'center'}
- className={styles.fileItem}
- justify={'space-between'}
- key={index}
- >
- <Flexbox horizontal align={'center'} gap={8}>
- {file.isDirectory ? (
- <Folder className={styles.folderIcon} size={14} />
- ) : (
- <File className={styles.fileIcon} size={14} />
- )}
- <Text code as={'span'} fontSize={12}>
- {file.name}
- </Text>
- </Flexbox>
- {!file.isDirectory && file.size !== undefined && (
- <Text code as={'span'} fontSize={11} type={'secondary'}>
- {formatSize(file.size)}
- </Text>
- )}
- </Flexbox>
- ))}
- </Flexbox>
- </Block>
- </Flexbox>
- );
- },
-);
-
-ListFiles.displayName = 'ListFiles';
-
-export default ListFiles;
diff --git a/packages/builtin-tool-cloud-sandbox/src/client/Render/MoveLocalFiles/index.tsx b/packages/builtin-tool-cloud-sandbox/src/client/Render/MoveLocalFiles/index.tsx
deleted file mode 100644
index 67b808e7446..00000000000
--- a/packages/builtin-tool-cloud-sandbox/src/client/Render/MoveLocalFiles/index.tsx
+++ /dev/null
@@ -1,107 +0,0 @@
-'use client';
-
-import { CheckCircleFilled, CloseCircleFilled } from '@ant-design/icons';
-import type { BuiltinRenderProps } from '@lobechat/types';
-import { Block, Flexbox, Text } from '@lobehub/ui';
-import { createStaticStyles, cssVar } from 'antd-style';
-import { ArrowRight } from 'lucide-react';
-import { memo } from 'react';
-
-import type { MoveLocalFilesState } from '../../../types';
-
-const styles = createStaticStyles(({ css, cssVar }) => ({
- arrow: css`
- color: ${cssVar.colorTextSecondary};
- `,
- container: css`
- overflow: hidden;
- padding-inline: 8px 0;
- `,
- header: css`
- font-size: 12px;
- `,
- moveItem: css`
- padding-block: 4px;
- padding-inline: 8px;
- border-radius: 4px;
- `,
- statusIcon: css`
- font-size: 12px;
- `,
-}));
-
-interface MoveLocalFilesParams {
- operations: Array<{
- destination: string;
- source: string;
- }>;
-}
-
-const MoveLocalFiles = memo<BuiltinRenderProps<MoveLocalFilesParams, MoveLocalFilesState>>(
- ({ pluginState }) => {
- if (!pluginState?.results) {
- return null;
- }
-
- const allSuccess = pluginState.successCount === pluginState.totalCount;
-
- return (
- <Flexbox className={styles.container} gap={8}>
- {/* Header */}
- <Flexbox horizontal align={'center'} gap={8}>
- {allSuccess ? (
- <CheckCircleFilled
- className={styles.statusIcon}
- style={{ color: cssVar.colorSuccess }}
- />
- ) : (
- <CloseCircleFilled className={styles.statusIcon} style={{ color: cssVar.colorError }} />
- )}
- <Text className={styles.header}>
- Moved {pluginState.successCount}/{pluginState.totalCount} items
- </Text>
- </Flexbox>
-
- {/* Move operations list */}
- <Block padding={8} style={{ maxHeight: 300, overflow: 'auto' }} variant={'outlined'}>
- <Flexbox gap={4}>
- {pluginState.results.map((result, index) => (
- <Flexbox
- horizontal
- align={'center'}
- className={styles.moveItem}
- gap={8}
- key={index}
- style={{
- background: result.success ? cssVar.colorSuccessBg : cssVar.colorErrorBg,
- }}
- >
- {result.success ? (
- <CheckCircleFilled style={{ color: cssVar.colorSuccess, fontSize: 12 }} />
- ) : (
- <CloseCircleFilled style={{ color: cssVar.colorError, fontSize: 12 }} />
- )}
- <Text code ellipsis as={'span'} fontSize={11} style={{ maxWidth: 200 }}>
- {result.source}
- </Text>
- <ArrowRight className={styles.arrow} size={12} />
- <Text code ellipsis as={'span'} fontSize={11} style={{ maxWidth: 200 }}>
- {result.destination}
- </Text>
- {result.error && (
- <Text code as={'span'} fontSize={11} type={'danger'}>
- ({result.error})
- </Text>
- )}
- </Flexbox>
- ))}
- </Flexbox>
- </Block>
- </Flexbox>
- );
- },
-);
-
-MoveLocalFiles.displayName = 'MoveLocalFiles';
-
-export default MoveLocalFiles;
diff --git a/packages/builtin-tool-cloud-sandbox/src/client/Render/ReadLocalFile/index.tsx b/packages/builtin-tool-cloud-sandbox/src/client/Render/ReadLocalFile/index.tsx
deleted file mode 100644
index 1f8b148b20a..00000000000
--- a/packages/builtin-tool-cloud-sandbox/src/client/Render/ReadLocalFile/index.tsx
+++ /dev/null
@@ -1,107 +0,0 @@
-'use client';
-
-import type { BuiltinRenderProps } from '@lobechat/types';
-import { Block, Flexbox, Highlighter, Text } from '@lobehub/ui';
-import { createStaticStyles } from 'antd-style';
-import { memo } from 'react';
-
-import type { ReadLocalFileState } from '../../../types';
-
-const styles = createStaticStyles(({ css }) => ({
- container: css`
- overflow: hidden;
- padding-inline: 8px 0;
- `,
-}));
-
-interface ReadLocalFileParams {
- endLine?: number;
- path: string;
- startLine?: number;
-}
-
-/**
- * Get file extension from path
- */
-const getFileExtension = (path: string): string => {
- const parts = path.split('.');
- return parts.length > 1 ? parts.pop()?.toLowerCase() || 'text' : 'text';
-};
-
-/**
- * Map file extension to Highlighter language
- */
-const getLanguageFromExtension = (ext: string): string => {
- const languageMap: Record<string, string> = {
- css: 'css',
- go: 'go',
- html: 'html',
- java: 'java',
- js: 'javascript',
- json: 'json',
- jsx: 'jsx',
- md: 'markdown',
- py: 'python',
- rs: 'rust',
- scss: 'scss',
- sh: 'bash',
- sql: 'sql',
- ts: 'typescript',
- tsx: 'tsx',
- xml: 'xml',
- yaml: 'yaml',
- yml: 'yaml',
- };
- return languageMap[ext] || 'text';
-};
-
-const ReadLocalFile = memo<BuiltinRenderProps<ReadLocalFileParams, ReadLocalFileState>>(
- ({ args, pluginState }) => {
- if (!pluginState?.content) {
- return null;
- }
-
- const ext = getFileExtension(args.path);
- const language = getLanguageFromExtension(ext);
-
- const lineInfo =
- pluginState.startLine || pluginState.endLine
- ? `Lines ${pluginState.startLine || 1}-${pluginState.endLine || pluginState.totalLines || '?'}`
- : pluginState.totalLines
- ? `${pluginState.totalLines} lines`
- : '';
-
- return (
- <Flexbox className={styles.container} gap={8}>
- {/* File path and info */}
- <Flexbox horizontal align={'center'} justify={'space-between'}>
- <Text code ellipsis as={'span'} fontSize={12}>
- 📄 {args.path}
- </Text>
- {lineInfo && (
- <Text code as={'span'} fontSize={12} type={'secondary'}>
- {lineInfo}
- </Text>
- )}
- </Flexbox>
-
- {/* File content */}
- <Block padding={0} variant={'outlined'}>
- <Highlighter
- showLanguage
- wrap
- language={language}
- style={{ maxHeight: 400, overflow: 'auto' }}
- variant={'borderless'}
- >
- {pluginState.content}
- </Highlighter>
- </Block>
- </Flexbox>
- );
- },
-);
-
-ReadLocalFile.displayName = 'ReadLocalFile';
-
-export default ReadLocalFile;
diff --git a/packages/builtin-tool-cloud-sandbox/src/client/Render/SearchFiles/index.tsx b/packages/builtin-tool-cloud-sandbox/src/client/Render/SearchFiles/index.tsx
deleted file mode 100644
index 072c0a582e7..00000000000
--- a/packages/builtin-tool-cloud-sandbox/src/client/Render/SearchFiles/index.tsx
+++ /dev/null
@@ -1,103 +0,0 @@
-'use client';
-
-import type { BuiltinRenderProps } from '@lobechat/types';
-import { Block, Flexbox, Text } from '@lobehub/ui';
-import { createStaticStyles } from 'antd-style';
-import { File, Folder } from 'lucide-react';
-import { memo } from 'react';
-
-import type { SearchLocalFilesState } from '../../../types';
-
-const styles = createStaticStyles(({ css, cssVar }) => ({
- container: css`
- overflow: hidden;
- padding-inline: 8px 0;
- `,
- fileIcon: css`
- color: ${cssVar.colorTextSecondary};
- `,
- fileItem: css`
- cursor: default;
- padding-block: 4px;
- padding-inline: 8px;
- border-radius: 4px;
-
- &:hover {
- background: ${cssVar.colorFillTertiary};
- }
- `,
- folderIcon: css`
- color: ${cssVar.colorWarning};
- `,
- header: css`
- font-size: 12px;
- `,
-}));
-
-interface SearchLocalFilesParams {
- directory: string;
- fileType?: string;
- keyword?: string;
- modifiedAfter?: string;
- modifiedBefore?: string;
-}
-
-const SearchFiles = memo<BuiltinRenderProps<SearchLocalFilesParams, SearchLocalFilesState>>(
- ({ args, pluginState }) => {
- if (!pluginState?.results) {
- return null;
- }
-
- return (
- <Flexbox className={styles.container} gap={8}>
- {/* Header */}
- <Flexbox horizontal align={'center'} justify={'space-between'}>
- <Text className={styles.header}>
- 🔍 Search in {args.directory}
- {args.keyword && ` for "${args.keyword}"`}
- </Text>
- <Text code as={'span'} fontSize={11} type={'secondary'}>
- {pluginState.totalCount} results
- </Text>
- </Flexbox>
-
- {/* Results list */}
- {pluginState.results.length > 0 && (
- <Block padding={8} style={{ maxHeight: 300, overflow: 'auto' }} variant={'outlined'}>
- <Flexbox gap={2}>
- {pluginState.results.map((file, index) => (
- <Flexbox
- horizontal
- align={'center'}
- className={styles.fileItem}
- justify={'space-between'}
- key={index}
- >
- <Flexbox horizontal align={'center'} gap={8}>
- {file.isDirectory ? (
- <Folder className={styles.folderIcon} size={14} />
- ) : (
- <File className={styles.fileIcon} size={14} />
- )}
- <Flexbox gap={2}>
- <Text code as={'span'} fontSize={12}>
- {file.name}
- </Text>
- <Text code as={'span'} fontSize={11} type={'secondary'}>
- {file.path}
- </Text>
- </Flexbox>
- </Flexbox>
- </Flexbox>
- ))}
- </Flexbox>
- </Block>
- )}
- </Flexbox>
- );
- },
-);
-
-SearchFiles.displayName = 'SearchFiles';
-
-export default SearchFiles;
diff --git a/packages/builtin-tool-cloud-sandbox/src/client/Render/WriteFile/index.tsx b/packages/builtin-tool-cloud-sandbox/src/client/Render/WriteFile/index.tsx
deleted file mode 100644
index 35dec2dc0fa..00000000000
--- a/packages/builtin-tool-cloud-sandbox/src/client/Render/WriteFile/index.tsx
+++ /dev/null
@@ -1,77 +0,0 @@
-'use client';
-
-import type { BuiltinRenderProps } from '@lobechat/types';
-import { Block, Highlighter } from '@lobehub/ui';
-import { memo } from 'react';
-
-import type { WriteLocalFileState } from '../../../types';
-
-interface WriteLocalFileParams {
- content: string;
- createDirectories?: boolean;
- path: string;
-}
-
-/**
- * Get file extension from path
- */
-const getFileExtension = (path: string): string => {
- const parts = path.split('.');
- return parts.length > 1 ? parts.pop()?.toLowerCase() || 'text' : 'text';
-};
-
-/**
- * Map file extension to Highlighter language
- */
-const getLanguageFromExtension = (ext: string): string => {
- const languageMap: Record<string, string> = {
- css: 'css',
- go: 'go',
- html: 'html',
- java: 'java',
- js: 'javascript',
- json: 'json',
- jsx: 'jsx',
- md: 'markdown',
- py: 'python',
- rs: 'rust',
- scss: 'scss',
- sh: 'bash',
- sql: 'sql',
- ts: 'typescript',
- tsx: 'tsx',
- xml: 'xml',
- yaml: 'yaml',
- yml: 'yaml',
- };
- return languageMap[ext] || 'text';
-};
-
-const WriteFile = memo<BuiltinRenderProps<WriteLocalFileParams, WriteLocalFileState>>(
- ({ args }) => {
- if (!args?.content) {
- return null;
- }
-
- const ext = getFileExtension(args.path);
- const language = getLanguageFromExtension(ext);
-
- return (
- <Block padding={8} variant={'outlined'}>
- <Highlighter
- showLanguage
- wrap
- language={language}
- style={{ maxHeight: 400, overflow: 'auto' }}
- variant={'borderless'}
- >
- {args.content}
- </Highlighter>
- </Block>
- );
- },
-);
-
-WriteFile.displayName = 'WriteFile';
-
-export default WriteFile;
diff --git a/packages/builtin-tool-cloud-sandbox/src/client/components/FilePathDisplay.tsx b/packages/builtin-tool-cloud-sandbox/src/client/components/FilePathDisplay.tsx
deleted file mode 100644
index 0a8c53d44ae..00000000000
--- a/packages/builtin-tool-cloud-sandbox/src/client/components/FilePathDisplay.tsx
+++ /dev/null
@@ -1,52 +0,0 @@
-'use client';
-
-import { MaterialFileTypeIcon } from '@lobehub/ui';
-import { createStaticStyles, cssVar } from 'antd-style';
-import path from 'path-browserify-esm';
-import { memo, useMemo } from 'react';
-
-const styles = createStaticStyles(({ css }) => ({
- icon: css`
- flex-shrink: 0;
- margin-inline-end: 4px;
- `,
- text: css`
- color: ${cssVar.colorText};
- `,
-}));
-
-interface FilePathDisplayProps {
- filePath: string;
- isDirectory?: boolean;
-}
-
-export const FilePathDisplay = memo<FilePathDisplayProps>(({ filePath, isDirectory }) => {
- const { displayPath, name } = useMemo(() => {
- if (!filePath) return { displayPath: '', name: '' };
- const { base, dir } = path.parse(filePath);
- const parentDir = path.basename(dir);
- return {
- displayPath: parentDir ? `${parentDir}/${base}` : base,
- name: base,
- };
- }, [filePath]);
-
- if (!filePath) return null;
-
- return (
- <>
- {name && (
- <MaterialFileTypeIcon
- className={styles.icon}
- filename={name}
- size={16}
- type={isDirectory ? 'folder' : 'file'}
- variant={'raw'}
- />
- )}
- {displayPath && <span className={styles.text}>{displayPath}</span>}
- </>
- );
-});
-
-FilePathDisplay.displayName = 'FilePathDisplay';
diff --git a/packages/builtin-tool-web-browsing/src/client/Render/Search/ConfigForm/Form.tsx b/packages/builtin-tool-web-browsing/src/client/Render/Search/ConfigForm/Form.tsx
deleted file mode 100644
index 0f98d5ce942..00000000000
--- a/packages/builtin-tool-web-browsing/src/client/Render/Search/ConfigForm/Form.tsx
+++ /dev/null
@@ -1,108 +0,0 @@
-import { Button, Center, Flexbox, Icon } from '@lobehub/ui';
-import { KeyRoundIcon, Loader2Icon } from 'lucide-react';
-import { memo, useMemo, useState } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import { FormInput, FormPassword } from '@/components/FormInput';
-import { useChatStore } from '@/store/chat';
-import { useUserStore } from '@/store/user';
-import { keyVaultsConfigSelectors } from '@/store/user/selectors';
-
-import SearchXNGIcon from './SearchXNGIcon';
-import { FormAction } from './style';
-
-interface ProviderApiKeyFormProps {
- id: string;
- provider: string;
-}
-
-const Form = memo<ProviderApiKeyFormProps>(({ provider, id }) => {
- const { t } = useTranslation('plugin');
-
- const [apiKey, baseURL, setConfig] = useUserStore((s) => [
- keyVaultsConfigSelectors.getVaultByProvider(provider as any)(s)?.apiKey,
- keyVaultsConfigSelectors.getVaultByProvider(provider as any)(s)?.baseURL,
- s.updateKeyVaultConfig,
- ]);
-
- const [showKey, setShow] = useState(false);
-
- const [resend, deleteMessage] = useChatStore((s) => [s.reInvokeToolMessage, s.deleteMessage]);
-
- const [loading, setLoading] = useState(false);
-
- const avatar = useMemo(() => {
- switch (provider) {
- default: {
- return <SearchXNGIcon />;
- }
- }
- }, [provider]);
-
- return (
- <Center gap={16} style={{ width: 400 }}>
- <FormAction
- avatar={avatar}
- description={t('search.searchxng.description')}
- title={t('search.searchxng.title')}
- >
- <FormInput
- placeholder={'https://searxng.xxx'}
- suffix={<div>{loading && <Icon spin icon={Loader2Icon} />}</div>}
- value={baseURL}
- onChange={(value) => {
- setConfig(provider, { baseURL: value });
- }}
- />
- {showKey ? (
- <FormPassword
- autoComplete={'new-password'}
- placeholder={t('search.searchxng.keyPlaceholder')}
- suffix={<div>{loading && <Icon spin icon={Loader2Icon} />}</div>}
- value={apiKey}
- onChange={(value) => {
- setConfig(provider, { apiKey: value });
- }}
- />
- ) : (
- <Button
- block
- icon={KeyRoundIcon}
- type={'text'}
- onClick={() => {
- setShow(true);
- }}
- >
- {t('search.config.addKey')}
- </Button>
- )}
- <Flexbox gap={12} width={'100%'}>
- <Button
- block
- disabled={loading}
- style={{ marginTop: 8 }}
- type={'primary'}
- onClick={async () => {
- setLoading(true);
- resend(id).then(() => {
- setLoading(false);
- });
- // deleteMessage(id);
- }}
- >
- {t('search.config.confirm')}
- </Button>
- <Button
- onClick={() => {
- deleteMessage(id);
- }}
- >
- {t('search.config.close')}
- </Button>
- </Flexbox>
- </FormAction>
- </Center>
- );
-});
-
-export default Form;
diff --git a/src/components/AnimatedCollapsed/index.tsx b/src/components/AnimatedCollapsed/index.tsx
deleted file mode 100644
index f14ada97755..00000000000
--- a/src/components/AnimatedCollapsed/index.tsx
+++ /dev/null
@@ -1,60 +0,0 @@
-import { AnimatePresence, m } from 'motion/react';
-import { type CSSProperties, type ReactNode } from 'react';
-import { memo } from 'react';
-
-interface AnimatedCollapsedProps {
- children: ReactNode;
- height?: {
- collapsed?: string | number;
- open?: string | number;
- };
- open: boolean;
- style?: CSSProperties;
- styles?: {
- collapsed?: CSSProperties;
- open?: CSSProperties;
- };
- width?: {
- collapsed?: string | number;
- open?: string | number;
- };
-}
-
-const AnimatedCollapsed = memo<AnimatedCollapsedProps>(
- ({ open, children, styles, style, width, height }) => {
- return (
- <AnimatePresence initial={false}>
- {open && (
- <m.div
- animate="open"
- exit="collapsed"
- initial="collapsed"
- style={style}
- transition={{
- duration: 0.2,
- ease: [0.4, 0, 0.2, 1], // Use ease-out easing function
- }}
- variants={{
- collapsed: {
- ...(styles?.collapsed as any),
- height: height?.collapsed ?? 0,
- opacity: 0,
- width: width?.collapsed ?? 0,
- },
- open: {
- ...(styles?.open as any),
- height: height?.open ?? 'auto',
- opacity: 1,
- width: width?.open ?? 'auto',
- },
- }}
- >
- {children}
- </m.div>
- )}
- </AnimatePresence>
- );
- },
-);
-
-export default AnimatedCollapsed;
diff --git a/src/components/DragUpload/index.tsx b/src/components/DragUpload/index.tsx
deleted file mode 100644
index ca4c95590ce..00000000000
--- a/src/components/DragUpload/index.tsx
+++ /dev/null
@@ -1,126 +0,0 @@
-
-import { Center, Flexbox, Icon } from '@lobehub/ui';
-import { createStaticStyles } from 'antd-style';
-import { FileImage, FileText, FileUpIcon } from 'lucide-react';
-import { memo } from 'react';
-import { createPortal } from 'react-dom';
-import { useTranslation } from 'react-i18next';
-
-import { getContainer, useDragUpload } from './useDragUpload';
-
-const BLOCK_SIZE = 64;
-const ICON_SIZE = { size: 36, strokeWidth: 1.5 };
-
-const styles = createStaticStyles(({ css, cssVar }) => {
- return {
- container: css`
- width: 320px;
- height: 200px;
- padding: calc(${cssVar.borderRadiusLG} + 4px);
- border-radius: 16px;
-
- background: ${cssVar.geekblue};
- `,
- content: css`
- width: 100%;
- height: 100%;
- padding: 16px;
- border: 1.5px dashed #fff;
- border-radius: ${cssVar.borderRadiusLG};
- `,
- desc: css`
- font-size: 14px;
- line-height: 22px;
- color: #fff;
- `,
- icon: css`
- border-radius: ${cssVar.borderRadiusLG};
- color: color-mix(in srgb, ${cssVar.geekblue} 95%, black);
- background: color-mix(in srgb, ${cssVar.geekblue} 38%, white);
- `,
- iconGroup: css`
- margin-block-start: -44px;
- `,
- iconLeft: css`
- transform: rotateZ(-20deg) translateX(10px);
- border-radius: ${cssVar.borderRadiusLG};
- color: color-mix(in srgb, ${cssVar.geekblue} 95%, black);
- background: color-mix(in srgb, ${cssVar.geekblue} 68%, white);
- `,
- iconRight: css`
- transform: rotateZ(20deg) translateX(-10px);
- border-radius: ${cssVar.borderRadiusLG};
- color: color-mix(in srgb, ${cssVar.geekblue} 95%, black);
- background: color-mix(in srgb, ${cssVar.geekblue} 68%, white);
- `,
- title: css`
- font-size: 20px;
- font-weight: bold;
- color: #fff;
- `,
- wrapper: css`
- position: fixed;
- z-index: 9999;
- inset: 0;
-
- width: 100%;
- height: 100%;
-
- background: ${cssVar.colorBgMask};
-
- transition: all 0.3s ease-in-out;
- `,
- };
-});
-
-interface DragUploadProps {
- enabledFiles?: boolean;
- onUploadFiles: (files: File[]) => Promise<void>;
-}
-
-const DragUpload = memo<DragUploadProps>(({ enabledFiles = true, onUploadFiles }) => {
- const { t } = useTranslation('components');
-
- const isDragging = useDragUpload(onUploadFiles);
-
- if (isDragging) return;
-
- return createPortal(
- <Center className={styles.wrapper}>
- <div className={styles.container}>
- <Center className={styles.content} gap={12}>
- <Flexbox horizontal className={styles.iconGroup}>
- <Center className={styles.iconLeft} height={BLOCK_SIZE * 1.25} width={BLOCK_SIZE}>
- <Icon icon={FileImage} size={ICON_SIZE} />
- </Center>
- <Center
- className={styles.icon}
- height={BLOCK_SIZE * 1.25}
- width={BLOCK_SIZE}
- style={{
- transform: 'translateY(-12px)',
- zIndex: 1,
- }}
- >
- <Icon icon={FileUpIcon} size={ICON_SIZE} />
- </Center>
- <Center className={styles.iconRight} height={BLOCK_SIZE * 1.25} width={BLOCK_SIZE}>
- <Icon icon={FileText} size={ICON_SIZE} />
- </Center>
- </Flexbox>
- <Flexbox align={'center'} gap={8} style={{ textAlign: 'center' }}>
- <Flexbox className={styles.title}>
- {t(enabledFiles ? 'DragUpload.dragFileTitle' : 'DragUpload.dragTitle')}
- </Flexbox>
- <Flexbox className={styles.desc}>
- {t(enabledFiles ? 'DragUpload.dragFileDesc' : 'DragUpload.dragDesc')}
- </Flexbox>
- </Flexbox>
- </Center>
- </div>
- </Center>,
- getContainer()!,
- );
-});
-
-export default DragUpload;
diff --git a/src/components/GoBack/index.tsx b/src/components/GoBack/index.tsx
deleted file mode 100644
index c270b5a4262..00000000000
--- a/src/components/GoBack/index.tsx
+++ /dev/null
@@ -1,43 +0,0 @@
-import { Flexbox, Icon } from '@lobehub/ui';
-import { createStaticStyles, cssVar } from 'antd-style';
-import { ArrowLeft } from 'lucide-react';
-import { memo } from 'react';
-import { useTranslation } from 'react-i18next';
-import { Link } from 'react-router';
-
-const styles = createStaticStyles(({ css }) => {
- return {
- container: css`
- width: fit-content;
- height: 24px;
- padding-inline: 8px;
- border-radius: 6px;
-
- color: ${cssVar.colorTextTertiary};
-
- &:hover {
- color: ${cssVar.colorTextSecondary};
- background: ${cssVar.colorFillTertiary};
- }
- `,
- };
-});
-
-interface GoBackProps {
- href: string;
-}
-
-const GoBack = memo<GoBackProps>(({ href }) => {
- const { t } = useTranslation('components');
-
- return (
- <Link to={href}>
- <Flexbox horizontal align={'center'} className={styles.container} gap={4}>
- <Icon icon={ArrowLeft} />
- <div>{t('GoBack.back')}</div>
- </Flexbox>
- </Link>
- );
-});
-
-export default GoBack;
diff --git a/src/components/GroupIcon/index.tsx b/src/components/GroupIcon/index.tsx
deleted file mode 100644
index 3a4f18861f8..00000000000
--- a/src/components/GroupIcon/index.tsx
+++ /dev/null
@@ -1,22 +0,0 @@
-import { Center, Icon } from '@lobehub/ui';
-import { createStaticStyles, cssVar } from 'antd-style';
-import { type LucideIcon } from 'lucide-react';
-import { memo } from 'react';
-
-const styles = createStaticStyles(({ css }) => ({
- icon: css`
- border: 1px solid ${cssVar.colorBorderSecondary};
- border-radius: 8px;
- background: ${cssVar.colorBgElevated};
- `,
-}));
-
-const GroupIcon = memo<{ icon: LucideIcon }>(({ icon }) => {
- return (
- <Center className={styles.icon} flex={'none'} height={40} width={40}>
- <Icon icon={icon} size={24} />
- </Center>
- );
-});
-
-export default GroupIcon;
diff --git a/src/components/IndexCard/index.tsx b/src/components/IndexCard/index.tsx
deleted file mode 100644
index 14c9dccbf5d..00000000000
--- a/src/components/IndexCard/index.tsx
+++ /dev/null
@@ -1,145 +0,0 @@
-import { type FlexboxProps } from '@lobehub/ui';
-import { ActionIcon, Center, Flexbox } from '@lobehub/ui';
-import { createStaticStyles, responsive } from 'antd-style';
-import { ChevronDown, ChevronRight } from 'lucide-react';
-import { type ReactNode } from 'react';
-import { memo } from 'react';
-
-const styles = createStaticStyles(({ css, cssVar }) => ({
- card: css`
- position: relative;
-
- overflow: hidden;
-
- border: 1px solid ${cssVar.colorBorderSecondary};
- border-radius: ${cssVar.borderRadiusLG};
-
- background: ${cssVar.colorBgContainer};
- `,
- desc: css`
- font-size: 14px;
- line-height: 1.4;
- color: ${cssVar.colorTextDescription};
- ${responsive.sm} {
- font-size: 12px;
- }
- `,
- expend: css`
- position: absolute;
- inset-block-end: -12px;
- inset-inline-start: 50%;
- transform: translateX(-50%);
-
- border: 1px solid ${cssVar.colorBorderSecondary};
- border-radius: 50%;
-
- background: ${cssVar.colorBgContainer};
- `,
- header: css`
- border-block-end: 1px solid ${cssVar.colorBorderSecondary};
- background: ${cssVar.colorFillQuaternary};
- `,
- more: css`
- border: 1px solid ${cssVar.colorBorderSecondary};
- `,
- title: css`
- font-size: 16px;
- font-weight: bold;
- line-height: 1.4;
- ${responsive.sm} {
- font-size: 14px;
- }
- `,
-}));
-
-interface IndexCardProps extends Omit<FlexboxProps, 'title'> {
- desc?: ReactNode;
- expand?: boolean;
- extra?: ReactNode;
- icon?: ReactNode;
- moreTooltip?: string;
- onExpand?: () => void;
- onMoreClick?: () => void;
- title?: ReactNode;
-}
-
-const IndexCard = memo<IndexCardProps>(
- ({
- expand = true,
- onExpand,
- icon,
- className,
- onMoreClick,
- title,
- extra,
- moreTooltip,
- desc,
- children,
- ...rest
- }) => {
- return (
- <Flexbox
- style={{
- marginBottom: !expand ? 12 : undefined,
- maxWidth: '1024px',
- position: 'relative',
- width: '100%',
- }}
- >
- <Flexbox
- className={styles.card}
- style={{
- paddingBottom: !expand ? 12 : undefined,
- }}
- >
- {title && (
- <Flexbox
- horizontal
- align={'center'}
- className={styles.header}
- gap={16}
- justify={'space-between'}
- padding={16}
- >
- <Flexbox horizontal align={'center'} gap={12}>
- {icon}
- <Flexbox>
- <div className={styles.title}>{title}</div>
- {desc && <div className={styles.desc}>{desc}</div>}
- </Flexbox>
- </Flexbox>
- <Flexbox horizontal align={'center'} gap={8}>
- {extra}
- {onMoreClick && (
- <ActionIcon
- className={styles.more}
- icon={ChevronRight}
- size={{ blockSize: 32, borderRadius: '50%', size: 16 }}
- title={moreTooltip}
- onClick={onMoreClick}
- />
- )}
- </Flexbox>
- </Flexbox>
- )}
- <Flexbox className={className} gap={16} padding={16} width={'100%'} {...rest}>
- {children}
- </Flexbox>
- </Flexbox>
- {!expand && (
- <Center className={styles.expend} height={24} width={24}>
- <ActionIcon
- icon={ChevronDown}
- size={{ blockSize: 24, borderRadius: '50%', size: 16 }}
- onClick={onExpand}
- />
- </Center>
- )}
- </Flexbox>
- );
- },
-);
-
-IndexCard.displayName = 'IndexCard';
-
-export default IndexCard;
diff --git a/src/components/InvalidAPIKey/index.tsx b/src/components/InvalidAPIKey/index.tsx
deleted file mode 100644
index ef77c77d668..00000000000
--- a/src/components/InvalidAPIKey/index.tsx
+++ /dev/null
@@ -1,117 +0,0 @@
-import { ProviderIcon } from '@lobehub/icons';
-import { Center, Flexbox } from '@lobehub/ui';
-import { Button } from '@lobehub/ui/base-ui';
-import { ModelProvider } from 'model-bank';
-import { memo, useMemo, useState } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import { type GlobalLLMProviderKey } from '@/types/user/settings';
-
-import BedrockForm from './Bedrock';
-import ComfyUIForm from './ComfyUIForm';
-import { LoadingContext } from './LoadingContext';
-import ProviderApiKeyForm from './ProviderApiKeyForm';
-
-interface APIKeyFormProps {
- bedrockDescription: string;
- description: string;
- id: string;
- onClose: () => void;
- onRecreate: () => void;
- provider?: string;
-}
-
-const APIKeyForm = memo<APIKeyFormProps>(
- ({ provider, description, bedrockDescription, onRecreate, onClose }) => {
- const { t } = useTranslation('error');
- const [loading, setLoading] = useState(false);
-
- const apiKeyPlaceholder = useMemo(() => {
- switch (provider) {
- case ModelProvider.Anthropic: {
- return 'sk-ant_*****************************';
- }
-
- case ModelProvider.OpenRouter: {
- return 'sk-or-********************************';
- }
-
- case ModelProvider.Perplexity: {
- return 'pplx-********************************';
- }
-
- case ModelProvider.ZhiPu: {
- return '*********************.*************';
- }
-
- case ModelProvider.Groq: {
- return 'gsk_*****************************';
- }
-
- case ModelProvider.DeepSeek: {
- return 'sk_******************************';
- }
-
- case ModelProvider.Qwen: {
- return 'sk-********************************';
- }
-
- case ModelProvider.Github: {
- return 'ghp_*****************************';
- }
-
- default: {
- return '*********************************';
- }
- }
- }, [provider]);
-
- return (
- <LoadingContext value={{ loading, setLoading }}>
- <Center
- gap={16}
- style={{
- maxWidth: provider === ModelProvider.ComfyUI ? 900 : 300,
- width: provider === ModelProvider.ComfyUI ? '80%' : 'auto',
- }}
- >
- {provider === ModelProvider.Bedrock ? (
- <BedrockForm description={bedrockDescription} />
- ) : provider === ModelProvider.ComfyUI ? (
- <ComfyUIForm description={description} />
- ) : (
- <ProviderApiKeyForm
- showEndpoint
- apiKeyPlaceholder={apiKeyPlaceholder}
- avatar={<ProviderIcon provider={provider} size={80} type={'avatar'} />}
- description={description}
- provider={provider as GlobalLLMProviderKey}
- />
- )}
- <Flexbox gap={12} width={'100%'}>
- <Button
- block
- disabled={loading}
- style={{ marginTop: 8 }}
- type={'primary'}
- onClick={() => {
- onRecreate();
- }}
- >
- {t('unlock.confirm')}
- </Button>
- <Button
- onClick={() => {
- onClose();
- }}
- >
- {t('unlock.closeMessage')}
- </Button>
- </Flexbox>
- </Center>
- </LoadingContext>
- );
- },
-);
-
-export default APIKeyForm;
diff --git a/src/components/Loading/FullscreenLoading/index.tsx b/src/components/Loading/FullscreenLoading/index.tsx
deleted file mode 100644
index 9ccf9a02f6b..00000000000
--- a/src/components/Loading/FullscreenLoading/index.tsx
+++ /dev/null
@@ -1,26 +0,0 @@
-import { Center, Flexbox } from '@lobehub/ui';
-import { type ReactNode } from 'react';
-import React, { memo } from 'react';
-
-import { ProductLogo } from '@/components/Branding';
-import { type StageItem } from '@/components/InitProgress';
-import InitProgress from '@/components/InitProgress';
-
-interface FullscreenLoadingProps {
- activeStage: number;
- contentRender?: ReactNode;
- stages: StageItem[];
-}
-
-const FullscreenLoading = memo<FullscreenLoadingProps>(({ activeStage, stages, contentRender }) => {
- return (
- <Flexbox height={'100%'} style={{ position: 'relative', userSelect: 'none' }} width={'100%'}>
- <Center flex={1} gap={16} width={'100%'}>
- <ProductLogo size={48} type={'combine'} />
- {contentRender ? contentRender : <InitProgress activeStage={activeStage} stages={stages} />}
- </Center>
- </Flexbox>
- );
-});
-
-export default FullscreenLoading;
diff --git a/src/components/PanelTitle/index.tsx b/src/components/PanelTitle/index.tsx
deleted file mode 100644
index b8a5181d251..00000000000
--- a/src/components/PanelTitle/index.tsx
+++ /dev/null
@@ -1,40 +0,0 @@
-'use client';
-
-import { Flexbox } from '@lobehub/ui';
-import { createStaticStyles, cssVar } from 'antd-style';
-import { type CSSProperties } from 'react';
-import { memo } from 'react';
-
-const styles = createStaticStyles(({ css }) => ({
- desc: css`
- line-height: 1.4;
- color: ${cssVar.colorTextDescription};
- `,
- header: css`
- padding-block: 24px 0;
- padding-inline: 0.75rem;
- `,
- title: css`
- margin: 0;
- font-size: 26px;
- font-weight: 600;
- line-height: 1.3;
- `,
-}));
-
-interface PanelTitleProps {
- desc?: string;
- style?: CSSProperties;
- title?: string;
-}
-
-const PanelTitle = memo(({ title, desc, style }: PanelTitleProps) => {
- return (
- <Flexbox className={styles.header} gap={4} style={style}>
- <h1 className={styles.title}>{title}</h1>
- <p className={styles.desc}>{desc}</p>
- </Flexbox>
- );
-});
-
-export default PanelTitle;
diff --git a/src/components/ProgressItem/index.tsx b/src/components/ProgressItem/index.tsx
deleted file mode 100644
index 7080a306211..00000000000
--- a/src/components/ProgressItem/index.tsx
+++ /dev/null
@@ -1,75 +0,0 @@
-import { Flexbox } from '@lobehub/ui';
-import { Progress } from 'antd';
-import { createStaticStyles, cssVar, useResponsive } from 'antd-style';
-import { type CSSProperties } from 'react';
-import { memo } from 'react';
-
-const styles = createStaticStyles(({ css }) => ({
- desc: css`
- height: 20px;
- font-size: 12px;
- line-height: 20px;
- color: ${cssVar.colorTextTertiary};
- `,
- title: css`
- font-size: 15px;
- font-weight: bold;
- color: ${cssVar.colorTextSecondary};
- `,
-}));
-
-interface ProgressItemProps {
- className?: string;
- desc?: string;
- legend?: string;
- padding?: number;
- percent: number;
- style?: CSSProperties;
- title: string;
- usage: {
- total: string | number;
- used: string | number;
- };
-}
-
-const ProgressItem = memo<ProgressItemProps>(
- ({ legend, title, desc, usage, percent, style, className }) => {
- const { mobile } = useResponsive();
-
- return (
- <Flexbox className={className} paddingInline={16} style={style} width={'100%'}>
- <Flexbox horizontal align={'center'} justify={'space-between'} width={'100%'}>
- <Flexbox horizontal align={'center'} gap={8}>
- {legend && (
- <Flexbox
- height={8}
- width={8}
- style={{
- background: cssVar.geekblue,
- borderRadius: '50%',
- flex: 'none',
- }}
- />
- )}
- <Flexbox align={'baseline'} gap={mobile ? 0 : 8} horizontal={!mobile}>
- <div className={styles.title}>{title}</div>
- {desc && <div className={styles.desc}>{desc}</div>}
- </Flexbox>
- </Flexbox>
- <div>
- <span style={{ fontWeight: 'bold' }}>{usage.used}</span>
- {['', '/', usage.total].join(' ')}
- </div>
- </Flexbox>
- <Progress
- percent={percent}
- showInfo={false}
- size={'small'}
- strokeColor={cssVar.colorPrimary}
- />
- </Flexbox>
- );
- },
-);
-
-export default ProgressItem;
diff --git a/src/components/SafeSpacing/index.tsx b/src/components/SafeSpacing/index.tsx
deleted file mode 100644
index de31c89c6cd..00000000000
--- a/src/components/SafeSpacing/index.tsx
+++ /dev/null
@@ -1,28 +0,0 @@
-import { type SafeAreaProps } from '@lobehub/ui/mobile';
-import { SafeArea } from '@lobehub/ui/mobile';
-import { memo } from 'react';
-
-import { HEADER_HEIGHT, MOBILE_NABBAR_HEIGHT, MOBILE_TABBAR_HEIGHT } from '@/const/layoutTokens';
-
-interface SafeSpacingProps {
- height?: number;
- mobile?: boolean;
- position?: SafeAreaProps['position'];
-}
-
-const SafeSpacing = memo<SafeSpacingProps>(({ height, position = 'top', mobile }) => {
- let h;
- if (mobile) {
- h = position === 'top' ? MOBILE_NABBAR_HEIGHT : MOBILE_TABBAR_HEIGHT;
- } else {
- h = HEADER_HEIGHT;
- }
- return (
- <>
- <div style={{ flex: 'none', height: height || h }} />
- {mobile && <SafeArea position={position} />}
- </>
- );
-});
-
-export default SafeSpacing;
diff --git a/src/components/SkillSourceTag/index.tsx b/src/components/SkillSourceTag/index.tsx
deleted file mode 100644
index 29b0f174a6b..00000000000
--- a/src/components/SkillSourceTag/index.tsx
+++ /dev/null
@@ -1,41 +0,0 @@
-import { type SkillSource } from '@lobechat/types';
-import { Icon, Tag } from '@lobehub/ui';
-import { BadgeCheck, CircleUser, Package } from 'lucide-react';
-import { memo } from 'react';
-import { useTranslation } from 'react-i18next';
-
-interface SkillSourceTagProps {
- source: SkillSource;
-}
-
-const SkillSourceTag = memo<SkillSourceTagProps>(({ source }) => {
- const { t } = useTranslation('plugin');
-
- switch (source) {
- case 'builtin': {
- return (
- <Tag color={'success'} icon={<Icon icon={BadgeCheck} />} size={'small'}>
- LobeHub
- </Tag>
- );
- }
- case 'market': {
- return (
- <Tag color={'processing'} icon={<Icon icon={CircleUser} />} size={'small'}>
- {t('store.communityPlugin')}
- </Tag>
- );
- }
- case 'user': {
- return (
- <Tag color={'warning'} icon={<Icon icon={Package} />} size={'small'}>
- {t('store.customPlugin')}
- </Tag>
- );
- }
- }
-});
-
-SkillSourceTag.displayName = 'SkillSourceTag';
-
-export default SkillSourceTag;
diff --git a/src/components/StructuredData/index.tsx b/src/components/StructuredData/index.tsx
deleted file mode 100644
index bdac5befb44..00000000000
--- a/src/components/StructuredData/index.tsx
+++ /dev/null
@@ -1,12 +0,0 @@
-import { type FC } from 'react';
-
-const StructuredData: FC<{ ld: any }> = ({ ld }) => {
- return (
- <script
- dangerouslySetInnerHTML={{ __html: JSON.stringify(ld) }}
- id="structured-data"
- type="application/ld+json"
- />
- );
-};
-export default StructuredData;
diff --git a/src/components/TodoList.tsx b/src/components/TodoList.tsx
deleted file mode 100644
index c98732c7ef0..00000000000
--- a/src/components/TodoList.tsx
+++ /dev/null
@@ -1,151 +0,0 @@
-import { Center, Collapse, Flexbox, Icon, Text } from '@lobehub/ui';
-import { createStaticStyles, cssVar } from 'antd-style';
-import { CheckCircle, Circle, ListCheck } from 'lucide-react';
-import { memo } from 'react';
-import { useTranslation } from 'react-i18next';
-
-const styles = createStaticStyles(({ css, cssVar }) => ({
- collapse: css`
- padding-block: 0;
- padding-inline: ${cssVar.paddingXS};
-
- .ant-collapse-content-box {
- padding: 0;
- }
-
- .ant-collapse-header {
- padding: 0 !important;
- color: ${cssVar.colorTextTertiary};
- }
-
- .ant-collapse-expand-icon {
- color: ${cssVar.colorTextTertiary} !important;
- }
- `,
-}));
-
-export interface TodoItem {
- assignee?: string;
- content: string;
- finished?: boolean;
-}
-
-export interface TodoListProps {
- /**
- * Optional function to resolve assignee ID to display name
- */
- resolveAssigneeName?: (assignee: string) => string | undefined;
- /**
- * List of todo items
- */
- todos: TodoItem[];
-}
-
-const TodoList = memo<TodoListProps>(({ todos, resolveAssigneeName }) => {
- const { t } = useTranslation('chat');
-
- const completedCount = todos.filter((todo) => todo.finished).length;
- const totalCount = todos.length;
-
- // Create the header with progress indicator
- const headerContent = (
- <Flexbox horizontal align="center" gap={8} style={{ maxWidth: '100%', overflow: 'hidden' }}>
- <Icon color={cssVar.colorTextTertiary} icon={ListCheck} size={16} style={{ flexShrink: 0 }} />
- <Text
- color={cssVar.colorTextTertiary}
- ellipsis={{ tooltip: true }}
- style={{ flex: 1 }}
- weight={400}
- >
- {completedCount} / {totalCount} {t('supervisor.todoList.title')}
- </Text>
- </Flexbox>
- );
-
- // Create todo items content
- const todoItems =
- todos.length === 0 ? (
- <Flexbox horizontal align="center" gap={8} padding="8px 0">
- <CheckCircle color={cssVar.colorSuccess} size={16} />
- <span
- style={{
- color: cssVar.colorTextSecondary,
- fontSize: cssVar.fontSizeSM,
- }}
- >
- {t('supervisor.todoList.allComplete')}
- </span>
- </Flexbox>
- ) : (
- <Flexbox gap={0}>
- {todos.map((todo, index) => (
- <Flexbox
- horizontal
- align="center"
- gap={8}
- key={index}
- style={{
- borderBottom:
- index < todos.length - 1 ? `1px solid ${cssVar.colorBorderSecondary}` : 'none',
- padding: '8px 0',
- width: '100%',
- }}
- >
- <Center
- style={{
- color: todo.finished ? cssVar.colorSuccess : cssVar.colorTextTertiary,
- flexShrink: 0,
- }}
- >
- {todo.finished ? <CheckCircle size={16} /> : <Circle size={16} />}
- </Center>
- <span
- style={{
- color: todo.finished ? cssVar.colorTextTertiary : cssVar.colorText,
- fontSize: cssVar.fontSize,
- textDecoration: todo.finished ? 'line-through' : 'none',
- }}
- >
- {todo.content}
- </span>
- {todo.assignee && (
- <span
- style={{
- color: cssVar.colorTextTertiary,
- fontSize: cssVar.fontSizeSM,
- marginLeft: 6,
- }}
- >
- @{resolveAssigneeName?.(todo.assignee) ?? todo.assignee}
- </span>
- )}
- </Flexbox>
- ))}
- </Flexbox>
- );
-
- return (
- <Collapse
- className={styles.collapse}
- expandIconPlacement="end"
- size="small"
- variant="borderless"
- items={[
- {
- children: todoItems,
- key: 'todos',
- label: headerContent,
- },
- ]}
- styles={{
- header: {
- fontSize: cssVar.fontSize,
- },
- }}
- />
- );
-});
-
-TodoList.displayName = 'TodoList';
-
-export default TodoList;
diff --git a/src/components/client/ClientOnly.tsx b/src/components/client/ClientOnly.tsx
deleted file mode 100644
index d363b48e8de..00000000000
--- a/src/components/client/ClientOnly.tsx
+++ /dev/null
@@ -1,22 +0,0 @@
-'use client';
-
-import type React from 'react';
-import { type FC, type PropsWithChildren } from 'react';
-import { useEffect, useState } from 'react';
-
-const ClientOnly: FC<PropsWithChildren<{ fallback?: React.ReactNode }>> = ({
- children,
- fallback = null,
-}) => {
- const [mounted, setMounted] = useState(false);
-
- useEffect(() => {
- setMounted(true);
- }, []);
-
- if (!mounted) return fallback;
-
- return children;
-};
-
-export default ClientOnly;
diff --git a/src/components/client/ClientResponsiveContent/index.tsx b/src/components/client/ClientResponsiveContent/index.tsx
deleted file mode 100644
index 11e1f509f7d..00000000000
--- a/src/components/client/ClientResponsiveContent/index.tsx
+++ /dev/null
@@ -1,33 +0,0 @@
-'use client';
-
-import { type FC } from 'react';
-import { memo } from 'react';
-
-import MobileSwitchLoading from '@/features/MobileSwitchLoading';
-import { useIsMobile } from '@/hooks/useIsMobile';
-import { type Loader } from '@/libs/next/dynamic';
-import dynamic from '@/libs/next/dynamic';
-
-interface ClientResponsiveContentProps {
- Desktop: FC;
- Mobile: Loader;
-}
-
-const ClientResponsiveContent = ({ Mobile, Desktop }: ClientResponsiveContentProps) => {
- const MobileComponent = dynamic(Mobile, {
- loading: MobileSwitchLoading,
- ssr: false,
- });
-
- const Content = memo(() => {
- const mobile = useIsMobile();
-
- return mobile ? <MobileComponent /> : <Desktop />;
- });
-
- Content.displayName = 'ClientResponsiveContent';
-
- return Content;
-};
-
-export default ClientResponsiveContent;
diff --git a/src/components/client/ClientResponsiveLayout.tsx b/src/components/client/ClientResponsiveLayout.tsx
deleted file mode 100644
index dff9770ffe4..00000000000
--- a/src/components/client/ClientResponsiveLayout.tsx
+++ /dev/null
@@ -1,33 +0,0 @@
-'use client';
-
-import { type FC, type PropsWithChildren } from 'react';
-import { memo } from 'react';
-
-import MobileSwitchLoading from '@/features/MobileSwitchLoading';
-import { useIsMobile } from '@/hooks/useIsMobile';
-import { type Loader } from '@/libs/next/dynamic';
-import dynamic from '@/libs/next/dynamic';
-
-interface ClientResponsiveLayoutProps {
- Desktop: FC<PropsWithChildren>;
- Mobile: Loader;
-}
-
-const ClientResponsiveLayout = ({ Desktop, Mobile }: ClientResponsiveLayoutProps) => {
- const MobileComponent = dynamic(Mobile, {
- loading: MobileSwitchLoading,
- ssr: false,
- }) as FC<PropsWithChildren>;
-
- const Layout = memo<PropsWithChildren>(({ children }) => {
- const mobile = useIsMobile();
-
- return mobile ? <MobileComponent>{children}</MobileComponent> : <Desktop>{children}</Desktop>;
- });
-
- Layout.displayName = 'ClientLayout';
-
- return Layout;
-};
-
-export default ClientResponsiveLayout;
diff --git a/src/components/server/ServerLayout.tsx b/src/components/server/ServerLayout.tsx
deleted file mode 100644
index 83c250424cf..00000000000
--- a/src/components/server/ServerLayout.tsx
+++ /dev/null
@@ -1,31 +0,0 @@
-import { type FC, type PropsWithChildren, type ReactNode } from 'react';
-
-import { type DynamicLayoutProps } from '@/types/next';
-import { RouteVariants } from '@/utils/server/routeVariants';
-
-interface ServerLayoutProps<T> {
- Desktop: FC<T>;
- Mobile: FC<T>;
-}
-
-interface ServerLayoutInnerProps extends DynamicLayoutProps {
- children: ReactNode;
-}
-
-const ServerLayout =
- <T extends PropsWithChildren>({ Desktop, Mobile }: ServerLayoutProps<T>): FC<T> =>
- // @ts-expect-error
- async (props: ServerLayoutInnerProps) => {
- const { params: paramsPromise, ...res } = props;
- if (!paramsPromise) {
- throw new Error(
- `paramsPromise is required for ServerLayout, please pass params props to ServerLayout`,
- );
- }
-
- const isMobile = await RouteVariants.getIsMobile(props);
-
- return isMobile ? <Mobile {...(res as T)} /> : <Desktop {...(res as T)} />;
- };
-
-export default ServerLayout;
diff --git a/src/features/AgentHome/RecentTopics.tsx b/src/features/AgentHome/RecentTopics.tsx
deleted file mode 100644
index a9de9da76f0..00000000000
--- a/src/features/AgentHome/RecentTopics.tsx
+++ /dev/null
@@ -1,72 +0,0 @@
-'use client';
-
-import { AGENT_CHAT_TOPIC_URL } from '@lobechat/const';
-import { Block, Flexbox, Text } from '@lobehub/ui';
-import { cssVar } from 'antd-style';
-import { BotMessageSquareIcon } from 'lucide-react';
-import { memo } from 'react';
-import { useTranslation } from 'react-i18next';
-import { useParams } from 'react-router';
-import useSWR from 'swr';
-
-import WorkspaceLink from '@/features/Workspace/WorkspaceLink';
-import { agentHomeKeys } from '@/libs/swr/keys';
-import { topicService } from '@/services/topic';
-
-import SectionHeader from './SectionHeader';
-
-const AgentRecentTopics = memo(() => {
- const { t } = useTranslation('chat');
- const { aid } = useParams<{ aid: string }>();
-
- const { data: result, isLoading } = useSWR(aid ? agentHomeKeys.topics(aid) : null, () =>
- topicService.getTopics({ agentId: aid!, current: 0, pageSize: 10 }),
- );
-
- const topics = result?.items;
-
- if (isLoading || !topics || topics.length === 0) return null;
-
- return (
- <Flexbox gap={16}>
- <SectionHeader
- actionLabel={t('topic.viewAll')}
- actionUrl={`/agent/${aid}`}
- icon={BotMessageSquareIcon}
- title={t('topic.recent')}
- />
- <Flexbox horizontal gap={12} style={{ overflowX: 'auto', paddingBottom: 4 }}>
- {topics.map((topic) => (
- <WorkspaceLink
- key={topic.id}
- style={{ color: 'inherit', flexShrink: 0, textDecoration: 'none' }}
- to={AGENT_CHAT_TOPIC_URL(aid!, topic.id)}
- >
- <Block
- clickable
- flex={'none'}
- height={80}
- variant={'outlined'}
- width={180}
- style={{
- borderRadius: cssVar.borderRadiusLG,
- overflow: 'hidden',
- }}
- >
- <Flexbox gap={4} height={'100%'} justify={'center'} padding={12}>
- <Text ellipsis weight={500}>
- {topic.title || t('topic.defaultTitle')}
- </Text>
- <Text ellipsis fontSize={12} type={'secondary'}>
- {topic.updatedAt ? new Date(topic.updatedAt).toLocaleDateString() : ''}
- </Text>
- </Flexbox>
- </Block>
- </WorkspaceLink>
- ))}
- </Flexbox>
- </Flexbox>
- );
-});
-
-export default AgentRecentTopics;
diff --git a/src/features/AgentMockDevtools/Modal.tsx b/src/features/AgentMockDevtools/Modal.tsx
deleted file mode 100644
index 9ac57b34822..00000000000
--- a/src/features/AgentMockDevtools/Modal.tsx
+++ /dev/null
@@ -1,36 +0,0 @@
-import type { ModalInstance } from '@lobehub/ui/base-ui';
-import { createModal } from '@lobehub/ui/base-ui';
-import { memo, useEffect, useRef } from 'react';
-
-import { DevtoolsLayout } from './DevtoolsLayout';
-import { useAgentMockStore } from './store/agentMockStore';
-
-export const Modal = memo(() => {
- const modalOpen = useAgentMockStore((s) => s.modalOpen);
- const setModalOpen = useAgentMockStore((s) => s.setModalOpen);
- const instanceRef = useRef<ModalInstance | null>(null);
-
- useEffect(() => {
- if (modalOpen && !instanceRef.current) {
- instanceRef.current = createModal({
- content: <DevtoolsLayout />,
- footer: null,
- onOpenChange: (open) => {
- if (!open) setModalOpen(false);
- },
- onOpenChangeComplete: (open) => {
- if (!open) instanceRef.current = null;
- },
- styles: { content: { padding: 0 } },
- title: 'Agent Mock DevTools',
- width: 'min(1280px, 92vw)',
- });
- } else if (!modalOpen && instanceRef.current) {
- instanceRef.current.close();
- }
- }, [modalOpen, setModalOpen]);
-
- return null;
-});
-
-Modal.displayName = 'AgentMockModal';
diff --git a/src/features/AgentSetting/AgentDocuments/index.tsx b/src/features/AgentSetting/AgentDocuments/index.tsx
deleted file mode 100644
index 1ab8b3891d2..00000000000
--- a/src/features/AgentSetting/AgentDocuments/index.tsx
+++ /dev/null
@@ -1,237 +0,0 @@
-'use client';
-
-import { Button, confirmModal, Select } from '@lobehub/ui/base-ui';
-import type { TableColumnsType } from 'antd';
-import { App, Popconfirm, Space, Table, Tag, Typography } from 'antd';
-import { memo, useMemo, useState } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import { useClientDataSWR } from '@/libs/swr';
-import { agentDocumentService } from '@/services/agentDocument';
-import { useAgentStore } from '@/store/agent';
-
-interface AgentDocumentItem {
- filename: string;
- id: string;
- templateId: string | null;
- title: string;
-}
-
-interface TemplateItem {
- description?: string;
- filenames: string[];
- id: string;
- name: string;
-}
-
-const DEFAULT_TEMPLATE_ID = 'claw';
-const FILE_PREVIEW_LIMIT = 5;
-
-const AgentDocuments = memo(() => {
- const { t } = useTranslation(['setting', 'common']);
- const { message } = App.useApp();
- const agentId = useAgentStore((s) => s.activeAgentId);
- const [templateId, setTemplateId] = useState(DEFAULT_TEMPLATE_ID);
- const [isInitializingTemplate, setIsInitializingTemplate] = useState(false);
- const [deletingDocumentId, setDeletingDocumentId] = useState<string | null>(null);
-
- const {
- data: documents = [],
- isLoading: isDocumentsLoading,
- mutate: mutateDocuments,
- } = useClientDataSWR<AgentDocumentItem[]>(
- agentId ? ([`agent-documents`, agentId] as const) : null,
- async ([, id]: readonly [string, string]) => agentDocumentService.getDocuments({ agentId: id }),
- );
-
- const { data: templates = [], isLoading: isTemplatesLoading } = useClientDataSWR<TemplateItem[]>(
- 'agent-document-templates',
- () => agentDocumentService.getTemplates(),
- );
-
- const templateOptions = useMemo(
- () =>
- templates
- .filter((item) => item.filenames.length > 0)
- .map((item) => ({ label: item.name, title: item.description, value: item.id })),
- [templates],
- );
-
- const selectedTemplate = useMemo(
- () => templates.find((item) => item.id === templateId),
- [templateId, templates],
- );
-
- const templateSummary = useMemo(() => {
- const templateFilenames = selectedTemplate?.filenames ?? [];
- const existingFilenames = new Set(documents.map((item) => item.filename));
- const overwrittenFilenames = templateFilenames.filter((filename) =>
- existingFilenames.has(filename),
- );
-
- return {
- createdCount: templateFilenames.length - overwrittenFilenames.length,
- overwrittenCount: overwrittenFilenames.length,
- overwrittenFilenames,
- templateFilenames,
- };
- }, [documents, selectedTemplate]);
-
- const removeDocument = async (id: string) => {
- if (!agentId) return;
-
- try {
- setDeletingDocumentId(id);
- await agentDocumentService.removeDocument({ agentId, id });
- await mutateDocuments();
- message.success(t('agentDocuments.deleteSuccess'));
- } catch (error) {
- message.error(error instanceof Error ? error.message : 'Failed to delete document');
- } finally {
- setDeletingDocumentId((currentId) => (currentId === id ? null : currentId));
- }
- };
-
- const columns: TableColumnsType<AgentDocumentItem> = [
- {
- dataIndex: 'title',
- key: 'title',
- render: (_: unknown, item) => (
- <Space direction={'vertical'} size={0}>
- <Typography.Text strong>{item.title || item.filename}</Typography.Text>
- <Typography.Text type={'secondary'}>{item.filename}</Typography.Text>
- </Space>
- ),
- title: t('agentDocuments.columns.document'),
- },
- {
- dataIndex: 'templateId',
- key: 'templateId',
- render: (value: unknown) => (typeof value === 'string' && value ? <Tag>{value}</Tag> : null),
- title: t('agentDocuments.columns.template'),
- width: 160,
- },
- {
- key: 'actions',
- render: (_, item) => (
- <Popconfirm
- key={`delete-${item.id}`}
- okButtonProps={{ loading: deletingDocumentId === item.id }}
- title={t('agentDocuments.deleteConfirm')}
- onConfirm={() => removeDocument(item.id)}
- >
- <Button danger loading={deletingDocumentId === item.id} type={'link'}>
- {t('delete', { ns: 'common' })}
- </Button>
- </Popconfirm>
- ),
- title: t('agentDocuments.columns.actions'),
- width: 120,
- },
- ];
-
- const initializeTemplate = async () => {
- if (!agentId) return;
-
- try {
- setIsInitializingTemplate(true);
- await agentDocumentService.initializeFromTemplate({
- agentId,
- templateSet: templateId,
- });
- await mutateDocuments();
- message.success(t('agentDocuments.createSuccess'));
- } catch (error) {
- message.error(error instanceof Error ? error.message : 'Failed to apply template');
- } finally {
- setIsInitializingTemplate(false);
- }
- };
-
- const confirmInitializeTemplate = () => {
- if (!selectedTemplate) return;
-
- const { createdCount, overwrittenCount, overwrittenFilenames } = templateSummary;
-
- if (overwrittenCount === 0) {
- void initializeTemplate();
- return;
- }
-
- const previewFilenames = overwrittenFilenames.slice(0, FILE_PREVIEW_LIMIT);
- const remainingCount = overwrittenCount - previewFilenames.length;
-
- confirmModal({
- content: (
- <Space direction={'vertical'} size={8}>
- <Typography.Text>
- {t('agentDocuments.overwriteConfirm.summary', {
- createCount: createdCount,
- overwriteCount: overwrittenCount,
- templateName: selectedTemplate.name,
- })}
- </Typography.Text>
- <Typography.Text type={'secondary'}>
- {t('agentDocuments.overwriteConfirm.warning')}
- </Typography.Text>
- {previewFilenames.length > 0 ? (
- <Space direction={'vertical'} size={4}>
- {previewFilenames.map((filename) => (
- <Typography.Text code key={filename}>
- {filename}
- </Typography.Text>
- ))}
- {remainingCount > 0 ? (
- <Typography.Text type={'secondary'}>
- {t('agentDocuments.overwriteConfirm.more', { count: remainingCount })}
- </Typography.Text>
- ) : null}
- </Space>
- ) : null}
- </Space>
- ),
- okButtonProps: { danger: true },
- okText: t('agentDocuments.overwriteConfirm.confirm'),
- onOk: async () => initializeTemplate(),
- title: t('agentDocuments.overwriteConfirm.title'),
- });
- };
-
- return (
- <Space direction={'vertical'} size={16} style={{ width: '100%' }}>
- <Typography.Title level={4} style={{ marginBottom: 0, marginTop: 0 }}>
- {t('agentDocuments.title')}
- </Typography.Title>
- <Typography.Text type={'secondary'}>{t('agentDocuments.desc')}</Typography.Text>
-
- <Space wrap align={'center'}>
- <Select
- loading={isTemplatesLoading}
- options={templateOptions}
- style={{ minWidth: 240 }}
- value={templateId}
- onChange={setTemplateId}
- />
- <Button
- disabled={!agentId}
- loading={isInitializingTemplate}
- type={'primary'}
- onClick={confirmInitializeTemplate}
- >
- {t('agentDocuments.createWithTemplate')}
- </Button>
- </Space>
-
- <Table
- columns={columns}
- dataSource={documents}
- loading={isDocumentsLoading}
- locale={{ emptyText: t('agentDocuments.empty') }}
- pagination={false}
- rowKey={'id'}
- />
- </Space>
- );
-});
-
-export default AgentDocuments;
diff --git a/src/features/AgentSetting/AgentMeta/index.tsx b/src/features/AgentSetting/AgentMeta/index.tsx
deleted file mode 100644
index 3c6dec62c48..00000000000
--- a/src/features/AgentSetting/AgentMeta/index.tsx
+++ /dev/null
@@ -1,167 +0,0 @@
-'use client';
-
-import { type FormGroupItemType, type FormItemProps } from '@lobehub/ui';
-import { Form, Icon, Tooltip } from '@lobehub/ui';
-import { Button } from '@lobehub/ui/base-ui';
-import { useUpdateEffect } from 'ahooks';
-import isEqual from 'fast-deep-equal';
-import { Wand2 } from 'lucide-react';
-import { memo, useState } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import { FORM_STYLE } from '@/const/layoutTokens';
-import { INBOX_SESSION_ID } from '@/const/session';
-import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfig';
-
-import { selectors, useStore } from '../store';
-import AutoGenerateAvatar from './AutoGenerateAvatar';
-import AutoGenerateInput from './AutoGenerateInput';
-import AutoGenerateSelect from './AutoGenerateSelect';
-import BackgroundSwatches from './BackgroundSwatches';
-
-const AgentMeta = memo(() => {
- const { t } = useTranslation('setting');
- const [form] = Form.useForm();
- const { isAgentEditable } = useServerConfigStore(featureFlagsSelectors);
- const [hasSystemRole, disabled, updateMeta, autocompleteMeta, autocompleteAllMeta] = useStore(
- (s) => [
- !!s.config.systemRole,
- s.disabled,
- s.setAgentMeta,
- s.autocompleteMeta,
- s.autocompleteAllMeta,
- ],
- );
- const [isInbox, loadingState] = useStore((s) => [s.id === INBOX_SESSION_ID, s.loadingState]);
- const meta = useStore(selectors.currentMetaConfig, isEqual);
- const [background, setBackground] = useState(meta.backgroundColor);
-
- useUpdateEffect(() => {
- form.setFieldsValue(meta);
- }, [meta]);
-
- if (isInbox) return;
-
- const basic = [
- {
- Render: AutoGenerateInput,
- key: 'title',
- label: t('settingAgent.name.title'),
- placeholder: t('settingAgent.name.placeholder'),
- },
- {
- Render: AutoGenerateInput,
- desc: t('settingAgent.description.desc'),
- key: 'description',
- label: t('settingAgent.description.title'),
- placeholder: t('settingAgent.description.placeholder'),
- },
- {
- Render: AutoGenerateSelect,
- desc: t('settingAgent.tag.desc'),
- key: 'tags',
- label: t('settingAgent.tag.title'),
- placeholder: t('settingAgent.tag.placeholder'),
- },
- ];
-
- const autocompleteItems: FormItemProps[] = basic.map((item) => {
- const AutoGenerate = item.Render;
- return {
- children: (
- <AutoGenerate
- canAutoGenerate={hasSystemRole && !disabled}
- disabled={disabled}
- loading={loadingState?.[item.key]}
- placeholder={item.placeholder}
- onGenerate={() => {
- if (disabled) return;
-
- autocompleteMeta(item.key as keyof typeof meta);
- }}
- />
- ),
- label: item.label,
- name: item.key,
- };
- });
-
- const metaData: FormGroupItemType = {
- children: [
- {
- children: (
- <AutoGenerateAvatar
- background={background}
- canAutoGenerate={hasSystemRole && !disabled}
- disabled={disabled}
- loading={loadingState?.['avatar']}
- onGenerate={() => {
- if (disabled) return;
-
- autocompleteMeta('avatar');
- }}
- />
- ),
- label: t('settingAgent.avatar.title'),
- layout: 'horizontal',
- minWidth: undefined,
- name: 'avatar',
- },
- {
- children: (
- <BackgroundSwatches disabled={disabled} onValuesChange={(c) => setBackground(c)} />
- ),
- label: t('settingAgent.backgroundColor.title'),
- minWidth: undefined,
- name: 'backgroundColor',
- },
- ...autocompleteItems,
- ],
- extra: (
- <Tooltip
- title={
- !hasSystemRole
- ? t('autoGenerateTooltipDisabled', { ns: 'common' })
- : t('autoGenerateTooltip', { ns: 'common' })
- }
- >
- <Button
- disabled={disabled || !hasSystemRole}
- icon={<Icon icon={Wand2} size={12} />}
- iconPosition={'end'}
- loading={Object.values(loadingState as any).some((i) => !!i)}
- size={'small'}
- onClick={(e: any) => {
- e.stopPropagation();
- if (disabled) return;
-
- autocompleteAllMeta(true);
- }}
- >
- {t('autoGenerate', { ns: 'common' })}
- </Button>
- </Tooltip>
- ),
- title: t('settingAgent.title'),
- };
-
- return (
- <Form
- disabled={disabled || !isAgentEditable}
- footer={<Form.SubmitFooter />}
- form={form}
- initialValues={meta}
- items={[metaData]}
- itemsType={'group'}
- variant={'borderless'}
- onFinish={(values) => {
- if (disabled) return;
-
- updateMeta(values);
- }}
- {...FORM_STYLE}
- />
- );
-});
-
-export default AgentMeta;
diff --git a/src/features/AgentSetting/AgentPlugin/index.tsx b/src/features/AgentSetting/AgentPlugin/index.tsx
deleted file mode 100644
index e0c40d351f8..00000000000
--- a/src/features/AgentSetting/AgentPlugin/index.tsx
+++ /dev/null
@@ -1,187 +0,0 @@
-'use client';
-
-import { getActivePluginIds } from '@lobechat/types';
-import { type FormGroupItemType } from '@lobehub/ui';
-import { Avatar, Center, Empty, Flexbox, Form, Tag, Tooltip } from '@lobehub/ui';
-import { Button, Switch } from '@lobehub/ui/base-ui';
-import isEqual from 'fast-deep-equal';
-import { BlocksIcon, LucideTrash2, Store } from 'lucide-react';
-import { memo, useCallback } from 'react';
-import { Trans, useTranslation } from 'react-i18next';
-
-import PluginAvatar from '@/components/Plugins/PluginAvatar';
-import PluginTag from '@/components/Plugins/PluginTag';
-import { FORM_STYLE } from '@/const/layoutTokens';
-import { createSkillStoreModal } from '@/features/SkillStore';
-import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';
-import WorkspaceLink from '@/features/Workspace/WorkspaceLink';
-import { useFetchInstalledPlugins } from '@/hooks/useFetchInstalledPlugins';
-import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfig';
-import { pluginHelpers, useToolStore } from '@/store/tool';
-import { toolSelectors } from '@/store/tool/selectors';
-
-import { useStore } from '../store';
-import AddPluginButton from './AddPluginButton';
-import LoadingList from './LoadingList';
-import LocalPluginItem from './LocalPluginItem';
-import PluginAction from './PluginAction';
-
-const AgentPlugin = memo(() => {
- const { t } = useTranslation('setting');
-
- const navigate = useWorkspaceAwareNavigate();
-
- const handleOpenStore = useCallback(() => {
- createSkillStoreModal();
- }, []);
-
- const [userEnabledPlugins, disabled, toggleAgentPlugin] = useStore((s) => [
- // Pinned identifiers only — a disabled plugin is a distinct, valid
- // config state, not a "deprecated" one, and shouldn't show up here.
- getActivePluginIds(s.config.plugins),
- s.disabled,
- s.toggleAgentPlugin,
- ]);
-
- const { showMarket } = useServerConfigStore(featureFlagsSelectors);
- const installedPlugins = useToolStore(toolSelectors.metaList, isEqual);
-
- const { isLoading } = useFetchInstalledPlugins();
-
- const isEmpty = installedPlugins.length === 0 && userEnabledPlugins.length === 0;
-
- // =========== Plugin List =========== //
-
- const list = installedPlugins.map(({ identifier, type, meta, author }) => {
- const isCustomPlugin = type === 'customPlugin';
-
- return {
- avatar: <PluginAvatar avatar={pluginHelpers.getPluginAvatar(meta)} size={40} />,
- children: isCustomPlugin ? (
- <LocalPluginItem id={identifier} />
- ) : (
- <PluginAction identifier={identifier} />
- ),
- desc: pluginHelpers.getPluginDesc(meta),
- label: (
- <Flexbox horizontal align={'center'} gap={8}>
- {pluginHelpers.getPluginTitle(meta)}
- <PluginTag author={author} type={type} />
- </Flexbox>
- ),
- layout: 'horizontal',
- minWidth: undefined,
- };
- });
-
- // =========== Deprecated Plugin List =========== //
-
- // Find plugins that are not in installedPlugins
- const deprecatedList = userEnabledPlugins
- .filter((pluginId) => !installedPlugins.some((p) => p.identifier === pluginId))
- .map((id) => ({
- avatar: <Avatar avatar={'♻️'} shape={'square'} size={40} />,
- children: (
- <Switch
- checked={true}
- disabled={disabled}
- onChange={() => {
- if (disabled) return;
-
- toggleAgentPlugin(id);
- }}
- />
- ),
- label: (
- <Flexbox horizontal align={'center'} gap={8}>
- {id}
- <Tag color={'red'}>{t('plugin.installStatus.deprecated')}</Tag>
- </Flexbox>
- ),
- layout: 'horizontal',
- minWidth: undefined,
- tag: id,
- }));
-
- const hasDeprecated = deprecatedList.length > 0;
-
- const loadingSkeleton = LoadingList();
-
- const extra = (
- <Flexbox horizontal gap={4}>
- <AddPluginButton />
- {hasDeprecated ? (
- <Tooltip title={t('plugin.clearDeprecated')}>
- <Button
- disabled={disabled}
- icon={LucideTrash2}
- size={'small'}
- onClick={(e) => {
- e.stopPropagation();
- if (disabled) return;
-
- for (const i of deprecatedList) {
- toggleAgentPlugin(i.tag as string);
- }
- }}
- />
- </Tooltip>
- ) : null}
- {showMarket ? (
- <Tooltip title={t('plugin.store')}>
- <Button
- icon={Store}
- size={'small'}
- onClick={(e) => {
- e.stopPropagation();
- handleOpenStore();
- }}
- />
- </Tooltip>
- ) : null}
- </Flexbox>
- );
-
- const empty = (
- <Center padding={40}>
- <Empty
- descriptionProps={{ fontSize: 14 }}
- icon={BlocksIcon}
- style={{ maxWidth: 400 }}
- description={
- <Trans i18nKey={'plugin.empty'} ns={'setting'}>
- 暂无安装插件,
- <WorkspaceLink
- to={'/community/mcp'}
- onClick={(e) => {
- e.stopPropagation();
- e.preventDefault();
- handleOpenStore();
- navigate('/community/mcp');
- }}
- >
- 前往插件市场
- </WorkspaceLink>
- 安装
- </Trans>
- }
- />
- </Center>
- );
-
- const plugin: FormGroupItemType = {
- children: isLoading
- ? loadingSkeleton
- : isEmpty
- ? showMarket
- ? empty
- : []
- : [...deprecatedList, ...list],
- extra,
- title: t('settingPlugin.title'),
- };
-
- return <Form items={[plugin]} itemsType={'group'} variant={'borderless'} {...FORM_STYLE} />;
-});
-
-export default AgentPlugin;
diff --git a/src/features/AgentSetting/AgentPrompt/index.tsx b/src/features/AgentSetting/AgentPrompt/index.tsx
deleted file mode 100644
index 271554e2f5f..00000000000
--- a/src/features/AgentSetting/AgentPrompt/index.tsx
+++ /dev/null
@@ -1,86 +0,0 @@
-'use client';
-
-import { Flexbox, Form, Icon } from '@lobehub/ui';
-import { Button } from '@lobehub/ui/base-ui';
-import { EditableMessage } from '@lobehub/ui/chat';
-import { PenLineIcon } from 'lucide-react';
-import { memo, useState } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import { FORM_STYLE } from '@/const/layoutTokens';
-import Tokens from '@/features/AgentSetting/AgentPrompt/TokenTag';
-import { useServerConfigStore } from '@/store/serverConfig';
-
-import { useStore } from '../store';
-
-const AgentPrompt = memo(() => {
- const { t } = useTranslation('setting');
- const isMobile = useServerConfigStore((s) => s.isMobile);
- const [editing, setEditing] = useState(false);
- const [systemRole, disabled, updateConfig] = useStore((s) => [
- s.config.systemRole,
- s.disabled,
- s.setAgentConfig,
- ]);
-
- const editButton = !editing && !!systemRole && !disabled && (
- <Button
- icon={<Icon icon={PenLineIcon} size={12} />}
- iconPosition={'end'}
- size={'small'}
- type={'primary'}
- onClick={(e) => {
- e.stopPropagation();
- setEditing(true);
- }}
- >
- {t('edit', { ns: 'common' })}
- </Button>
- );
-
- return (
- <Form
- itemsType={'group'}
- variant={'borderless'}
- items={[
- {
- children: (
- <Flexbox paddingBlock={isMobile ? 16 : 0}>
- <EditableMessage
- editing={editing}
- height={'auto'}
- placeholder={t('settingAgent.prompt.placeholder')}
- showEditWhenEmpty={!disabled}
- value={systemRole}
- variant={'borderless'}
- markdownProps={{
- variant: 'chat',
- }}
- text={{
- cancel: t('cancel', { ns: 'common' }),
- confirm: t('ok', { ns: 'common' }),
- }}
- onChange={(e) => {
- if (disabled) return;
-
- updateConfig({ systemRole: e });
- }}
- onEditingChange={(next) => {
- if (disabled) return;
-
- setEditing(next);
- }}
- />
- {!editing && !!systemRole && <Tokens value={systemRole} />}
- </Flexbox>
- ),
- extra: editButton,
- title: t('settingAgent.prompt.title'),
- },
- ]}
- {...FORM_STYLE}
- />
- );
-});
-
-export default AgentPrompt;
diff --git a/src/features/AgentTopicManager/ToolbarActions.tsx b/src/features/AgentTopicManager/ToolbarActions.tsx
deleted file mode 100644
index 61467aa7193..00000000000
--- a/src/features/AgentTopicManager/ToolbarActions.tsx
+++ /dev/null
@@ -1,74 +0,0 @@
-'use client';
-
-import { ActionIcon, type DropdownItem, DropdownMenu } from '@lobehub/ui';
-import { confirmModal } from '@lobehub/ui/base-ui';
-import { App } from 'antd';
-import { Archive, MoreHorizontal } from 'lucide-react';
-import { memo, useCallback, useMemo } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import { useChatStore } from '@/store/chat';
-import { topicSelectors } from '@/store/chat/selectors';
-
-const THREE_MONTHS_MS = 90 * 24 * 60 * 60 * 1000;
-
-const ToolbarActions = memo(() => {
- const { t } = useTranslation('topic');
- const { message } = App.useApp();
-
- // Operate on the management page's own bucket — not the sidebar's — since
- // the management view is the one the user is acting on here.
- const topics = useChatStore(topicSelectors.agentTopicsViewTopics);
- const updateTopicStatus = useChatStore((s) => s.updateTopicStatus);
-
- const handleArchiveStale = useCallback(() => {
- const cutoff = Date.now() - THREE_MONTHS_MS;
- const stale = (topics ?? []).filter((t) => {
- if (t.status === 'completed') return false;
- const updated =
- typeof t.updatedAt === 'number' ? t.updatedAt : new Date(t.updatedAt).getTime();
- return updated < cutoff;
- });
-
- if (stale.length === 0) {
- message.info(t('management.actionsMenu.archiveStale.noneFound'));
- return;
- }
-
- confirmModal({
- content: t('management.actionsMenu.archiveStale.confirm', { count: stale.length }),
- okText: t('management.actionsMenu.archiveStale.confirmOk'),
- onOk: async () => {
- for (const topic of stale) {
- // 'archived' isn't surfaced in the UI, so we mark stale topics as
- // 'completed' — matches what the user means by "archive" here.
- await updateTopicStatus({ status: 'completed', topicId: topic.id });
- }
- message.success(t('management.actionsMenu.archiveStale.done', { count: stale.length }));
- },
- title: t('management.actionsMenu.archiveStale.title'),
- });
- }, [topics, updateTopicStatus, message, t]);
-
- const items: DropdownItem[] = useMemo(
- () => [
- {
- icon: <Archive size={14} />,
- key: 'archive-stale',
- label: t('management.actionsMenu.archiveStale.label'),
- onClick: handleArchiveStale,
- },
- ],
- [t, handleArchiveStale],
- );
-
- return (
- <DropdownMenu items={items}>
- <ActionIcon icon={MoreHorizontal} title={t('management.actionsMenu.title')} />
- </DropdownMenu>
- );
-});
-
-ToolbarActions.displayName = 'AgentTopicManagerToolbarActions';
-
-export default ToolbarActions;
diff --git a/src/features/AvatarWithUpload/index.tsx b/src/features/AvatarWithUpload/index.tsx
deleted file mode 100644
index fc13980d01f..00000000000
--- a/src/features/AvatarWithUpload/index.tsx
+++ /dev/null
@@ -1,68 +0,0 @@
-'use client';
-
-import { LoadingOutlined } from '@ant-design/icons';
-import { Spin, Upload } from 'antd';
-import React, { memo, useCallback } from 'react';
-
-import { fetchErrorNotification } from '@/components/Error/fetchErrorNotification';
-import { useUserStore } from '@/store/user';
-import { imageToBase64 } from '@/utils/imageToBase64';
-import { createUploadImageHandler } from '@/utils/uploadFIle';
-
-import { type UserAvatarProps } from '../User/UserAvatar';
-import UserAvatar from '../User/UserAvatar';
-
-interface AvatarWithUploadProps extends UserAvatarProps {
- compressSize?: number;
-}
-
-const AvatarWithUpload = memo<AvatarWithUploadProps>(
- ({ size = 40, compressSize = 256, ...rest }) => {
- const updateAvatar = useUserStore((state) => state.updateAvatar);
- const [uploading, setUploading] = React.useState<boolean>(false);
-
- const handleUploadAvatar = useCallback(
- createUploadImageHandler(async (avatar) => {
- try {
- setUploading(true);
- // Prepare image
- const img = new Image();
- img.src = avatar;
-
- // Use Promise to wait for image load
- await new Promise((resolve, reject) => {
- img.addEventListener('load', resolve);
- img.addEventListener('error', reject);
- });
-
- // Compress image
- const webpBase64 = imageToBase64({ img, size: compressSize });
-
- // Upload avatar
- await updateAvatar(webpBase64);
-
- setUploading(false);
- } catch (error) {
- console.error('Failed to upload avatar:', error);
- setUploading(false);
-
- fetchErrorNotification.error({
- errorMessage: error instanceof Error ? error.message : String(error),
- status: 500,
- });
- }
- }),
- [compressSize, updateAvatar],
- );
-
- return (
- <Spin indicator={<LoadingOutlined spin />} spinning={uploading}>
- <Upload beforeUpload={handleUploadAvatar} itemRender={() => void 0} maxCount={1}>
- <UserAvatar clickable size={size} {...(rest as any)} />
- </Upload>
- </Spin>
- );
- },
-);
-
-export default AvatarWithUpload;
diff --git a/src/features/ChatInput/ActionBar/Knowledge/index.tsx b/src/features/ChatInput/ActionBar/Knowledge/index.tsx
deleted file mode 100644
index 1ccc8b19f68..00000000000
--- a/src/features/ChatInput/ActionBar/Knowledge/index.tsx
+++ /dev/null
@@ -1,72 +0,0 @@
-import { LOBE_CHAT_CLOUD } from '@lobechat/business-const';
-import { LibraryBig } from 'lucide-react';
-import { memo, Suspense } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import TipGuide from '@/components/TipGuide';
-import { openAttachKnowledgeModal } from '@/features/LibraryModal';
-import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfig';
-import { useUserStore } from '@/store/user';
-import { preferenceSelectors } from '@/store/user/selectors';
-
-import Action from '../components/Action';
-import { useControls } from './useControls';
-
-const enableKnowledge = true;
-
-const Knowledge = memo(() => {
- const { t } = useTranslation('chat');
- const { enableKnowledgeBase } = useServerConfigStore(featureFlagsSelectors);
- const [showTip, updateGuideState] = useUserStore((s) => [
- preferenceSelectors.showUploadFileInKnowledgeBaseTip(s),
- s.updateGuideState,
- ]);
-
- const { items } = useControls({ openAttachKnowledgeModal });
-
- if (!enableKnowledgeBase) return null;
- if (!enableKnowledge)
- return (
- <Action
- disabled
- icon={LibraryBig}
- showTooltip={true}
- title={t('knowledgeBase.disabled', { cloud: LOBE_CHAT_CLOUD })}
- />
- );
-
- const content = (
- <Action
- icon={LibraryBig}
- showTooltip={false}
- title={t('knowledgeBase.title')}
- dropdown={{
- maxHeight: 500,
- maxWidth: 480,
- menu: { items },
- minWidth: 240,
- }}
- />
- );
-
- return (
- <Suspense fallback={<Action disabled icon={LibraryBig} title={t('knowledgeBase.title')} />}>
- {showTip ? (
- <TipGuide
- open={showTip}
- placement={'top'}
- title={t('knowledgeBase.uploadGuide')}
- onOpenChange={() => {
- updateGuideState({ uploadFileInKnowledgeBase: false });
- }}
- >
- {content}
- </TipGuide>
- ) : (
- content
- )}
- </Suspense>
- );
-});
-
-export default Knowledge;
diff --git a/src/features/ChatInput/Desktop/FilePreview/index.tsx b/src/features/ChatInput/Desktop/FilePreview/index.tsx
deleted file mode 100644
index 3b8c39c3853..00000000000
--- a/src/features/ChatInput/Desktop/FilePreview/index.tsx
+++ /dev/null
@@ -1,12 +0,0 @@
-import { memo } from 'react';
-
-import FileItemList from './FileList';
-
-/**
- * Note: Drag upload is now handled by DragUploadZone in the parent Desktop component.
- */
-const FilePreview = memo(() => {
- return <FileItemList />;
-});
-
-export default FilePreview;
diff --git a/src/features/ChatInput/Desktop/MentionedUsers/index.tsx b/src/features/ChatInput/Desktop/MentionedUsers/index.tsx
deleted file mode 100644
index 954cf788377..00000000000
--- a/src/features/ChatInput/Desktop/MentionedUsers/index.tsx
+++ /dev/null
@@ -1,51 +0,0 @@
-import { Flexbox } from '@lobehub/ui';
-import { createStaticStyles, cssVar } from 'antd-style';
-import { memo } from 'react';
-
-import { useMentionStore } from '@/store/mention';
-import { mentionSelectors } from '@/store/mention/selectors';
-import { useSessionStore } from '@/store/session';
-import { sessionSelectors } from '@/store/session/selectors';
-
-import MentionedUserItem from './MentionedUserItem';
-
-const styles = createStaticStyles(({ css }) => ({
- container: css`
- overflow-x: scroll;
-
- width: 100%;
- border-start-start-radius: 8px;
- border-start-end-radius: 8px;
-
- background: color-mix(in srgb, ${cssVar.colorBgLayout} 99%, white);
- `,
-}));
-
-const MentionedUsers = memo(() => {
- const currentSession = useSessionStore(sessionSelectors.currentSession);
- const mentionedUsers = useMentionStore(mentionSelectors.mentionedUsers);
- const hasMentionedUsers = useMentionStore(mentionSelectors.hasMentionedUsers);
-
- if (currentSession?.type !== 'group' || !hasMentionedUsers) return null;
-
- const mentionedAgents = currentSession.members?.filter(
- (agent) => agent.id && mentionedUsers.includes(agent.id),
- );
-
- if (mentionedAgents?.length === 0) return null;
-
- return (
- <Flexbox
- horizontal
- className={styles.container}
- gap={6}
- padding={hasMentionedUsers ? '16px 16px 12px' : 0}
- >
- {mentionedAgents?.map((agent) => (
- <MentionedUserItem agent={agent} key={agent.id} />
- ))}
- </Flexbox>
- );
-});
-
-export default MentionedUsers;
diff --git a/src/features/ChatInput/SendArea/ShortcutHint.tsx b/src/features/ChatInput/SendArea/ShortcutHint.tsx
deleted file mode 100644
index 5107f4191de..00000000000
--- a/src/features/ChatInput/SendArea/ShortcutHint.tsx
+++ /dev/null
@@ -1,53 +0,0 @@
-import { KeyEnum } from '@lobechat/const/hotkeys';
-import { combineKeys, Flexbox, Hotkey, Text } from '@lobehub/ui';
-import { cssVar } from 'antd-style';
-import { memo } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import { useUserStore } from '@/store/user';
-import { preferenceSelectors } from '@/store/user/selectors';
-
-const ShortcutHint = memo(() => {
- const { t } = useTranslation('chat');
-
- const useCmdEnterToSend = useUserStore(preferenceSelectors.useCmdEnterToSend);
-
- const sendShortcut = useCmdEnterToSend
- ? combineKeys([KeyEnum.Mod, KeyEnum.Enter])
- : KeyEnum.Enter;
-
- const wrapperShortcut = useCmdEnterToSend
- ? KeyEnum.Enter
- : combineKeys([KeyEnum.Mod, KeyEnum.Enter]);
-
- return (
- <Text
- fontSize={12}
- style={{ color: cssVar.colorTextQuaternary, userSelect: 'none', zIndex: 1 }}
- >
- <Flexbox horizontal align={'center'} gap={4} justify={'flex-end'} paddingBlock={4}>
- <Hotkey
- keys={sendShortcut}
- style={{ color: 'inherit' }}
- variant={'borderless'}
- styles={{
- kbdStyle: { color: 'inherit' },
- }}
- />
- <span>{t('input.send')}</span>
- <span>/</span>
- <Hotkey
- keys={wrapperShortcut}
- style={{ color: 'inherit' }}
- variant={'borderless'}
- styles={{
- kbdStyle: { color: 'inherit' },
- }}
- />
- <span>{t('input.warp')}</span>
- </Flexbox>
- </Text>
- );
-});
-
-export default ShortcutHint;
diff --git a/src/features/CommandMenu/ChatList.tsx b/src/features/CommandMenu/ChatList.tsx
deleted file mode 100644
index e0c82dc4614..00000000000
--- a/src/features/CommandMenu/ChatList.tsx
+++ /dev/null
@@ -1,39 +0,0 @@
-import { memo } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import { type ChatMessage } from './types';
-
-interface ChatListProps {
- messages: ChatMessage[];
- styles: {
- chatContainer: string;
- chatMessage: string;
- chatMessageContent: string;
- chatMessageRole: string;
- };
-}
-
-const ChatList = memo<ChatListProps>(({ messages, styles }) => {
- const { t } = useTranslation('common');
-
- return (
- <div className={styles.chatContainer}>
- {messages.length === 0 ? (
- <div style={{ opacity: 0.5, padding: '16px', textAlign: 'center' }}>
- {t('cmdk.aiModeEmptyState')}
- </div>
- ) : (
- messages.map((message) => (
- <div className={styles.chatMessage} key={message.id}>
- <div className={styles.chatMessageRole}>{message.role}</div>
- <div className={styles.chatMessageContent}>{message.content}</div>
- </div>
- ))
- )}
- </div>
- );
-});
-
-ChatList.displayName = 'ChatList';
-
-export default ChatList;
diff --git a/src/features/Conversation/ChatItem/components/Loading.tsx b/src/features/Conversation/ChatItem/components/Loading.tsx
deleted file mode 100644
index 1b7169b38ae..00000000000
--- a/src/features/Conversation/ChatItem/components/Loading.tsx
+++ /dev/null
@@ -1,23 +0,0 @@
-import { Flexbox, Icon } from '@lobehub/ui';
-import { Loader2 } from 'lucide-react';
-import { memo } from 'react';
-
-import { styles } from '../style';
-import { type ChatItemProps } from '../type';
-
-export interface LoadingProps {
- loading?: ChatItemProps['loading'];
- placement?: ChatItemProps['placement'];
-}
-
-const Loading = memo<LoadingProps>(({ loading }) => {
- if (!loading) return null;
-
- return (
- <Flexbox align={'center'} className={styles.loading} justify={'center'}>
- <Icon spin icon={Loader2} size={{ size: 12, strokeWidth: 3 }} />
- </Flexbox>
- );
-});
-
-export default Loading;
diff --git a/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/ErrorResponse.tsx b/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/ErrorResponse.tsx
deleted file mode 100644
index 22b3bd2251a..00000000000
--- a/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/ErrorResponse.tsx
+++ /dev/null
@@ -1,43 +0,0 @@
-import { type ChatMessageError, type ChatPluginPayload } from '@lobechat/types';
-import { Alert, Flexbox, Highlighter } from '@lobehub/ui';
-import { createStaticStyles } from 'antd-style';
-import { memo } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import { getRuntimeErrorMessage } from '@/utils/locale/runtimeErrorMessage';
-
-import PluginSettings from './PluginSettings';
-
-const styles = createStaticStyles(({ css }) => ({
- errorResponseExtra: css`
- padding-inline-start: 12px;
- `,
-}));
-
-interface ErrorResponseProps extends ChatMessageError {
- id: string;
- plugin?: ChatPluginPayload;
-}
-
-const ErrorResponse = memo<ErrorResponseProps>(({ id, type, body, message, plugin }) => {
- const { t } = useTranslation(['error', 'modelRuntime']);
- if (type === 'PluginSettingsInvalid') {
- return <PluginSettings id={id} plugin={plugin} />;
- }
-
- return (
- <Alert
- showIcon
- title={getRuntimeErrorMessage(t, type)}
- type={'secondary'}
- extra={
- <Flexbox className={styles.errorResponseExtra}>
- <Highlighter actionIconSize={'small'} language={'json'} variant={'borderless'}>
- {JSON.stringify(body || { message, type }, null, 2)}
- </Highlighter>
- </Flexbox>
- }
- />
- );
-});
-export default ErrorResponse;
diff --git a/src/features/Conversation/Messages/AssistantGroup/components/WorkflowToolDetail.tsx b/src/features/Conversation/Messages/AssistantGroup/components/WorkflowToolDetail.tsx
deleted file mode 100644
index dc186ff9019..00000000000
--- a/src/features/Conversation/Messages/AssistantGroup/components/WorkflowToolDetail.tsx
+++ /dev/null
@@ -1,48 +0,0 @@
-import { Highlighter } from '@lobehub/ui';
-import { AnimatePresence, m as motion } from 'motion/react';
-import { memo, useMemo } from 'react';
-
-interface WorkflowToolDetailProps {
- content: string;
- open: boolean;
-}
-
-const WorkflowToolDetail = memo<WorkflowToolDetailProps>(({ content, open }) => {
- const language = useMemo(() => {
- const trimmed = content.trimStart();
- if (trimmed.startsWith('{') || trimmed.startsWith('[')) return 'json';
- return 'plaintext';
- }, [content]);
-
- const formatted = useMemo(() => {
- if (language !== 'json') return content;
- try {
- return JSON.stringify(JSON.parse(content), null, 2);
- } catch {
- return content;
- }
- }, [content, language]);
-
- return (
- <AnimatePresence initial={false}>
- {open && (
- <motion.div
- animate={{ height: 'auto', opacity: 1 }}
- exit={{ height: 0, opacity: 0 }}
- initial={{ height: 0, opacity: 0 }}
- key="tool-detail"
- style={{ marginBlock: '4px 8px', overflow: 'hidden', paddingInlineStart: 30 }}
- transition={{ duration: 0.2, ease: [0.4, 0, 0.2, 1] }}
- >
- <Highlighter wrap language={language} variant={'filled'}>
- {formatted}
- </Highlighter>
- </motion.div>
- )}
- </AnimatePresence>
- );
-});
-
-WorkflowToolDetail.displayName = 'WorkflowToolDetail';
-
-export default WorkflowToolDetail;
diff --git a/src/features/Conversation/Messages/Task/components/MessageContent.tsx b/src/features/Conversation/Messages/Task/components/MessageContent.tsx
deleted file mode 100644
index de25f0c9fd9..00000000000
--- a/src/features/Conversation/Messages/Task/components/MessageContent.tsx
+++ /dev/null
@@ -1,74 +0,0 @@
-import { LOADING_FLAT } from '@lobechat/const';
-import { type UIChatMessage } from '@lobechat/types';
-import { Flexbox } from '@lobehub/ui';
-import { memo } from 'react';
-
-import { messageStateSelectors, useConversationStore } from '../../../store';
-import { useMarkdown } from '../../Assistant/useMarkdown';
-import { CollapsedMessage } from '../../AssistantGroup/components/CollapsedMessage';
-import DisplayContent from '../../components/DisplayContent';
-import FileChunks from '../../components/FileChunks';
-import ImageFileListViewer from '../../components/ImageFileListViewer';
-import IntentUnderstanding from '../../components/IntentUnderstanding';
-import Reasoning from '../../components/Reasoning';
-import SearchGrounding from '../../components/SearchGrounding';
-
-const MessageContent = memo<UIChatMessage>(
- ({ id, tools, content, chunksList, search, imageList, metadata, ...props }) => {
- const { drawer, markdownProps } = useMarkdown(id);
- // Use ConversationStore instead of ChatStore
- const generating = useConversationStore(messageStateSelectors.isMessageGenerating(id));
- const isCollapsed = useConversationStore(messageStateSelectors.isMessageCollapsed(id));
- const isReasoning = useConversationStore(messageStateSelectors.isMessageInReasoning(id));
-
- const isToolCallGenerating = generating && (content === LOADING_FLAT || !content) && !!tools;
-
- // TODO: Need to implement isIntentUnderstanding selector in ConversationStore if needed
- const isIntentUnderstanding = false;
-
- const showSearch = !!search && (!!search.citations?.length || !!search.imageResults?.length);
- const showImageItems = !!imageList && imageList.length > 0;
-
- // remove \n to avoid empty content
- // refs: https://github.com/lobehub/lobe-chat/pull/6153
- const showReasoning =
- (!!props.reasoning && props.reasoning.content?.trim() !== '') ||
- (!props.reasoning && isReasoning);
-
- const showFileChunks = !!chunksList && chunksList.length > 0;
-
- if (isCollapsed) return <CollapsedMessage content={content} id={id} />;
-
- return (
- <Flexbox gap={8} id={id}>
- {drawer}
- {showSearch && (
- <SearchGrounding
- citations={search.citations}
- imageResults={search.imageResults}
- imageSearchQueries={search.imageSearchQueries}
- searchQueries={search.searchQueries}
- />
- )}
- {showFileChunks && <FileChunks data={chunksList} />}
- {showReasoning && <Reasoning {...props.reasoning} id={id} />}
- {isIntentUnderstanding ? (
- <IntentUnderstanding />
- ) : (
- <DisplayContent
- content={content}
- hasImages={showImageItems}
- id={id}
- isMultimodal={metadata?.isMultimodal}
- isToolCallGenerating={isToolCallGenerating}
- markdownProps={markdownProps}
- tempDisplayContent={metadata?.tempDisplayContent}
- />
- )}
- {showImageItems && <ImageFileListViewer items={imageList} />}
- </Flexbox>
- );
- },
-);
-
-export default MessageContent;
diff --git a/src/features/Conversation/Messages/Tool/ErrorBoundary/index.tsx b/src/features/Conversation/Messages/Tool/ErrorBoundary/index.tsx
deleted file mode 100644
index 945c7eae829..00000000000
--- a/src/features/Conversation/Messages/Tool/ErrorBoundary/index.tsx
+++ /dev/null
@@ -1,74 +0,0 @@
-'use client';
-
-import { type ErrorInfo, type ReactNode } from 'react';
-import { Component } from 'react';
-
-import { ErrorDisplay } from './ErrorResult';
-
-interface ToolErrorBoundaryProps {
- /**
- * API name being called
- */
- apiName?: string;
- children: ReactNode;
- /**
- * Identifier of the tool (e.g., plugin name)
- */
- identifier?: string;
-}
-
-interface ToolErrorBoundaryState {
- error: Error | null;
- errorInfo: ErrorInfo | null;
- hasError: boolean;
-}
-
-/**
- * ErrorBoundary for Tool rendering components.
- * Catches rendering errors in tool UI and displays a fallback error UI
- * instead of crashing the entire chat interface.
- */
-class ToolErrorBoundary extends Component<ToolErrorBoundaryProps, ToolErrorBoundaryState> {
- public state: ToolErrorBoundaryState = {
- error: null,
- errorInfo: null,
- hasError: false,
- };
-
- public static getDerivedStateFromError(error: Error): Partial<ToolErrorBoundaryState> {
- return { error, hasError: true };
- }
-
- public componentDidCatch(error: Error, errorInfo: ErrorInfo) {
- // Only log, don't setState to avoid re-render loop
- // errorInfo is captured here for logging but we use the error from getDerivedStateFromError
- console.error('[ToolErrorBoundary] Caught error in tool render:', {
- apiName: this.props.apiName,
- componentStack: errorInfo.componentStack,
- error: error.message,
- identifier: this.props.identifier,
- });
-
- // Store errorInfo without triggering re-render if already has error
- if (!this.state.errorInfo) {
- this.setState({ errorInfo });
- }
- }
-
- public render() {
- if (this.state.hasError) {
- return (
- <ErrorDisplay
- apiName={this.props.apiName}
- error={this.state.error}
- errorInfo={this.state.errorInfo}
- identifier={this.props.identifier}
- />
- );
- }
-
- return this.props.children;
- }
-}
-
-export { ToolErrorBoundary };
diff --git a/src/features/DevPanel/features/Table/TooltipContent.tsx b/src/features/DevPanel/features/Table/TooltipContent.tsx
deleted file mode 100644
index 186f074f21a..00000000000
--- a/src/features/DevPanel/features/Table/TooltipContent.tsx
+++ /dev/null
@@ -1,47 +0,0 @@
-import { Flexbox, Highlighter } from '@lobehub/ui';
-import { type ReactNode } from 'react';
-import { memo } from 'react';
-
-import Image from '@/libs/next/Image';
-
-const TooltipContent = memo<{ children: ReactNode }>(({ children }) => {
- if (typeof children !== 'string') return children;
-
- if (children.startsWith('data:image')) {
- return (
- <Image
- unoptimized
- alt={'tooltip-image'}
- src={children}
- style={{ height: 'auto', maxWidth: '100%' }}
- />
- );
- }
-
- if (children.startsWith('http'))
- return (
- <a href={children} rel="noreferrer" target="_blank">
- {children}
- </a>
- );
-
- const code = children.trim().trimEnd();
-
- if ((code.startsWith('{') && code.endsWith('}')) || (code.startsWith('[') && code.endsWith(']')))
- return (
- <Highlighter
- language={'json'}
- variant={'borderless'}
- style={{
- maxHeight: 400,
- overflow: 'auto',
- }}
- >
- {JSON.stringify(JSON.parse(code), null, 2)}
- </Highlighter>
- );
-
- return <Flexbox>{children}</Flexbox>;
-});
-
-export default TooltipContent;
diff --git a/src/features/DevPanel/index.tsx b/src/features/DevPanel/index.tsx
deleted file mode 100644
index c9256e73678..00000000000
--- a/src/features/DevPanel/index.tsx
+++ /dev/null
@@ -1,43 +0,0 @@
-'use client';
-
-import { BookText, Cog, FlagIcon, GlobeLockIcon } from 'lucide-react';
-
-import dynamic from '@/libs/next/dynamic';
-
-import CacheViewer from './CacheViewer';
-import FeatureFlagViewer from './FeatureFlagViewer';
-import MetadataViewer from './MetadataViewer';
-import SystemInspector from './SystemInspector';
-
-const FloatPanel = dynamic(() => import('./features/FloatPanel'), {
- ssr: false,
-});
-
-const DevPanel = () => (
- <FloatPanel
- items={[
- {
- children: <MetadataViewer />,
- icon: <BookText size={16} />,
- key: 'SEO Metadata',
- },
- {
- children: <CacheViewer />,
- icon: <GlobeLockIcon size={16} />,
- key: 'NextJS Caches',
- },
- {
- children: <FeatureFlagViewer />,
- icon: <FlagIcon size={16} />,
- key: 'Feature Flags',
- },
- {
- children: <SystemInspector />,
- icon: <Cog size={16} />,
- key: 'System Status',
- },
- ]}
- />
-);
-
-export default DevPanel;
diff --git a/src/features/EditorCanvas/ErrorBoundary.tsx b/src/features/EditorCanvas/ErrorBoundary.tsx
deleted file mode 100644
index 733831bef11..00000000000
--- a/src/features/EditorCanvas/ErrorBoundary.tsx
+++ /dev/null
@@ -1,67 +0,0 @@
-'use client';
-
-import { Alert } from '@lobehub/ui';
-import { type ErrorInfo, type ReactNode } from 'react';
-import { Component } from 'react';
-
-interface EditorErrorBoundaryState {
- error: Error | null;
- hasError: boolean;
-}
-
-interface EditorErrorBoundaryProps {
- children: ReactNode;
- fallback?: ReactNode;
-}
-
-/**
- * ErrorBoundary for EditorCanvas component.
- * Catches rendering errors in the editor and displays a fallback error UI
- * instead of crashing the entire page.
- */
-export class EditorErrorBoundary extends Component<
- EditorErrorBoundaryProps,
- EditorErrorBoundaryState
-> {
- public state: EditorErrorBoundaryState = {
- error: null,
- hasError: false,
- };
-
- public static getDerivedStateFromError(error: Error): Partial<EditorErrorBoundaryState> {
- return { error, hasError: true };
- }
-
- public componentDidCatch(error: Error, errorInfo: ErrorInfo) {
- console.error('[EditorErrorBoundary] Caught error in editor render:', {
- componentStack: errorInfo.componentStack,
- error: error.message,
- stack: error.stack,
- });
- }
-
- public render() {
- if (this.state.hasError) {
- if (this.props.fallback) {
- return this.props.fallback;
- }
-
- return (
- <Alert
- showIcon
- message={this.state.error?.message || 'An unknown error occurred in the editor'}
- title="Editor Error"
- type="error"
- style={{
- margin: 16,
- overflow: 'hidden',
- position: 'relative',
- width: '100%',
- }}
- />
- );
- }
-
- return this.props.children;
- }
-}
diff --git a/src/features/EditorModal/TextArea.tsx b/src/features/EditorModal/TextArea.tsx
deleted file mode 100644
index 7de224b65f5..00000000000
--- a/src/features/EditorModal/TextArea.tsx
+++ /dev/null
@@ -1,32 +0,0 @@
-import { TextArea, type TextAreaProps } from '@lobehub/ui';
-import { type FC } from 'react';
-
-interface EditorCanvasProps {
- defaultValue?: string;
- onChange?: (value: string) => void;
- style?: TextAreaProps['style'];
- value?: string;
-}
-
-const EditorCanvas: FC<EditorCanvasProps> = ({ defaultValue, value, onChange, style }) => {
- return (
- <TextArea
- defaultValue={defaultValue}
- value={value}
- variant={'borderless'}
- style={{
- cursor: 'text',
- maxHeight: '80vh',
- minHeight: '50vh',
- overflowY: 'auto',
- padding: 16,
- ...style,
- }}
- onChange={(e) => {
- onChange?.(e.target.value);
- }}
- />
- );
-};
-
-export default EditorCanvas;
diff --git a/src/features/Electron/connection/ConnectionMode.tsx b/src/features/Electron/connection/ConnectionMode.tsx
deleted file mode 100644
index af8583780fc..00000000000
--- a/src/features/Electron/connection/ConnectionMode.tsx
+++ /dev/null
@@ -1,206 +0,0 @@
-import { type StorageMode } from '@lobechat/electron-client-ipc';
-import { StorageModeEnum } from '@lobechat/electron-client-ipc';
-import { Center, Flexbox, Input, stopPropagation } from '@lobehub/ui';
-import { Button } from '@lobehub/ui/base-ui';
-import { LobeHub } from '@lobehub/ui/brand';
-import { createStaticStyles } from 'antd-style';
-import { Server } from 'lucide-react';
-import { memo, useCallback, useState } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import { useElectronStore } from '@/store/electron';
-import { electronSyncSelectors } from '@/store/electron/selectors';
-
-import { Option } from './Option';
-
-const styles = createStaticStyles(({ css, cssVar }) => {
- return {
- cardGroup: css`
- width: 400px; /* Increased width */
- `,
- container: css`
- overflow-y: auto;
-
- width: 100%;
- height: 100%;
- padding-block: 0 40px;
- padding-inline: 24px; /* Increased top padding */
- `,
- continueButton: css`
- width: 100%;
- margin-block-start: 40px;
- `,
- groupTitle: css`
- padding-inline-start: 4px; /* Align with card padding */
- font-size: 16px;
- font-weight: 500;
- color: ${cssVar.colorTextSecondary};
- `,
- header: css`
- text-align: center;
- `,
- inputError: css`
- margin-block-start: 8px;
- font-size: 12px;
- color: ${cssVar.colorError};
- `,
- modal: css`
- .ant-drawer-close {
- position: absolute;
- inset-block-start: 8px;
- inset-inline-end: 0;
- }
- `,
- selfHostedInput: css`
- margin-block-start: 12px;
- `,
- selfHostedText: css`
- cursor: pointer;
- font-size: 14px;
- color: ${cssVar.colorTextTertiary};
-
- :hover {
- color: ${cssVar.colorTextSecondary};
- }
- `,
- title: css`
- margin-block: 16px 48px; /* Increased Spacing below title */
- font-size: 24px; /* Increased font size */
- font-weight: 600;
- color: ${cssVar.colorTextHeading};
- `,
- };
-});
-
-type RemoteStorageMode = Extract<StorageMode, 'cloud' | 'selfHost'>;
-
-interface ConnectionModeProps {
- setWaiting: (waiting: boolean) => void;
-}
-
-const ConnectionMode = memo<ConnectionModeProps>(({ setWaiting }) => {
- const { t } = useTranslation(['electron', 'common']);
- const [urlError, setUrlError] = useState<string | undefined>();
-
- const connect = useElectronStore((s) => s.connectRemoteServer);
- const storageMode = useElectronStore(electronSyncSelectors.storageMode);
- const rawRemoteServerUrl = useElectronStore(electronSyncSelectors.rawRemoteServerUrl);
-
- const [selectedOption, setSelectedOption] = useState<RemoteStorageMode>(
- storageMode === StorageModeEnum.SelfHost ? StorageModeEnum.SelfHost : StorageModeEnum.Cloud,
- );
- const [selfHostedUrl, setSelfHostedUrl] = useState(rawRemoteServerUrl);
-
- const validateUrl = useCallback((url: string) => {
- if (!url) {
- return t('remoteServer.urlRequired');
- }
- try {
- new URL(url);
- if (!url.startsWith('http://') && !url.startsWith('https://')) {
- throw new Error('Invalid protocol');
- }
- return undefined;
- } catch {
- return t('remoteServer.invalidUrl');
- }
- }, []);
-
- const handleSelectOption = (option: RemoteStorageMode) => {
- setSelectedOption(option);
- if (option !== StorageModeEnum.SelfHost) {
- setUrlError(undefined);
- } else {
- setUrlError(validateUrl(selfHostedUrl));
- }
- };
-
- const handleContinue = async () => {
- if (selectedOption === StorageModeEnum.SelfHost) {
- const error = validateUrl(selfHostedUrl);
- setUrlError(error);
- if (error) {
- return;
- }
- }
-
- // try to connect
- setWaiting(true);
- await connect({ remoteServerUrl: selfHostedUrl, storageMode: selectedOption });
- };
-
- return (
- <Center className={styles.container}>
- <Flexbox align={'center'} gap={0}>
- <h1 className={styles.title}>{t('sync.mode.title')}</h1>
- </Flexbox>
-
- <Flexbox className={styles.cardGroup} gap={24}>
- <Flexbox gap={16}>
- <Flexbox horizontal align="center" justify="space-between">
- <div className={styles.groupTitle}>{t('sync.mode.cloudSync')}</div>
- <div
- className={styles.selfHostedText}
- onClick={() => handleSelectOption(StorageModeEnum.SelfHost)}
- >
- {t('sync.mode.useSelfHosted')}
- </div>
- </Flexbox>
- <Option
- description={t('sync.lobehubCloud.description')}
- icon={LobeHub}
- isSelected={selectedOption === StorageModeEnum.Cloud}
- label={t('sync.lobehubCloud.title')}
- value={StorageModeEnum.Cloud}
- onClick={handleSelectOption}
- />
- {selectedOption === StorageModeEnum.SelfHost && (
- <Option
- description={t('sync.selfHosted.description')}
- icon={Server}
- isSelected={selectedOption === StorageModeEnum.SelfHost}
- label={t('sync.selfHosted.title')}
- value={StorageModeEnum.SelfHost}
- onClick={handleSelectOption}
- >
- {selectedOption === StorageModeEnum.SelfHost && (
- <>
- <Input
- autoFocus
- className={styles.selfHostedInput}
- placeholder="https://your-lobechat.com"
- status={urlError ? 'error' : undefined}
- value={selfHostedUrl}
- onClick={stopPropagation}
- onChange={(e) => {
- const newUrl = e.target.value;
- setSelfHostedUrl(newUrl);
- setUrlError(validateUrl(newUrl));
- }}
- />
- {urlError && <div className={styles.inputError}>{urlError}</div>}
- </>
- )}
- </Option>
- )}
- </Flexbox>
- </Flexbox>
-
- <Button
- className={styles.continueButton}
- size="large"
- style={{ maxWidth: 400 }}
- type="primary"
- disabled={
- !selectedOption ||
- (selectedOption === StorageModeEnum.SelfHost && (!!urlError || !selfHostedUrl))
- }
- onClick={handleContinue}
- >
- {t('sync.continue')}
- </Button>
- </Center>
- );
-});
-
-export default ConnectionMode;
diff --git a/src/features/Electron/connection/Waiting.tsx b/src/features/Electron/connection/Waiting.tsx
deleted file mode 100644
index 3a4c5d89e56..00000000000
--- a/src/features/Electron/connection/Waiting.tsx
+++ /dev/null
@@ -1,154 +0,0 @@
-'use client';
-
-import { useWatchBroadcast } from '@lobechat/electron-client-ipc';
-import { Flexbox, Highlighter, Icon, Text } from '@lobehub/ui';
-import { Button } from '@lobehub/ui/base-ui';
-import { createStaticStyles } from 'antd-style';
-import { ShieldX } from 'lucide-react';
-import { memo, useEffect, useState } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import { useElectronStore } from '@/store/electron';
-
-import WaitingAnim from './WaitingAnim';
-
-const styles = createStaticStyles(({ css, cssVar }) => ({
- container: css`
- overflow: hidden;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
-
- min-height: 100vh;
-
- color: ${cssVar.colorTextBase};
-
- background-color: ${cssVar.colorBgContainer};
- `,
-
- content: css`
- z-index: 10;
- display: flex;
- flex-direction: column;
- align-items: center;
- `,
-
- description: css`
- margin-block-end: ${cssVar.marginXL} !important;
- color: ${cssVar.colorTextSecondary} !important;
- `,
-
- errorIcon: css`
- margin-block-end: ${cssVar.marginXL};
- color: ${cssVar.colorError};
- `,
-
- errorMessage: css`
- margin-block-end: ${cssVar.marginXL} !important;
- color: ${cssVar.colorError} !important;
- text-align: center;
- `,
-
- helpText: css`
- margin-block-start: ${cssVar.marginLG};
- font-size: ${cssVar.fontSizeSM};
- color: ${cssVar.colorTextTertiary};
- `,
-
- title: css`
- margin-block-end: ${cssVar.marginSM} !important;
- color: ${cssVar.colorText} !important;
- `,
-}));
-
-interface WaitingOAuthProps {
- setIsOpen: (open: boolean) => void;
- setWaiting: (waiting: boolean) => void;
-}
-
-const WaitingOAuth = memo<WaitingOAuthProps>(({ setWaiting, setIsOpen }) => {
- const { t } = useTranslation('electron');
- const [errorMessage, setErrorMessage] = useState<string | null>(null);
- const remoteServerSyncError = useElectronStore((s) => s.remoteServerSyncError);
- const [disconnect, refreshServerConfig, connectRemoteServer, clearRemoteServerSyncError] =
- useElectronStore((s) => [
- s.disconnectRemoteServer,
- s.refreshServerConfig,
- s.connectRemoteServer,
- s.clearRemoteServerSyncError,
- ]);
-
- const handleCancel = async () => {
- await disconnect();
- setWaiting(false);
- setErrorMessage(null);
- clearRemoteServerSyncError();
- };
-
- const handleRetry = async () => {
- setErrorMessage(null);
- clearRemoteServerSyncError();
- const { dataSyncConfig } = useElectronStore.getState();
- await connectRemoteServer(dataSyncConfig);
- };
-
- useEffect(() => {
- if (!remoteServerSyncError?.message) return;
- setErrorMessage(remoteServerSyncError.message);
- }, [remoteServerSyncError?.message]);
-
- useWatchBroadcast('authorizationSuccessful', async () => {
- setIsOpen(false);
- setWaiting(false);
- setErrorMessage(null);
- clearRemoteServerSyncError();
- await refreshServerConfig();
- });
-
- useWatchBroadcast('authorizationFailed', ({ error }) => {
- setErrorMessage(error);
- });
-
- // Error state
- if (errorMessage) {
- return (
- <div className={styles.container}>
- <Flexbox className={styles.content} gap={12}>
- <Flexbox align={'center'}>
- <Icon className={styles.errorIcon} icon={ShieldX} size={64} />
- <Text as={'h4'} className={styles.title}>
- {t('waitingOAuth.errorTitle')}
- </Text>
- </Flexbox>
- <Highlighter language={'log'} style={{ maxHeight: 500, maxWidth: 800, overflow: 'auto' }}>
- {errorMessage}
- </Highlighter>
- <Flexbox horizontal gap={12}>
- <Button onClick={handleCancel}>{t('waitingOAuth.cancel')}</Button>
- <Button type="primary" onClick={handleRetry}>
- {t('waitingOAuth.retry')}
- </Button>
- </Flexbox>
- </Flexbox>
- </div>
- );
- }
-
- // Normal waiting state
- return (
- <div className={styles.container}>
- <div className={styles.content}>
- <WaitingAnim />
- <Text as={'h4'} className={styles.title}>
- {t('waitingOAuth.title')}
- </Text>
- <Text className={styles.description}>{t('waitingOAuth.description')}</Text>
- <Button onClick={handleCancel}>{t('waitingOAuth.cancel')}</Button>
- <Text className={styles.helpText}>{t('waitingOAuth.helpText')}</Text>
- </div>
- </div>
- );
-});
-
-export default WaitingOAuth;
diff --git a/src/features/FileSidePanel/index.tsx b/src/features/FileSidePanel/index.tsx
deleted file mode 100644
index be337368b64..00000000000
--- a/src/features/FileSidePanel/index.tsx
+++ /dev/null
@@ -1,83 +0,0 @@
-'use client';
-
-import { type DraggablePanelProps } from '@lobehub/ui';
-import { DraggablePanel, DraggablePanelContainer } from '@lobehub/ui';
-import { createStaticStyles, cssVar, useResponsive } from 'antd-style';
-import isEqual from 'fast-deep-equal';
-import { type PropsWithChildren } from 'react';
-import { memo, useEffect, useState } from 'react';
-
-import UsageFooter from '@/business/client/features/FileSidePanel/UsageFooter';
-import { FOLDER_WIDTH } from '@/const/layoutTokens';
-import { useGlobalStore } from '@/store/global';
-import { systemStatusSelectors } from '@/store/global/selectors';
-import { serverConfigSelectors, useServerConfigStore } from '@/store/serverConfig';
-
-export const styles = createStaticStyles(({ css }) => ({
- panel: css`
- height: 100%;
- background: ${cssVar.colorBgLayout};
- `,
-}));
-
-const FileSidePanel = memo<PropsWithChildren>(({ children }) => {
- const { md = true } = useResponsive();
- const [filePanelWidth, showFilePanel, updateSystemStatus] = useGlobalStore((s) => [
- systemStatusSelectors.filePanelWidth(s),
- systemStatusSelectors.showFilePanel(s),
- s.updateSystemStatus,
- ]);
- const enableBusinessFeatures = useServerConfigStore(serverConfigSelectors.enableBusinessFeatures);
-
- const [tmpWidth, setWidth] = useState(filePanelWidth);
- if (tmpWidth !== filePanelWidth) setWidth(filePanelWidth);
- const [cacheExpand, setCacheExpand] = useState<boolean>(Boolean(showFilePanel));
-
- const handleExpand = (expand: boolean) => {
- if (isEqual(expand, showFilePanel)) return;
- updateSystemStatus({ showFilePanel: expand });
- setCacheExpand(expand);
- };
- useEffect(() => {
- if (md && cacheExpand) updateSystemStatus({ showFilePanel: true });
- if (!md) updateSystemStatus({ showFilePanel: false });
- }, [md, cacheExpand]);
-
- const handleSizeChange: DraggablePanelProps['onSizeChange'] = (_, size) => {
- if (!size) return;
- const nextWidth = typeof size.width === 'string' ? Number.parseInt(size.width) : size.width;
- if (!nextWidth) return;
-
- if (isEqual(nextWidth, filePanelWidth)) return;
- setWidth(nextWidth);
- updateSystemStatus({ filePanelWidth: nextWidth });
- };
-
- return (
- <DraggablePanel
- className={styles.panel}
- defaultSize={{ width: tmpWidth }}
- expand={showFilePanel}
- maxWidth={280}
- minWidth={FOLDER_WIDTH}
- mode={md ? 'fixed' : 'float'}
- placement="left"
- size={{ height: '100%', width: filePanelWidth }}
- onExpandChange={handleExpand}
- onSizeChange={handleSizeChange}
- >
- <DraggablePanelContainer
- style={{
- flex: 'none',
- height: '100%',
- minWidth: FOLDER_WIDTH,
- }}
- >
- {children}
- {enableBusinessFeatures && <UsageFooter />}
- </DraggablePanelContainer>
- </DraggablePanel>
- );
-});
-
-export default FileSidePanel;
diff --git a/src/features/FileViewer/Renderer/Markdown/index.tsx b/src/features/FileViewer/Renderer/Markdown/index.tsx
deleted file mode 100644
index b10e0b33aba..00000000000
--- a/src/features/FileViewer/Renderer/Markdown/index.tsx
+++ /dev/null
@@ -1,47 +0,0 @@
-'use client';
-
-import { Center, Flexbox, Highlighter } from '@lobehub/ui';
-import { createStaticStyles } from 'antd-style';
-import { memo } from 'react';
-
-import CircleLoading from '@/components/Loading/CircleLoading';
-
-import { useTextFileLoader } from '../../hooks/useTextFileLoader';
-
-const styles = createStaticStyles(({ css, cssVar }) => ({
- page: css`
- width: 100%;
- padding: ${cssVar.paddingLG};
- background: ${cssVar.colorBgContainer};
- `,
-}));
-
-interface MarkdownViewerProps {
- fileId: string;
- url: string | null;
-}
-
-const MarkdownViewer = memo<MarkdownViewerProps>(({ url }) => {
- const { fileData, loading } = useTextFileLoader(url);
-
- return (
- <Flexbox className={styles.page} id="markdown-renderer">
- {!loading && fileData ? (
- <Highlighter
- copyable={false}
- language={'markdown'}
- showLanguage={false}
- variant={'borderless'}
- >
- {fileData}
- </Highlighter>
- ) : (
- <Center height={'100%'}>
- <CircleLoading />
- </Center>
- )}
- </Flexbox>
- );
-});
-
-export default MarkdownViewer;
diff --git a/src/features/Follow/index.tsx b/src/features/Follow/index.tsx
deleted file mode 100644
index 7bf88ab3039..00000000000
--- a/src/features/Follow/index.tsx
+++ /dev/null
@@ -1,62 +0,0 @@
-'use client';
-
-import { SiDiscord, SiGithub, SiMedium, SiX } from '@icons-pack/react-simple-icons';
-import { SOCIAL_URL } from '@lobechat/business-const';
-import { ActionIcon, Flexbox } from '@lobehub/ui';
-import { createStaticStyles, cssVar } from 'antd-style';
-import { memo } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import { GITHUB } from '@/const/url';
-
-const styles = createStaticStyles(({ css }) => {
- return {
- icon: css`
- svg {
- fill: ${cssVar.colorTextDescription};
- }
-
- &:hover {
- svg {
- fill: ${cssVar.colorText};
- }
- }
- `,
- };
-});
-
-const Follow = memo(() => {
- const { t } = useTranslation('common');
- return (
- <Flexbox horizontal gap={8}>
- <a href={GITHUB} rel="noreferrer" target="_blank">
- <ActionIcon
- className={styles.icon}
- icon={SiGithub as any}
- title={t('follow', { name: 'GitHub' })}
- />
- </a>
- <a href={SOCIAL_URL.x} rel="noreferrer" target="_blank">
- <ActionIcon className={styles.icon} icon={SiX as any} title={t('follow', { name: 'X' })} />
- </a>
- <a href={SOCIAL_URL.discord} rel="noreferrer" target="_blank">
- <ActionIcon
- className={styles.icon}
- icon={SiDiscord as any}
- title={t('follow', { name: 'Discord' })}
- />
- </a>
- <a href={SOCIAL_URL.medium} rel="noreferrer" target="_blank">
- <ActionIcon
- className={styles.icon}
- icon={SiMedium as any}
- title={t('follow', { name: 'Medium' })}
- />
- </a>
- </Flexbox>
- );
-});
-
-Follow.displayName = 'Follow';
-
-export default Follow;
diff --git a/src/features/LibraryModal/AssignKnowledgeBase/Item/EditCustomPlugin.tsx b/src/features/LibraryModal/AssignKnowledgeBase/Item/EditCustomPlugin.tsx
deleted file mode 100644
index 54a1d5f21c4..00000000000
--- a/src/features/LibraryModal/AssignKnowledgeBase/Item/EditCustomPlugin.tsx
+++ /dev/null
@@ -1,55 +0,0 @@
-import { ActionIcon } from '@lobehub/ui';
-import isEqual from 'fast-deep-equal';
-import { PackageSearch } from 'lucide-react';
-import { memo, useState } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import DevModal from '@/features/PluginDevModal';
-import { useToolStore } from '@/store/tool';
-import { pluginSelectors } from '@/store/tool/slices/plugin/selectors';
-
-const EditCustomPlugin = memo<{ identifier: string }>(({ identifier }) => {
- const { t } = useTranslation('plugin');
- const [showModal, setModal] = useState(false);
-
- const [installCustomPlugin, updateNewDevPlugin, uninstallCustomPlugin] = useToolStore((s) => [
- s.installCustomPlugin,
- s.updateNewCustomPlugin,
- s.uninstallCustomPlugin,
- ]);
-
- const customPlugin = useToolStore(pluginSelectors.getCustomPluginById(identifier), isEqual);
-
- return (
- <div
- onClick={(e) => {
- e.stopPropagation();
- }}
- >
- <DevModal
- mode={'edit'}
- open={showModal}
- value={customPlugin}
- onOpenChange={setModal}
- onValueChange={updateNewDevPlugin}
- onDelete={() => {
- uninstallCustomPlugin(identifier);
- setModal(false);
- }}
- onSave={async (devPlugin) => {
- await installCustomPlugin(devPlugin);
- setModal(false);
- }}
- />
- <ActionIcon
- icon={PackageSearch}
- title={t('store.actions.manifest')}
- onClick={() => {
- setModal(true);
- }}
- />
- </div>
- );
-});
-
-export default EditCustomPlugin;
diff --git a/src/features/LibraryModal/AssignKnowledgeBase/Item/PluginTag.tsx b/src/features/LibraryModal/AssignKnowledgeBase/Item/PluginTag.tsx
deleted file mode 100644
index 582396c63ba..00000000000
--- a/src/features/LibraryModal/AssignKnowledgeBase/Item/PluginTag.tsx
+++ /dev/null
@@ -1,56 +0,0 @@
-import { Icon, Tag } from '@lobehub/ui';
-import { createStaticStyles, cx } from 'antd-style';
-import { BadgeCheck, CircleUser, Package } from 'lucide-react';
-import { memo } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import { type InstallPluginMeta } from '@/types/tool/plugin';
-
-const styles = createStaticStyles(({ css, cssVar }) => ({
- community: css`
- color: color-mix(in srgb, ${cssVar.colorInfo} 75%, transparent);
- background: ${cssVar.colorInfoBg};
-
- &:hover {
- color: ${cssVar.colorInfo};
- }
- `,
- custom: css`
- color: color-mix(in srgb, ${cssVar.colorWarning} 75%, transparent);
- background: ${cssVar.colorWarningBg};
-
- &:hover {
- color: ${cssVar.colorWarning};
- }
- `,
- official: css`
- color: color-mix(in srgb, ${cssVar.colorSuccess} 75%, transparent);
- background: ${cssVar.colorSuccessBg};
-
- &:hover {
- color: ${cssVar.colorSuccess};
- }
- `,
-}));
-
-interface PluginTagProps extends Pick<InstallPluginMeta, 'author' | 'type'> {
- showIcon?: boolean;
- showText?: boolean;
-}
-
-const PluginTag = memo<PluginTagProps>(({ showIcon = true, author, type, showText = true }) => {
- const { t } = useTranslation('plugin');
- const isCustom = type === 'customPlugin';
- const isOfficial = author === 'LobeHub';
-
- return (
- <Tag
- className={cx(isCustom ? styles.custom : isOfficial ? styles.official : styles.community)}
- icon={showIcon && <Icon icon={isCustom ? Package : isOfficial ? BadgeCheck : CircleUser} />}
- >
- {showText && (author || t(isCustom ? 'store.customPlugin' : 'store.communityPlugin'))}
- </Tag>
- );
-});
-
-export default PluginTag;
diff --git a/src/features/MobileTabBar/index.tsx b/src/features/MobileTabBar/index.tsx
deleted file mode 100644
index 23653c190b3..00000000000
--- a/src/features/MobileTabBar/index.tsx
+++ /dev/null
@@ -1,70 +0,0 @@
-import { Icon } from '@lobehub/ui';
-import { type TabBarProps } from '@lobehub/ui/mobile';
-import { TabBar } from '@lobehub/ui/mobile';
-import { createStaticStyles, cssVar } from 'antd-style';
-import { Bot, MessageSquare, User } from 'lucide-react';
-import { memo, useMemo } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import { useRouter } from '@/libs/router/navigation';
-import { SidebarTabKey } from '@/store/global/initialState';
-import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfig';
-
-const styles = createStaticStyles(({ css }) => ({
- active: css`
- svg {
- fill: color-mix(in srgb, ${cssVar.colorPrimary} 25%, transparent);
- }
- `,
-}));
-
-interface Props {
- className?: string;
- tabBarKey?: SidebarTabKey;
-}
-
-export default memo<Props>(({ className, tabBarKey }) => {
- const { t } = useTranslation('common');
- const router = useRouter();
- const openSettings = () => {
- router.push('/settings/provider/all');
- };
- const { showMarket } = useServerConfigStore(featureFlagsSelectors);
-
- const items: TabBarProps['items'] = useMemo(
- () =>
- [
- {
- icon: (active: boolean) => (
- <Icon className={active ? styles.active : undefined} icon={MessageSquare} />
- ),
- key: SidebarTabKey.Chat,
- onClick: () => {
- router.push('/agent');
- },
- title: t('tab.chat'),
- },
- showMarket && {
- icon: (active: boolean) => (
- <Icon className={active ? styles.active : undefined} icon={Bot} />
- ),
- key: SidebarTabKey.Community,
- onClick: () => {
- router.push('/community');
- },
- title: t('tab.community'),
- },
- {
- icon: (active: boolean) => (
- <Icon className={active ? styles.active : undefined} icon={User} />
- ),
- key: SidebarTabKey.Setting,
- onClick: openSettings,
- title: t('tab.setting'),
- },
- ].filter(Boolean) as TabBarProps['items'],
- [t],
- );
-
- return <TabBar safeArea activeKey={tabBarKey} className={className} items={items} />;
-});
diff --git a/src/features/ModelSwitchPanel/components/Footer.tsx b/src/features/ModelSwitchPanel/components/Footer.tsx
deleted file mode 100644
index 5c493cc89ef..00000000000
--- a/src/features/ModelSwitchPanel/components/Footer.tsx
+++ /dev/null
@@ -1,41 +0,0 @@
-import { Block, Flexbox, Icon } from '@lobehub/ui';
-import { cssVar } from 'antd-style';
-import { LucideArrowRight, LucideBolt } from 'lucide-react';
-import { type FC } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';
-
-import { styles } from '../styles';
-
-interface FooterProps {
- onClose: () => void;
-}
-
-export const Footer: FC<FooterProps> = ({ onClose }) => {
- const { t } = useTranslation('components');
- const navigate = useWorkspaceAwareNavigate();
-
- return (
- <Flexbox className={styles.footer} padding={4}>
- <Block
- clickable
- horizontal
- gap={8}
- paddingBlock={8}
- paddingInline={12}
- variant={'borderless'}
- onClick={() => {
- onClose();
- navigate('/settings/provider/all');
- }}
- >
- <Flexbox horizontal align={'center'} gap={8} style={{ flex: 1 }}>
- <Icon icon={LucideBolt} size={'small'} />
- {t('ModelSwitchPanel.manageProvider')}
- </Flexbox>
- <Icon color={cssVar.colorTextDescription} icon={LucideArrowRight} size={'small'} />
- </Block>
- </Flexbox>
- );
-};
diff --git a/src/features/NavPanel/components/BackNav.tsx b/src/features/NavPanel/components/BackNav.tsx
deleted file mode 100644
index c45b6adc6fa..00000000000
--- a/src/features/NavPanel/components/BackNav.tsx
+++ /dev/null
@@ -1,72 +0,0 @@
-import { ActionIcon, Flexbox } from '@lobehub/ui';
-import { Button } from '@lobehub/ui/base-ui';
-import { createStaticStyles } from 'antd-style';
-import { ChevronLeftIcon } from 'lucide-react';
-import { type MouseEvent, type PropsWithChildren, type ReactNode, useCallback } from 'react';
-import { memo } from 'react';
-import { useTranslation } from 'react-i18next';
-import { Link } from 'react-router';
-
-import { DESKTOP_HEADER_ICON_SIZE } from '@/const/layoutTokens';
-import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';
-import { isModifierClick } from '@/utils/navigation';
-
-import ToggleLeftPanelButton from '../ToggleLeftPanelButton';
-
-const styles = createStaticStyles(({ css, cssVar }) => ({
- button: css`
- height: 32px;
- padding-inline-start: 4px;
- font-size: 13px;
- color: ${cssVar.colorTextSecondary};
-
- &:hover {
- color: ${cssVar.colorText};
- }
- `,
-}));
-
-const BackLink = ({ children }: { children: ReactNode }) => {
- const navigate = useWorkspaceAwareNavigate();
- const handleClick = useCallback(
- (e: MouseEvent) => {
- if (isModifierClick(e)) return;
- e.preventDefault();
- navigate('/');
- },
- [navigate],
- );
-
- return (
- <Link to="/" onClick={handleClick}>
- {children}
- </Link>
- );
-};
-
-const BackNav = memo<PropsWithChildren>(({ children }) => {
- const { t } = useTranslation('common');
- const leftContent = children ? (
- <Flexbox horizontal align={'center'} gap={4}>
- <BackLink>
- <ActionIcon icon={ChevronLeftIcon} size={DESKTOP_HEADER_ICON_SIZE} />
- </BackLink>
- {children}
- </Flexbox>
- ) : (
- <BackLink>
- <Button className={styles.button} icon={ChevronLeftIcon} type={'text'}>
- {t('back')}
- </Button>
- </BackLink>
- );
-
- return (
- <Flexbox horizontal align={'center'} gap={4} justify={'space-between'} padding={8}>
- {leftContent}
- <ToggleLeftPanelButton />
- </Flexbox>
- );
-});
-
-export default BackNav;
diff --git a/src/features/NavPanel/components/SessionHydration.tsx b/src/features/NavPanel/components/SessionHydration.tsx
deleted file mode 100644
index 3062fef9a88..00000000000
--- a/src/features/NavPanel/components/SessionHydration.tsx
+++ /dev/null
@@ -1,44 +0,0 @@
-'use client';
-
-import { memo, useEffect } from 'react';
-import { createStoreUpdater } from 'zustand-utils';
-
-import { parseAsString, useQueryParam } from '@/hooks/useQueryParam';
-import { useChatStore } from '@/store/chat';
-import { useSessionStore } from '@/store/session';
-
-const THROTTLE_DELAY = 50;
-
-// sync outside state to useSessionStore
-const SessionHydration = memo(() => {
- const useStoreUpdater = createStoreUpdater(useSessionStore);
- const useChatStoreUpdater = createStoreUpdater(useChatStore);
- const [switchTopic] = useChatStore((s) => [s.switchTopic]);
-
- // two-way bindings the url and session store
- const [session, setSession] = useQueryParam('session', parseAsString.withDefault('inbox'), {
- history: 'replace',
- throttleMs: THROTTLE_DELAY,
- });
-
- useStoreUpdater('activeId', session);
- useChatStoreUpdater('activeAgentId', session);
-
- useEffect(() => {
- const unsubscribe = useSessionStore.subscribe(
- (s) => s.activeId,
- (state) => {
- switchTopic();
- setSession(state);
- },
- );
-
- return () => {
- unsubscribe();
- };
- }, []);
-
- return null;
-});
-
-export default SessionHydration;
diff --git a/src/features/PWAInstall/index.tsx b/src/features/PWAInstall/index.tsx
deleted file mode 100644
index 4f4c01ebe6b..00000000000
--- a/src/features/PWAInstall/index.tsx
+++ /dev/null
@@ -1,47 +0,0 @@
-'use client';
-
-import { pwaInstallHandler } from 'pwa-install-handler';
-import { memo, useEffect, useState } from 'react';
-
-import { usePlatform } from '@/hooks/usePlatform';
-import dynamic from '@/libs/next/dynamic';
-import { useGlobalStore } from '@/store/global';
-import { systemStatusSelectors } from '@/store/global/selectors';
-import { useUserStore } from '@/store/user';
-
-const Install: any = dynamic(() => import('./Install'), {
- ssr: false,
-});
-
-const PWAInstall = memo(() => {
- const { isPWA, isSupportInstallPWA } = usePlatform();
- const isShowPWAGuide = useUserStore((s) => s.isShowPWAGuide);
- const hidePWAInstaller = useGlobalStore((s) => systemStatusSelectors.hidePWAInstaller(s));
- const [canInstallFromPWAInstallHandler, setCanInstallFromPWAInstallHandler] = useState<
- boolean | undefined
- >();
-
- useEffect(() => {
- pwaInstallHandler.addListener((canInstall) => {
- setCanInstallFromPWAInstallHandler(canInstall);
- });
- return () => {
- pwaInstallHandler.removeListener(setCanInstallFromPWAInstallHandler);
- };
- }, []);
-
- if (
- isPWA ||
- !isShowPWAGuide ||
- !isSupportInstallPWA ||
- hidePWAInstaller ||
- canInstallFromPWAInstallHandler === false
- )
- return null;
-
- // only when the user is suitable for the pwa install and not install the pwa
- // then show the installation guide
- return <Install />;
-});
-
-export default PWAInstall;
diff --git a/src/features/PageEditor/Copilot/AgentSelector/Actions.tsx b/src/features/PageEditor/Copilot/AgentSelector/Actions.tsx
deleted file mode 100644
index bee41bb07ce..00000000000
--- a/src/features/PageEditor/Copilot/AgentSelector/Actions.tsx
+++ /dev/null
@@ -1,22 +0,0 @@
-import { type MenuProps } from '@lobehub/ui';
-import { ActionIcon, DropdownMenu } from '@lobehub/ui';
-import { MoreHorizontalIcon } from 'lucide-react';
-import { memo } from 'react';
-
-interface ActionsProps {
- dropdownMenu: MenuProps['items'];
-}
-
-const Actions = memo<ActionsProps>(({ dropdownMenu }) => {
- const menuItems = dropdownMenu ?? [];
-
- if (menuItems.length === 0) return null;
-
- return (
- <DropdownMenu items={menuItems}>
- <ActionIcon icon={MoreHorizontalIcon} size={'small'} />
- </DropdownMenu>
- );
-});
-
-export default Actions;
diff --git a/src/features/PageEditor/Copilot/index.tsx b/src/features/PageEditor/Copilot/index.tsx
deleted file mode 100644
index 70eb7ae2e6e..00000000000
--- a/src/features/PageEditor/Copilot/index.tsx
+++ /dev/null
@@ -1,39 +0,0 @@
-'use client';
-
-import { memo } from 'react';
-
-import RightPanel from '@/features/RightPanel';
-import { useGlobalStore } from '@/store/global';
-import { systemStatusSelectors } from '@/store/global/selectors';
-
-import Conversation from './Conversation';
-
-/**
- * Help write, read, and edit the page
- */
-const Copilot = memo(() => {
- const [width, expand, togglePageAgentPanel, updateSystemStatus] = useGlobalStore((s) => [
- systemStatusSelectors.pageAgentPanelWidth(s),
- systemStatusSelectors.showPageAgentPanel(s),
- s.togglePageAgentPanel,
- s.updateSystemStatus,
- ]);
-
- return (
- <RightPanel
- defaultWidth={width}
- expand={expand}
- onExpandChange={(next) => togglePageAgentPanel(next)}
- onSizeChange={(size) => {
- if (size?.width) {
- const w = typeof size.width === 'string' ? Number.parseInt(size.width) : size.width;
- if (!!w) updateSystemStatus({ pageAgentPanelWidth: w });
- }
- }}
- >
- <Conversation />
- </RightPanel>
- );
-});
-
-export default Copilot;
diff --git a/src/features/PluginDevModal/LocalForm.tsx b/src/features/PluginDevModal/LocalForm.tsx
deleted file mode 100644
index a0187a07e6c..00000000000
--- a/src/features/PluginDevModal/LocalForm.tsx
+++ /dev/null
@@ -1,124 +0,0 @@
-import { type FormItemProps } from '@lobehub/ui';
-import { Form, Input, TextArea } from '@lobehub/ui';
-import { type FormInstance } from 'antd';
-import { memo } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import EmojiPicker from '@/components/EmojiPicker';
-import { useGlobalStore } from '@/store/global';
-import { globalGeneralSelectors } from '@/store/global/selectors';
-import { useToolStore } from '@/store/tool';
-import { pluginSelectors } from '@/store/tool/selectors';
-
-const LocalForm = memo<{ form: FormInstance; mode?: 'edit' | 'create' }>(({ form, mode }) => {
- const isEditMode = mode === 'edit';
- const locale = useGlobalStore(globalGeneralSelectors.currentLanguage);
- const { t } = useTranslation('plugin');
-
- const pluginIds = useToolStore(pluginSelectors.storeAndInstallPluginsIdList);
-
- const metaItem: FormItemProps[] = [
- {
- children: <Input disabled placeholder={'searchEngine'} />,
- desc: t('dev.meta.identifier.desc'),
- label: t('dev.meta.identifier.label'),
- name: 'identifier',
- rules: [
- { required: true },
- {
- message: t('dev.meta.identifier.pattenErrorMessage'),
- pattern: /^[\w-]+$/,
- },
- // In edit mode, skip duplicate validation
- isEditMode
- ? {}
- : {
- message: t('dev.meta.identifier.errorDuplicate'),
- validator: async (_, value) => {
- if (pluginIds.includes(value)) {
- throw new Error('Duplicate');
- }
- },
- },
- ],
- },
- {
- children: <Input placeholder={t('dev.meta.title.placeholder')} />,
- desc: t('dev.meta.title.desc'),
- label: t('dev.meta.title.label'),
- name: ['manifest', 'meta', 'title'],
- rules: [{ required: true }],
- },
- {
- children: <TextArea placeholder={t('dev.meta.description.placeholder')} />,
- desc: t('dev.meta.description.desc'),
- label: t('dev.meta.description.label'),
- name: ['manifest', 'meta', 'description'],
- },
- {
- children: <Input placeholder={'LobeHub'} />,
- desc: t('dev.meta.author.desc'),
- label: t('dev.meta.author.label'),
- name: ['manifest', 'author'],
- },
- {
- children: <Input placeholder={'https://www.lobehub.com'} />,
- desc: t('dev.meta.homepage.desc'),
- label: t('dev.meta.homepage.label'),
- name: ['manifest', 'homepage'],
- },
- {
- children: <EmojiPicker defaultAvatar={'🧩'} locale={locale} />,
- desc: t('dev.meta.avatar.desc'),
- label: t('dev.meta.avatar.label'),
- name: ['manifest', 'meta', 'avatar'],
- },
- ];
-
- const manifestItem: FormItemProps[] = [
- {
- children: <Input placeholder={'searchEngine'} />,
- desc: t('dev.meta.identifier.desc'),
- label: t('dev.meta.identifier.label'),
- name: ['name'],
- required: true,
- },
-
- {
- children: <Input placeholder={t('dev.meta.description.placeholder')} />,
- desc: t('dev.meta.description.desc'),
- label: t('dev.meta.description.label'),
- name: 'description',
- required: true,
- },
- {
- children: <Input placeholder={'searchEngine'} />,
- desc: t('dev.meta.identifier.desc'),
- label: t('dev.meta.identifier.label'),
- name: 'identifier',
- required: true,
- },
- ];
-
- return (
- <Form
- form={form}
- layout={'vertical'}
- items={[
- {
- children: metaItem,
- title: t('dev.metaConfig'),
- },
- {
- children: manifestItem,
- title: t('dev.metaConfig'),
- },
- ]}
- validateMessages={{
- required: () => t('dev.meta.formFieldRequired'),
- }}
- />
- );
-});
-
-export default LocalForm;
diff --git a/src/features/Portal/components/SkeletonLoading.tsx b/src/features/Portal/components/SkeletonLoading.tsx
deleted file mode 100644
index 8169d95fbf8..00000000000
--- a/src/features/Portal/components/SkeletonLoading.tsx
+++ /dev/null
@@ -1,14 +0,0 @@
-import { Skeleton } from '@lobehub/ui';
-import { memo } from 'react';
-
-interface SkeletonLoadingProps {
- count?: number;
-}
-
-const SkeletonLoading = memo<SkeletonLoadingProps>(({ count = 3 }) => {
- return Array.from({ length: count }).map((key, index) => (
- <Skeleton.Button active block key={`${key}-${index}`} style={{ borderRadius: 8, height: 68 }} />
- ));
-});
-
-export default SkeletonLoading;
diff --git a/src/features/ResourceManager/components/Editor/FileCopilot.tsx b/src/features/ResourceManager/components/Editor/FileCopilot.tsx
deleted file mode 100644
index c33ad23986a..00000000000
--- a/src/features/ResourceManager/components/Editor/FileCopilot.tsx
+++ /dev/null
@@ -1,56 +0,0 @@
-'use client';
-
-import { Flexbox } from '@lobehub/ui';
-import { memo } from 'react';
-
-import DragUploadZone, { useUploadFiles } from '@/components/DragUploadZone';
-import { type ActionKeys } from '@/features/ChatInput';
-import {
- ChatInput,
- ChatList,
- conversationSelectors,
- useConversationStore,
-} from '@/features/Conversation';
-import RightPanel from '@/features/RightPanel';
-import { useAgentStore } from '@/store/agent';
-import { agentByIdSelectors } from '@/store/agent/selectors';
-
-const actions: ActionKeys[] = ['model', 'search'];
-
-/**
- * Help analyze and work with files
- */
-const FileCopilot = memo(() => {
- const useFetchAgentConfig = useAgentStore((s) => s.useFetchAgentConfig);
- const currentAgentId = useConversationStore(conversationSelectors.agentId);
-
- // Fetch agent config when activeAgentId changes to ensure it's loaded in the store
- useFetchAgentConfig(true, currentAgentId);
-
- // Get agent's model info for vision support check
- const model = useAgentStore((s) => agentByIdSelectors.getAgentModelById(currentAgentId)(s));
- const provider = useAgentStore((s) =>
- agentByIdSelectors.getAgentModelProviderById(currentAgentId)(s),
- );
- const { handleUploadFiles } = useUploadFiles({ agentId: currentAgentId, model, provider });
-
- return (
- <RightPanel>
- <DragUploadZone
- style={{ flex: 1, height: '100%', minWidth: 300 }}
- onUploadFiles={handleUploadFiles}
- >
- <Flexbox flex={1} height={'100%'}>
- <Flexbox flex={1} style={{ overflow: 'hidden' }}>
- <ChatList />
- </Flexbox>
- <ChatInput leftActions={actions} showControlBar={false} />
- </Flexbox>
- </DragUploadZone>
- </RightPanel>
- );
-});
-
-FileCopilot.displayName = 'FileCopilot';
-
-export default FileCopilot;
diff --git a/src/features/ResourceManager/components/Editor/FileDetail.tsx b/src/features/ResourceManager/components/Editor/FileDetail.tsx
deleted file mode 100644
index 170eaba146a..00000000000
--- a/src/features/ResourceManager/components/Editor/FileDetail.tsx
+++ /dev/null
@@ -1,22 +0,0 @@
-'use client';
-
-import { memo } from 'react';
-
-import FileDetailComponent from '@/routes/(main)/resource/features/FileDetail';
-import { fileManagerSelectors, useFileStore } from '@/store/file';
-
-interface FileDetailProps {
- id: string;
-}
-
-const FileDetail = memo<FileDetailProps>(({ id }) => {
- const file = useFileStore(fileManagerSelectors.getFileById(id));
-
- if (!file) return null;
-
- return <FileDetailComponent {...file} />;
-});
-
-FileDetail.displayName = 'FileDetail';
-
-export default FileDetail;
diff --git a/src/features/ResourceManager/components/Explorer/ToolBar/Config.tsx b/src/features/ResourceManager/components/Explorer/ToolBar/Config.tsx
deleted file mode 100644
index c07362d3e89..00000000000
--- a/src/features/ResourceManager/components/Explorer/ToolBar/Config.tsx
+++ /dev/null
@@ -1,29 +0,0 @@
-import { Flexbox } from '@lobehub/ui';
-import { Switch } from '@lobehub/ui/base-ui';
-import { memo } from 'react';
-import { useTranslation } from 'react-i18next';
-
-interface ConfigProps {
- config: { showFilesInKnowledgeBase: boolean };
- onConfigChange: (config: { showFilesInKnowledgeBase: boolean }) => void;
-}
-
-const Config = memo<ConfigProps>(({ config, onConfigChange }) => {
- const { t } = useTranslation('components');
-
- return (
- <Flexbox
- horizontal
- align={'center'}
- gap={8}
- onClick={() => {
- onConfigChange({ showFilesInKnowledgeBase: !config.showFilesInKnowledgeBase });
- }}
- >
- {t('FileManager.config.showFilesInLibrary')}
- <Switch size={'small'} value={config.showFilesInKnowledgeBase} />
- </Flexbox>
- );
-});
-
-export default Config;
diff --git a/src/features/ResourceManager/components/Explorer/ToolBar/MultiSelectActions.tsx b/src/features/ResourceManager/components/Explorer/ToolBar/MultiSelectActions.tsx
deleted file mode 100644
index 4a6773aef35..00000000000
--- a/src/features/ResourceManager/components/Explorer/ToolBar/MultiSelectActions.tsx
+++ /dev/null
@@ -1,169 +0,0 @@
-import { Checkbox, Flexbox, Icon, Skeleton } from '@lobehub/ui';
-import { Button, confirmModal } from '@lobehub/ui/base-ui';
-import { App } from 'antd';
-import { createStaticStyles, cssVar } from 'antd-style';
-import { BookMinusIcon, BookPlusIcon, FileBoxIcon, Trash2Icon } from 'lucide-react';
-import { memo } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import { useResourceManagerStore } from '@/routes/(main)/resource/features/store';
-
-const styles = createStaticStyles(({ css }) => ({
- total: css`
- cursor: pointer;
- height: 27px;
- `,
-}));
-
-export type MultiSelectActionType =
- | 'addToKnowledgeBase'
- | 'moveToOtherKnowledgeBase'
- | 'batchChunking'
- | 'delete'
- | 'deleteLibrary'
- | 'removeFromKnowledgeBase';
-
-interface MultiSelectActionsProps {
- onActionClick: (type: MultiSelectActionType) => Promise<void>;
- onClickCheckbox: () => void;
- selectCount: number;
- total?: number;
-}
-
-const MultiSelectActions = memo<MultiSelectActionsProps>(
- ({ selectCount, total, onActionClick, onClickCheckbox }) => {
- const { t } = useTranslation(['components', 'common']);
-
- const isSelectedFiles = selectCount > 0;
- const { message } = App.useApp();
-
- const libraryId = useResourceManagerStore((s) => s.libraryId);
-
- return (
- <Flexbox
- horizontal
- align={'center'}
- gap={12}
- style={{
- borderBlockEnd: `1px solid ${cssVar.colorBorderSecondary}`,
- height: 40,
- paddingBlockEnd: 12,
- }}
- >
- <Flexbox
- horizontal
- align={'center'}
- className={styles.total}
- gap={8}
- paddingInline={4}
- onClick={onClickCheckbox}
- >
- <Checkbox
- checked={selectCount === total}
- indeterminate={isSelectedFiles && selectCount !== total}
- />
- {typeof total === 'undefined' ? (
- <Skeleton
- active
- paragraph={{ rows: 1, style: { marginBottom: 0, width: 60 }, width: '100%' }}
- title={false}
- />
- ) : (
- <div style={{ height: 18 }}>
- {isSelectedFiles
- ? t('FileManager.total.selectedCount', { count: selectCount })
- : t('FileManager.total.fileCount', { count: total })}
- </div>
- )}
- </Flexbox>
- {isSelectedFiles && (
- <Flexbox horizontal gap={8}>
- {libraryId ? (
- <>
- <Button
- icon={BookMinusIcon}
- size={'small'}
- onClick={() => {
- confirmModal({
- cancelText: t('cancel', { ns: 'common' }),
- content: t('FileManager.actions.confirmRemoveFromLibrary', {
- count: selectCount,
- }),
- okButtonProps: {
- danger: true,
- },
- okText: t('FileManager.actions.removeFromLibrary'),
- onOk: async () => {
- await onActionClick('removeFromKnowledgeBase');
- message.success(t('FileManager.actions.removeFromLibrarySuccess'));
- },
- title: t('FileManager.actions.removeFromLibrary'),
- });
- }}
- >
- {t('FileManager.actions.removeFromLibrary')}
- </Button>
- <Button
- icon={<Icon icon={BookPlusIcon} />}
- size={'small'}
- type={'fill'}
- onClick={() => {
- onActionClick('moveToOtherKnowledgeBase');
- }}
- >
- {t('FileManager.actions.moveToOtherLibrary')}
- </Button>
- </>
- ) : (
- <Button
- icon={<Icon icon={BookPlusIcon} />}
- size={'small'}
- type={'fill'}
- onClick={() => {
- onActionClick('addToKnowledgeBase');
- }}
- >
- {t('FileManager.actions.addToLibrary')}
- </Button>
- )}
- <Button
- icon={<Icon icon={FileBoxIcon} />}
- size={'small'}
- type={'fill'}
- onClick={async () => {
- await onActionClick('batchChunking');
- }}
- >
- {t('FileManager.actions.batchChunking')}
- </Button>
- <Button
- danger
- icon={<Icon icon={Trash2Icon} />}
- size={'small'}
- type={'fill'}
- onClick={async () => {
- confirmModal({
- cancelText: t('cancel', { ns: 'common' }),
- content: t('FileManager.actions.confirmDeleteMultiFiles', { count: selectCount }),
- okButtonProps: {
- danger: true,
- },
- okText: t('delete', { ns: 'common' }),
- onOk: async () => {
- await onActionClick('delete');
- message.success(t('FileManager.actions.deleteSuccess'));
- },
- title: t('delete', { ns: 'common' }),
- });
- }}
- >
- {t('delete', { ns: 'common' })}
- </Button>
- </Flexbox>
- )}
- </Flexbox>
- );
- },
-);
-
-export default MultiSelectActions;
diff --git a/src/features/ResourceUnavailable/index.test.tsx b/src/features/ResourceUnavailable/index.test.tsx
deleted file mode 100644
index 394d5b15fc3..00000000000
--- a/src/features/ResourceUnavailable/index.test.tsx
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * @vitest-environment happy-dom
- */
-import { render, screen } from '@testing-library/react';
-import type { ReactNode } from 'react';
-import { describe, expect, it, vi } from 'vitest';
-
-import ResourceUnavailable, { type ResourceUnavailableVariant } from './index';
-
-vi.mock('react-i18next', () => ({
- useTranslation: () => ({ t: (key: string) => key }),
-}));
-
-vi.mock('@lobehub/ui', () => ({
- Flexbox: ({ children, className }: { children?: ReactNode; className?: string }) => (
- <div className={className} data-testid="resource-unavailable-shell">
- {children}
- </div>
- ),
- Icon: ({ size }: { icon: unknown; size?: number }) => (
- <span data-icon-size={size} data-testid="resource-unavailable-icon" />
- ),
-}));
-
-describe('ResourceUnavailable', () => {
- it('renders the shared unavailable label', () => {
- render(<ResourceUnavailable />);
- expect(screen.getByText('resourceUnavailable')).toBeTruthy();
- });
-
- it.each<ResourceUnavailableVariant>(['inline', 'attachment', 'card'])(
- 'renders the same copy in %s variant (context supplies the type)',
- (variant) => {
- render(<ResourceUnavailable variant={variant} />);
- expect(screen.getByText('resourceUnavailable')).toBeTruthy();
- },
- );
-
- it('uses a smaller icon in inline variant', () => {
- render(<ResourceUnavailable variant="inline" />);
- const icon = screen.getByTestId('resource-unavailable-icon');
- expect(icon.getAttribute('data-icon-size')).toBe('12');
- });
-
- it('uses the larger icon in card variant', () => {
- render(<ResourceUnavailable variant="card" />);
- const icon = screen.getByTestId('resource-unavailable-icon');
- expect(icon.getAttribute('data-icon-size')).toBe('16');
- });
-});
diff --git a/src/features/ResourceUnavailable/index.tsx b/src/features/ResourceUnavailable/index.tsx
deleted file mode 100644
index 237477a0dba..00000000000
--- a/src/features/ResourceUnavailable/index.tsx
+++ /dev/null
@@ -1,102 +0,0 @@
-'use client';
-
-import { Flexbox, Icon } from '@lobehub/ui';
-import { createStaticStyles } from 'antd-style';
-import { EyeOffIcon } from 'lucide-react';
-import { type CSSProperties, memo } from 'react';
-import { useTranslation } from 'react-i18next';
-
-export type ResourceUnavailableVariant = 'card' | 'inline' | 'attachment';
-
-export interface ResourceUnavailableProps {
- className?: string;
- size?: 'small' | 'default';
- style?: CSSProperties;
- /**
- * Rendering shell. `inline` — pill-sized replacement for a text mention;
- * `attachment` — chat message file-card slot; `card` — larger placeholder
- * for detail-page mounts (agent editor's KB list, topic sidebar link).
- *
- * The message copy stays the same across all three — the surrounding
- * context (an attachment slot, a KB tile, a linked-doc chip) already tells
- * the viewer what kind of thing went missing, so we don't repeat it.
- */
- variant?: ResourceUnavailableVariant;
-}
-
-const styles = createStaticStyles(({ css, cssVar }) => ({
- attachment: css`
- padding-block: 8px;
- padding-inline: 12px;
- border: 1px solid ${cssVar.colorBorderSecondary};
- border-radius: 8px;
-
- color: ${cssVar.colorTextTertiary};
-
- background: ${cssVar.colorFillQuaternary};
- `,
- card: css`
- padding-block: 12px;
- padding-inline: 16px;
- border: 1px dashed ${cssVar.colorBorderSecondary};
- border-radius: 8px;
-
- color: ${cssVar.colorTextDescription};
-
- background: ${cssVar.colorFillQuaternary};
- `,
- icon: css`
- flex: none;
- color: ${cssVar.colorTextTertiary};
- `,
- inline: css`
- padding-block: 2px;
- padding-inline: 8px;
- border-radius: 4px;
-
- font-size: 12px;
- color: ${cssVar.colorTextTertiary};
-
- background: ${cssVar.colorFillQuaternary};
- `,
- small: css`
- font-size: 12px;
- `,
-}));
-
-/**
- * `ResourceUnavailable`
- *
- * Uniform placeholder rendered wherever a cross-user reference resolves to a
- * resource the current viewer no longer has access to — typically because the
- * creator flipped it back to `private` via `setVisibility`. Kept
- * intentionally low-emphasis so message threads don't scream at readers who
- * didn't do anything wrong.
- */
-const ResourceUnavailable = memo<ResourceUnavailableProps>(
- ({ variant = 'inline', size = 'default', className, style }) => {
- const { t } = useTranslation('common');
-
- const iconSize = size === 'small' || variant === 'inline' ? 12 : 16;
- const shellClass = styles[variant];
- const sizeClass = size === 'small' && variant !== 'inline' ? styles.small : '';
- const mergedClass = [shellClass, sizeClass, className].filter(Boolean).join(' ');
-
- return (
- <Flexbox
- align="center"
- className={mergedClass}
- direction="horizontal"
- gap={variant === 'inline' ? 4 : 8}
- style={style}
- >
- <Icon className={styles.icon} icon={EyeOffIcon} size={iconSize} />
- <span>{t('resourceUnavailable')}</span>
- </Flexbox>
- );
- },
-);
-
-ResourceUnavailable.displayName = 'ResourceUnavailable';
-
-export default ResourceUnavailable;
diff --git a/src/features/SkillStore/SkillList/Community/index.tsx b/src/features/SkillStore/SkillList/Community/index.tsx
deleted file mode 100644
index 0a4bec074be..00000000000
--- a/src/features/SkillStore/SkillList/Community/index.tsx
+++ /dev/null
@@ -1,150 +0,0 @@
-'use client';
-
-import { type SkillListItem } from '@lobechat/types';
-import { Center, Icon, Text } from '@lobehub/ui';
-import isEqual from 'fast-deep-equal';
-import { ServerCrash } from 'lucide-react';
-import { memo, useEffect, useMemo, useRef } from 'react';
-import { useTranslation } from 'react-i18next';
-import { VirtuosoGrid } from 'react-virtuoso';
-
-import { useToolStore } from '@/store/tool';
-import { agentSkillsSelectors } from '@/store/tool/selectors';
-import { type DiscoverMcpItem } from '@/types/discover';
-
-import AgentSkillItem from '../AgentSkillItem';
-import Empty from '../Empty';
-import Loading from '../Loading';
-import { virtuosoGridStyles } from '../style';
-import VirtuosoLoading from '../VirtuosoLoading';
-import WantMoreSkills from '../WantMoreSkills';
-import Item from './Item';
-
-type CommunityListItem =
- | { itemType: 'agentSkill'; skill: SkillListItem }
- | { data: DiscoverMcpItem; itemType: 'mcp' };
-
-export const CommunityList = memo(() => {
- const { t } = useTranslation('setting');
-
- const [
- keywords,
- isMcpListInit,
- allItems,
- currentPage,
- totalPages,
- searchLoading,
- useFetchMCPPluginList,
- loadMoreMCPPlugins,
- resetMCPPluginList,
- useFetchAgentSkills,
- ] = useToolStore((s) => [
- s.mcpSearchKeywords,
- s.isMcpListInit,
- s.mcpPluginItems,
- s.currentPage,
- s.totalPages,
- s.searchLoading,
- s.useFetchMCPPluginList,
- s.loadMoreMCPPlugins,
- s.resetMCPPluginList,
- s.useFetchAgentSkills,
- ]);
-
- const marketAgentSkills = useToolStore(agentSkillsSelectors.getMarketAgentSkills, isEqual);
- useFetchAgentSkills(true);
-
- const filteredMarketAgentSkills = useMemo(() => {
- const lowerKeywords = (keywords || '').toLowerCase().trim();
- if (!lowerKeywords) return marketAgentSkills;
-
- return marketAgentSkills.filter((skill) => {
- const name = skill.name?.toLowerCase() || '';
- const identifier = skill.identifier?.toLowerCase() || '';
- return name.includes(lowerKeywords) || identifier.includes(lowerKeywords);
- });
- }, [marketAgentSkills, keywords]);
-
- const combinedItems = useMemo<CommunityListItem[]>(() => {
- const agentSkillItems: CommunityListItem[] = filteredMarketAgentSkills.map((skill) => ({
- itemType: 'agentSkill' as const,
- skill,
- }));
- const mcpItems: CommunityListItem[] = allItems.map((data) => ({
- data,
- itemType: 'mcp' as const,
- }));
- return [...agentSkillItems, ...mcpItems];
- }, [filteredMarketAgentSkills, allItems]);
-
- const prevKeywordsRef = useRef(keywords);
-
- useEffect(() => {
- // Only reset when keywords actually change, not on initial mount
- if (prevKeywordsRef.current !== keywords) {
- prevKeywordsRef.current = keywords;
- resetMCPPluginList(keywords);
- }
- }, [keywords, resetMCPPluginList]);
-
- const { isLoading, error } = useFetchMCPPluginList({
- page: currentPage,
- pageSize: 20,
- q: keywords,
- });
-
- const hasSearchKeywords = Boolean(keywords && keywords.trim());
-
- const renderContent = () => {
- // Show loading when searching, not initialized, or first page is loading with no items
- if (searchLoading || !isMcpListInit || (isLoading && allItems.length === 0)) return <Loading />;
-
- if (error) {
- return (
- <Center gap={12} padding={40}>
- <Icon icon={ServerCrash} size={80} />
- <Text type={'secondary'}>{t('skillStore.networkError')}</Text>
- </Center>
- );
- }
-
- if (combinedItems.length === 0) return <Empty search={hasSearchKeywords} />;
-
- // Check if we've reached the end of the list
- const hasReachedEnd = totalPages !== undefined && currentPage >= totalPages;
-
- const renderFooter = () => {
- if (isLoading) return <VirtuosoLoading />;
- if (hasReachedEnd) return <WantMoreSkills />;
- return <div style={{ height: 16 }} />;
- };
-
- return (
- <VirtuosoGrid
- data={combinedItems}
- endReached={loadMoreMCPPlugins}
- increaseViewportBy={typeof window !== 'undefined' ? window.innerHeight : 0}
- itemClassName={virtuosoGridStyles.item}
- listClassName={virtuosoGridStyles.list}
- overscan={24}
- style={{ height: '60vh', width: '100%' }}
- components={{
- Footer: renderFooter,
- }}
- itemContent={(_, item) =>
- item.itemType === 'agentSkill' ? (
- <AgentSkillItem skill={item.skill} />
- ) : (
- <Item {...item.data} />
- )
- }
- />
- );
- };
-
- return renderContent();
-});
-
-CommunityList.displayName = 'CommunityList';
-
-export default CommunityList;
diff --git a/src/features/SkillStore/SkillList/Custom/index.tsx b/src/features/SkillStore/SkillList/Custom/index.tsx
deleted file mode 100644
index 823782604aa..00000000000
--- a/src/features/SkillStore/SkillList/Custom/index.tsx
+++ /dev/null
@@ -1,69 +0,0 @@
-'use client';
-
-import isEqual from 'fast-deep-equal';
-import { memo, useMemo } from 'react';
-
-import { useToolStore } from '@/store/tool';
-import { agentSkillsSelectors, pluginSelectors } from '@/store/tool/selectors';
-
-import AgentSkillItem from '../AgentSkillItem';
-import Empty from '../Empty';
-import { gridStyles } from '../style';
-import Item from './Item';
-
-export const CustomList = memo(() => {
- const customPlugins = useToolStore(pluginSelectors.installedCustomPluginMetaList, isEqual);
- const agentSkills = useToolStore(agentSkillsSelectors.getUserAgentSkills, isEqual);
- const searchKeywords = useToolStore((s) => s.customPluginSearchKeywords || '');
- const useFetchAgentSkills = useToolStore((s) => s.useFetchAgentSkills);
- useFetchAgentSkills(true);
-
- const filteredPlugins = useMemo(() => {
- const lowerKeywords = searchKeywords.toLowerCase().trim();
- if (!lowerKeywords) return customPlugins;
-
- return customPlugins.filter((plugin) => {
- const title = plugin.title?.toLowerCase() || '';
- const identifier = plugin.identifier?.toLowerCase() || '';
- return title.includes(lowerKeywords) || identifier.includes(lowerKeywords);
- });
- }, [customPlugins, searchKeywords]);
-
- const filteredAgentSkills = useMemo(() => {
- const lowerKeywords = searchKeywords.toLowerCase().trim();
- if (!lowerKeywords) return agentSkills;
-
- return agentSkills.filter((skill) => {
- const name = skill.name?.toLowerCase() || '';
- const identifier = skill.identifier?.toLowerCase() || '';
- return name.includes(lowerKeywords) || identifier.includes(lowerKeywords);
- });
- }, [agentSkills, searchKeywords]);
-
- const hasSearchKeywords = Boolean(searchKeywords && searchKeywords.trim());
-
- if (filteredAgentSkills.length === 0 && filteredPlugins.length === 0) {
- return <Empty search={hasSearchKeywords} />;
- }
-
- return (
- <div className={gridStyles.grid}>
- {filteredAgentSkills.map((skill) => (
- <AgentSkillItem key={skill.id} skill={skill} />
- ))}
- {filteredPlugins.map((plugin) => (
- <Item
- avatar={plugin.avatar}
- description={plugin.description}
- identifier={plugin.identifier}
- key={plugin.identifier}
- title={plugin.title}
- />
- ))}
- </div>
- );
-});
-
-CustomList.displayName = 'CustomList';
-
-export default CustomList;
diff --git a/src/features/TopicCanvas/TopicMetaBar.tsx b/src/features/TopicCanvas/TopicMetaBar.tsx
deleted file mode 100644
index 73fa2d1dc4f..00000000000
--- a/src/features/TopicCanvas/TopicMetaBar.tsx
+++ /dev/null
@@ -1,9 +0,0 @@
-import { memo } from 'react';
-
-interface TopicMetaBarProps {
- topicId?: string | null;
-}
-
-const TopicMetaBar = memo<TopicMetaBarProps>(() => null);
-
-export default TopicMetaBar;
diff --git a/src/layout/AnalyticsRSCProvider.tsx b/src/layout/AnalyticsRSCProvider.tsx
deleted file mode 100644
index 4769cbc8e25..00000000000
--- a/src/layout/AnalyticsRSCProvider.tsx
+++ /dev/null
@@ -1,46 +0,0 @@
-import type { ReactNode } from 'react';
-
-import { LobeAnalyticsProvider } from '@/components/Analytics/LobeAnalyticsProvider';
-import { analyticsEnv } from '@/envs/analytics';
-import { isDev } from '@/utils/env';
-
-interface AnalyticsRSCProviderProps {
- children: ReactNode;
-}
-
-const AnalyticsRSCProvider = ({ children }: AnalyticsRSCProviderProps) => {
- return (
- <LobeAnalyticsProvider
- ga4Config={{
- debug: isDev,
- enabled: !!analyticsEnv.GOOGLE_ANALYTICS_MEASUREMENT_ID,
- gtagConfig: {
- debug_mode: isDev,
- },
- measurementId: analyticsEnv.GOOGLE_ANALYTICS_MEASUREMENT_ID ?? '',
- }}
- postHogConfig={{
- debug: analyticsEnv.DEBUG_POSTHOG_ANALYTICS,
- enabled: analyticsEnv.ENABLED_POSTHOG_ANALYTICS,
- capture_pageview: 'history_change',
- host: analyticsEnv.POSTHOG_HOST,
- key: analyticsEnv.POSTHOG_KEY ?? '',
- person_profiles: 'always',
- }}
- xAdsConfig={{
- debug: isDev,
- eventIds: {
- login_or_signup_clicked: analyticsEnv.X_ADS_LOGIN_OR_SIGNUP_CLICKED_EVENT_ID,
- main_page_view: analyticsEnv.X_ADS_MAIN_PAGE_VIEW_EVENT_ID,
- },
- enabled: analyticsEnv.ENABLED_X_ADS,
- pixelId: analyticsEnv.X_ADS_PIXEL_ID ?? '',
- purchaseEventId: analyticsEnv.X_ADS_PURCHASE_EVENT_ID,
- }}
- >
- {children}
- </LobeAnalyticsProvider>
- );
-};
-
-export default AnalyticsRSCProvider;
diff --git a/src/layout/AuthProvider/NoAuth/index.tsx b/src/layout/AuthProvider/NoAuth/index.tsx
deleted file mode 100644
index a52a9a72555..00000000000
--- a/src/layout/AuthProvider/NoAuth/index.tsx
+++ /dev/null
@@ -1,17 +0,0 @@
-'use client';
-
-import { type PropsWithChildren } from 'react';
-import { memo } from 'react';
-import { createStoreUpdater } from 'zustand-utils';
-
-import { useUserStore } from '@/store/user';
-
-const NoAuthProvider = memo<PropsWithChildren>(({ children }) => {
- const useStoreUpdater = createStoreUpdater(useUserStore);
-
- useStoreUpdater('isLoaded', true);
-
- return children;
-});
-
-export default NoAuthProvider;
diff --git a/src/layout/GlobalProvider/StyleRegistry.tsx b/src/layout/GlobalProvider/StyleRegistry.tsx
deleted file mode 100644
index b9c085d1aa6..00000000000
--- a/src/layout/GlobalProvider/StyleRegistry.tsx
+++ /dev/null
@@ -1,24 +0,0 @@
-'use client';
-
-import { StyleProvider } from 'antd-style';
-import { useServerInsertedHTML } from 'next/navigation';
-import { type PropsWithChildren } from 'react';
-
-const StyleRegistry = ({ children }: PropsWithChildren) => {
- useServerInsertedHTML(() => {
- return (
- <style
- dangerouslySetInnerHTML={{
- __html: `
- html body {background: #f8f8f8;}
- html[data-theme="dark"] body { background-color: #000; }
- `,
- }}
- />
- );
- });
-
- return <StyleProvider>{children}</StyleProvider>;
-};
-
-export default StyleRegistry;
diff --git a/src/routes/(main)/(create)/features/GenerationLayout/Body/List/NewTopicButton.tsx b/src/routes/(main)/(create)/features/GenerationLayout/Body/List/NewTopicButton.tsx
deleted file mode 100644
index 1b893adcf34..00000000000
--- a/src/routes/(main)/(create)/features/GenerationLayout/Body/List/NewTopicButton.tsx
+++ /dev/null
@@ -1,66 +0,0 @@
-'use client';
-
-import { ActionIcon, Flexbox } from '@lobehub/ui';
-import { Plus } from 'lucide-react';
-import { memo } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import { useGenerationTopicContext } from './StoreContext';
-
-interface NewTopicButtonProps {
- count?: number;
- onClick?: () => void;
- showMoreInfo?: boolean;
-}
-
-const NewTopicButton = memo<NewTopicButtonProps>(({ count, onClick, showMoreInfo }) => {
- const { namespace } = useGenerationTopicContext();
- const { t } = useTranslation(namespace);
-
- if (showMoreInfo)
- return (
- <Flexbox
- horizontal
- align="center"
- gap={8}
- justify="space-between"
- width={'100%'}
- style={{
- marginBottom: 12,
- }}
- >
- <div>
- {t('topic.title')} {count ? count : ''}
- </div>
- <ActionIcon
- icon={Plus}
- size={'small'}
- title={t('topic.createNew')}
- tooltipProps={{
- placement: 'left',
- }}
- onClick={onClick}
- />
- </Flexbox>
- );
-
- return (
- <ActionIcon
- icon={Plus}
- title={t('topic.createNew')}
- variant={'filled'}
- size={{
- blockSize: 48,
- size: 20,
- }}
- tooltipProps={{
- placement: 'left',
- }}
- onClick={onClick}
- />
- );
-});
-
-NewTopicButton.displayName = 'NewTopicButton';
-
-export default NewTopicButton;
diff --git a/src/routes/(main)/(create)/features/GenerationLayout/Header/AddButton.tsx b/src/routes/(main)/(create)/features/GenerationLayout/Header/AddButton.tsx
deleted file mode 100644
index 66c89ccadd6..00000000000
--- a/src/routes/(main)/(create)/features/GenerationLayout/Header/AddButton.tsx
+++ /dev/null
@@ -1,38 +0,0 @@
-'use client';
-
-import { ActionIcon } from '@lobehub/ui';
-import { SquarePenIcon } from 'lucide-react';
-import { memo } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import { usePermission } from '@/hooks/usePermission';
-
-import type { GenerationLayoutCommonProps } from '../types';
-
-const AddButton = memo<Pick<GenerationLayoutCommonProps, 'namespace' | 'useStore'>>((props) => {
- const { namespace, useStore } = props;
- const { t } = useTranslation(namespace);
- const { allowed: canCreate } = usePermission('create_content');
- const openNewGenerationTopic = useStore((s: any) => s.openNewGenerationTopic);
-
- return (
- <ActionIcon
- disabled={!canCreate}
- icon={SquarePenIcon}
- title={t('topic.createNew')}
- size={{
- blockSize: 32,
- size: 18,
- }}
- onClick={() => {
- if (!canCreate) return;
-
- openNewGenerationTopic();
- }}
- />
- );
-});
-
-AddButton.displayName = 'GenerationLayoutAddButton';
-
-export default AddButton;
diff --git a/src/routes/(main)/(create)/image/NotSupportClient.tsx b/src/routes/(main)/(create)/image/NotSupportClient.tsx
deleted file mode 100644
index bf586385053..00000000000
--- a/src/routes/(main)/(create)/image/NotSupportClient.tsx
+++ /dev/null
@@ -1,155 +0,0 @@
-'use client';
-
-import { UTM_SOURCE } from '@lobechat/business-const';
-import { Center, Flexbox, Icon, Text } from '@lobehub/ui';
-import { createStaticStyles, cssVar } from 'antd-style';
-import { Database, FileImage, Network, Sparkles } from 'lucide-react';
-import { Trans, useTranslation } from 'react-i18next';
-
-import FeatureList from '@/components/FeatureList';
-import { DATABASE_SELF_HOSTING_URL, OFFICIAL_URL } from '@/const/url';
-
-const BLOCK_SIZE = 100;
-const ICON_SIZE = { size: 72, strokeWidth: 1.5 };
-
-const styles = createStaticStyles(({ css, cssVar }) => ({
- actionTitle: css`
- margin-block-start: 12px;
- font-size: 16px;
- color: ${cssVar.colorTextSecondary};
- `,
- card: css`
- cursor: pointer;
-
- position: relative;
-
- overflow: hidden;
-
- width: 200px;
- height: 140px;
- border-radius: ${cssVar.borderRadiusLG}px;
-
- font-weight: 500;
- text-align: center;
-
- background: ${cssVar.colorFillTertiary};
- box-shadow: 0 0 0 1px ${cssVar.colorFillTertiary} inset;
-
- transition: background 0.3s ease-in-out;
-
- &:hover {
- background: ${cssVar.colorFillSecondary};
- }
- `,
- glow: css`
- position: absolute;
- inset-block-end: -12px;
- inset-inline-end: 0;
-
- width: 48px;
- height: 48px;
-
- opacity: 0.5;
- filter: blur(24px);
- `,
-
- icon: css`
- border-radius: ${cssVar.borderRadiusLG}px;
- color: ${cssVar.colorTextLightSolid};
- `,
- iconGroup: css`
- margin-block-start: -44px;
- `,
-}));
-
-const NotSupportClient = () => {
- const { t } = useTranslation('image');
-
- const features = [
- {
- avatar: Network,
- desc: t('notSupportGuide.features.multiProviders.desc'),
- title: t('notSupportGuide.features.multiProviders.title'),
- },
- {
- avatar: Database,
- desc: t('notSupportGuide.features.fileIntegration.desc'),
- title: t('notSupportGuide.features.fileIntegration.title'),
- },
- {
- avatar: Sparkles,
- desc: t('notSupportGuide.features.llmAssisted.desc'),
- title: t('notSupportGuide.features.llmAssisted.title'),
- },
- ];
-
- return (
- <Center gap={40} height={'100%'} width={'100%'}>
- <Flexbox horizontal className={styles.iconGroup} gap={12}>
- <Center
- className={styles.icon}
- height={BLOCK_SIZE * 1.25}
- width={BLOCK_SIZE}
- style={{
- background: cssVar.purple,
- transform: 'rotateZ(-20deg) translateX(10px)',
- }}
- >
- <Icon icon={FileImage} size={ICON_SIZE} />
- </Center>
- <Center
- className={styles.icon}
- height={BLOCK_SIZE * 1.25}
- width={BLOCK_SIZE}
- style={{
- background: cssVar.gold,
- transform: 'translateY(-22px)',
- zIndex: 1,
- }}
- >
- <Icon icon={Sparkles} size={ICON_SIZE} />
- </Center>
- <Center
- className={styles.icon}
- height={BLOCK_SIZE * 1.25}
- width={BLOCK_SIZE}
- style={{
- background: cssVar.geekblue,
- transform: 'rotateZ(20deg) translateX(-10px)',
- }}
- >
- <Icon icon={Network} size={ICON_SIZE} />
- </Center>
- </Flexbox>
-
- <Flexbox justify={'center'} style={{ textAlign: 'center' }}>
- <Text strong fontSize={18}>
- {t('notSupportGuide.title')}
- </Text>
- <Text type={'secondary'}>
- <Trans
- i18nKey={'notSupportGuide.desc'}
- ns={'image'}
- components={[
- <span key="0" />,
- <a href={DATABASE_SELF_HOSTING_URL} key="1" rel="noreferrer" target="_blank" />,
- <span key="2" />,
- <a
- href={`${OFFICIAL_URL}?utm_source=${UTM_SOURCE}&utm_medium=client_not_support_image`}
- key="3"
- rel="noreferrer"
- target="_blank"
- />,
- ]}
- />
- </Text>
- </Flexbox>
-
- <Flexbox style={{ marginTop: 40 }}>
- <FeatureList data={features} />
- </Flexbox>
- </Center>
- );
-};
-
-export default NotSupportClient;
diff --git a/src/routes/(main)/(create)/image/features/ConfigPanel/ImageConfigSkeleton.tsx b/src/routes/(main)/(create)/image/features/ConfigPanel/ImageConfigSkeleton.tsx
deleted file mode 100644
index 259414b0069..00000000000
--- a/src/routes/(main)/(create)/image/features/ConfigPanel/ImageConfigSkeleton.tsx
+++ /dev/null
@@ -1,53 +0,0 @@
-'use client';
-
-import { Flexbox, Skeleton } from '@lobehub/ui';
-import { memo } from 'react';
-
-/**
- * Skeleton loading state for image configuration panel
- * Provides visual feedback during initialization
- */
-const ImageConfigSkeleton = memo(() => {
- return (
- <Flexbox gap={32} padding="12px 12px 0 12px" style={{ height: '100%' }}>
- {/* Model Selection */}
- <Flexbox gap={8}>
- <Skeleton.Button active size="small" style={{ width: 100 }} />
- <Skeleton.Button active size="large" style={{ width: '100%' }} />
- </Flexbox>
-
- {/* Image Upload Area */}
- <Flexbox gap={8}>
- <Skeleton.Button active size="small" style={{ width: 60 }} />
- <Skeleton.Block
- active
- style={{
- borderRadius: 8,
- height: 100,
- width: '100%',
- }}
- />
- </Flexbox>
-
- {/* Parameter Controls */}
- {Array.from({ length: 2 }, (_, index) => (
- <Flexbox gap={8} key={index}>
- <Skeleton.Button active size="small" style={{ width: 80 }} />
- <Skeleton.Button active size="default" style={{ width: '100%' }} />
- </Flexbox>
- ))}
-
- {/* Image Number Control (Sticky at bottom) */}
- <Flexbox padding="12px 0" style={{ marginTop: 'auto' }}>
- <Flexbox gap={8}>
- <Skeleton.Button active size="small" style={{ width: 60 }} />
- <Skeleton.Button active size="default" style={{ width: '100%' }} />
- </Flexbox>
- </Flexbox>
- </Flexbox>
- );
-});
-
-ImageConfigSkeleton.displayName = 'ImageConfigSkeleton';
-
-export default ImageConfigSkeleton;
diff --git a/src/routes/(main)/(create)/image/features/ConfigPanel/components/ImageUrl.tsx b/src/routes/(main)/(create)/image/features/ConfigPanel/components/ImageUrl.tsx
deleted file mode 100644
index 3f176efdca0..00000000000
--- a/src/routes/(main)/(create)/image/features/ConfigPanel/components/ImageUrl.tsx
+++ /dev/null
@@ -1,30 +0,0 @@
-import { memo } from 'react';
-
-import { useAutoDimensions } from '@/routes/(main)/(create)/image/features/ConfigPanel/hooks/useAutoDimensions';
-import { useGenerationConfigParam } from '@/store/image/slices/generationConfig/hooks';
-
-import ImageUpload from './ImageUpload';
-
-const ImageUrl = memo(() => {
- const { value: imageUrl, setValue, maxFileSize } = useGenerationConfigParam('imageUrl');
- const { autoSetDimensions, extractUrlAndDimensions } = useAutoDimensions();
-
- const handleChange = (
- data?:
- | string // Old API: just URL
- | { dimensions?: { height: number; width: number }; url: string }, // New API: URL with dimensions
- ) => {
- const { url, dimensions } = extractUrlAndDimensions(data);
-
- setValue(url ?? null);
-
- // Auto-set dimensions if available
- if (dimensions) {
- autoSetDimensions(dimensions);
- }
- };
-
- return <ImageUpload maxFileSize={maxFileSize} value={imageUrl} onChange={handleChange} />;
-});
-
-export default ImageUrl;
diff --git a/src/routes/(main)/(create)/image/features/ConfigPanel/components/ImageUrlsUpload.tsx b/src/routes/(main)/(create)/image/features/ConfigPanel/components/ImageUrlsUpload.tsx
deleted file mode 100644
index 5065fde503f..00000000000
--- a/src/routes/(main)/(create)/image/features/ConfigPanel/components/ImageUrlsUpload.tsx
+++ /dev/null
@@ -1,68 +0,0 @@
-import { memo } from 'react';
-
-import { useAutoDimensions } from '@/routes/(main)/(create)/image/features/ConfigPanel/hooks/useAutoDimensions';
-import { useGenerationConfigParam } from '@/store/image/slices/generationConfig/hooks';
-
-import ImageUpload from './ImageUpload';
-import MultiImagesUpload from './MultiImagesUpload';
-
-const ImageUrlsUpload = memo(() => {
- const { value, setValue, maxCount, maxFileSize } = useGenerationConfigParam('imageUrls');
- const { autoSetDimensions, extractUrlAndDimensions } = useAutoDimensions();
-
- // When maxCount is 1, use ImageUpload for single image upload
- if (maxCount === 1) {
- const handleSingleChange = (
- data?:
- | string // Old API: just URL
- | { dimensions?: { height: number; width: number }; url: string }, // New API: URL with dimensions
- ) => {
- const { url, dimensions } = extractUrlAndDimensions(data);
-
- setValue(url ? [url] : []);
-
- // Auto-set dimensions if available
- if (dimensions) {
- autoSetDimensions(dimensions);
- }
- };
-
- return (
- <ImageUpload
- maxFileSize={maxFileSize}
- value={value?.[0] ?? null}
- onChange={handleSingleChange}
- />
- );
- }
-
- // Otherwise use MultiImagesUpload for multiple images
- const handleChange = (
- data:
- | string[] // Old API: just URLs
- | { dimensions?: { height: number; width: number }; urls: string[] }, // New API: URLs with first image dimensions
- ) => {
- const urls = Array.isArray(data) ? data : data.urls;
- const dimensions = Array.isArray(data) ? undefined : data.dimensions;
-
- // Directly set the URLs to the store
- // The store will handle URL to path conversion when needed
- setValue(urls);
-
- // Only auto-set dimensions if no existing images and only uploading one image
- if (!value?.length && urls.length === 1 && dimensions) {
- autoSetDimensions(dimensions);
- }
- };
-
- return (
- <MultiImagesUpload
- maxCount={maxCount}
- maxFileSize={maxFileSize}
- value={value}
- onChange={handleChange}
- />
- );
-});
-
-export default ImageUrlsUpload;
diff --git a/src/routes/(main)/(create)/image/loading.tsx b/src/routes/(main)/(create)/image/loading.tsx
deleted file mode 100644
index d1cef77b204..00000000000
--- a/src/routes/(main)/(create)/image/loading.tsx
+++ /dev/null
@@ -1,5 +0,0 @@
-import Loading from '@/components/Loading/BrandTextLoading';
-
-const ImageLoading = () => <Loading debugId="Image Page" />;
-
-export default ImageLoading;
diff --git a/src/routes/(main)/(create)/video/features/ConfigPanel/VideoConfigSkeleton.tsx b/src/routes/(main)/(create)/video/features/ConfigPanel/VideoConfigSkeleton.tsx
deleted file mode 100644
index 4e00bb70a36..00000000000
--- a/src/routes/(main)/(create)/video/features/ConfigPanel/VideoConfigSkeleton.tsx
+++ /dev/null
@@ -1,65 +0,0 @@
-'use client';
-
-import { Flexbox, Skeleton } from '@lobehub/ui';
-import { memo } from 'react';
-
-const VideoConfigSkeleton = memo(() => {
- return (
- <Flexbox gap={16} padding={10}>
- {/* ModelSelect */}
- <Skeleton.Button active size="large" style={{ width: '100%' }} />
-
- {/* FrameUpload: imageUrl */}
- <Flexbox gap={8}>
- <Skeleton.Button active size="small" style={{ width: 60 }} />
- <Skeleton.Block active style={{ borderRadius: 8, height: 120, width: '100%' }} />
- </Flexbox>
-
- {/* FrameUpload: endImageUrl */}
- <Flexbox gap={8}>
- <Skeleton.Button active size="small" style={{ width: 50 }} />
- <Skeleton.Block active style={{ borderRadius: 8, height: 120, width: '100%' }} />
- </Flexbox>
-
- {/* AspectRatio */}
- <Flexbox gap={8}>
- <Skeleton.Button active size="small" style={{ width: 70 }} />
- <Skeleton.Block active style={{ borderRadius: 8, height: 64, width: '100%' }} />
- </Flexbox>
-
- {/* Resolution */}
- <Flexbox gap={8}>
- <Skeleton.Button active size="small" style={{ width: 50 }} />
- <Skeleton.Button active size="default" style={{ width: '100%' }} />
- </Flexbox>
-
- {/* Duration */}
- <Flexbox gap={8}>
- <Skeleton.Button active size="small" style={{ width: 40 }} />
- <Skeleton.Button active size="default" style={{ width: '100%' }} />
- </Flexbox>
-
- {/* Seed */}
- <Flexbox gap={8}>
- <Skeleton.Button active size="small" style={{ width: 40 }} />
- <Skeleton.Button active size="default" style={{ width: '100%' }} />
- </Flexbox>
-
- {/* generateAudio switch */}
- <Flexbox horizontal align="center" justify="space-between">
- <Skeleton.Button active size="small" style={{ width: 70 }} />
- <Skeleton.Button active size="small" style={{ borderRadius: 12, width: 44 }} />
- </Flexbox>
-
- {/* cameraFixed switch */}
- <Flexbox horizontal align="center" justify="space-between">
- <Skeleton.Button active size="small" style={{ width: 70 }} />
- <Skeleton.Button active size="small" style={{ borderRadius: 12, width: 44 }} />
- </Flexbox>
- </Flexbox>
- );
-});
-
-VideoConfigSkeleton.displayName = 'VideoConfigSkeleton';
-
-export default VideoConfigSkeleton;
diff --git a/src/routes/(main)/(create)/video/loading.tsx b/src/routes/(main)/(create)/video/loading.tsx
deleted file mode 100644
index ab8af8d3350..00000000000
--- a/src/routes/(main)/(create)/video/loading.tsx
+++ /dev/null
@@ -1,5 +0,0 @@
-import Loading from '@/components/Loading/BrandTextLoading';
-
-const VideoLoading = () => <Loading debugId="Video Page" />;
-
-export default VideoLoading;
diff --git a/src/routes/(main)/agent/channel/MessengerPromo.tsx b/src/routes/(main)/agent/channel/MessengerPromo.tsx
deleted file mode 100644
index 48b69f2f37a..00000000000
--- a/src/routes/(main)/agent/channel/MessengerPromo.tsx
+++ /dev/null
@@ -1,115 +0,0 @@
-'use client';
-
-import { ActionIcon } from '@lobehub/ui';
-import { Discord, Slack, Telegram } from '@lobehub/ui/icons';
-import { createStaticStyles } from 'antd-style';
-import { X } from 'lucide-react';
-import React, { memo, useCallback } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';
-import { useGlobalStore } from '@/store/global';
-import { systemStatusSelectors } from '@/store/global/selectors';
-
-// Bump this id when the card content changes so dismissing the old
-// variant does not hide the new one.
-const MESSENGER_PROMO_ID = 'messenger-promo-v1';
-
-const styles = createStaticStyles(({ css, cssVar }) => ({
- card: css`
- cursor: pointer;
-
- position: relative;
-
- display: flex;
- flex-direction: column;
- gap: 8px;
-
- margin-block: 0 8px;
- margin-inline: 12px;
- padding: 12px;
- border: 1px solid ${cssVar.colorFillSecondary};
- border-radius: 12px;
-
- background: color-mix(in srgb, ${cssVar.colorFillQuaternary} 50%, ${cssVar.colorBgContainer});
-
- transition: background 0.2s;
-
- &:hover {
- background: ${cssVar.colorFillTertiary};
- }
- `,
- closeButton: css`
- position: absolute;
- z-index: 1;
- inset-block-start: 4px;
- inset-inline-end: 4px;
- `,
- desc: css`
- font-size: 11px;
- line-height: 1.5;
- color: ${cssVar.colorTextTertiary};
- `,
- iconRow: css`
- display: flex;
- gap: 6px;
- align-items: center;
- `,
- title: css`
- font-size: 13px;
- font-weight: 500;
- color: ${cssVar.colorText};
- `,
-}));
-
-const ICON_SIZE = 16;
-
-const MessengerPromo = memo(() => {
- const { t } = useTranslation('agent');
- const navigate = useWorkspaceAwareNavigate();
-
- const isDismissed = useGlobalStore(systemStatusSelectors.isBannerDismissed(MESSENGER_PROMO_ID));
- const updateSystemStatus = useGlobalStore((s) => s.updateSystemStatus);
-
- const handleClick = useCallback(() => {
- navigate('/settings/messenger');
- }, [navigate]);
-
- const handleDismiss = useCallback(
- (e: React.MouseEvent) => {
- e.stopPropagation();
- const current = useGlobalStore.getState().status.dismissedBannerIds || [];
- if (current.includes(MESSENGER_PROMO_ID)) return;
- updateSystemStatus({
- dismissedBannerIds: [...current, MESSENGER_PROMO_ID],
- });
- },
- [updateSystemStatus],
- );
-
- if (isDismissed) return null;
-
- return (
- <div className={styles.card} onClick={handleClick}>
- <div className={styles.closeButton}>
- <ActionIcon
- icon={X}
- size="small"
- title={t('channel.messengerPromo.dismiss')}
- onClick={handleDismiss}
- />
- </div>
- <div className={styles.iconRow}>
- <Slack.Color size={ICON_SIZE} />
- <Discord.Color size={ICON_SIZE} />
- <Telegram.Color size={ICON_SIZE} />
- </div>
- <div className={styles.title}>{t('channel.messengerPromo.title')}</div>
- <div className={styles.desc}>{t('channel.messengerPromo.desc')}</div>
- </div>
- );
-});
-
-MessengerPromo.displayName = 'MessengerPromo';
-
-export default MessengerPromo;
diff --git a/src/routes/(main)/agent/features/ChangelogModal.tsx b/src/routes/(main)/agent/features/ChangelogModal.tsx
deleted file mode 100644
index 9dae9b5b9b9..00000000000
--- a/src/routes/(main)/agent/features/ChangelogModal.tsx
+++ /dev/null
@@ -1,7 +0,0 @@
-import ChangelogModal from '@/features/ChangelogModal';
-
-const Changelog = () => {
- return <ChangelogModal />;
-};
-
-export default Changelog;
diff --git a/src/routes/(main)/agent/features/Conversation/Header/ParamsPanelToggle/index.tsx b/src/routes/(main)/agent/features/Conversation/Header/ParamsPanelToggle/index.tsx
deleted file mode 100644
index d2f061d6e2c..00000000000
--- a/src/routes/(main)/agent/features/Conversation/Header/ParamsPanelToggle/index.tsx
+++ /dev/null
@@ -1,62 +0,0 @@
-'use client';
-
-import { ActionIcon } from '@lobehub/ui';
-import { Settings2Icon } from 'lucide-react';
-import { memo, useCallback } from 'react';
-import { useTranslation } from 'react-i18next';
-import { useLocation } from 'react-router';
-
-import { DESKTOP_HEADER_ICON_SMALL_SIZE } from '@/const/layoutTokens';
-import { useAgentStore } from '@/store/agent';
-import { agentSelectors } from '@/store/agent/selectors';
-import { useGlobalStore } from '@/store/global';
-import { systemStatusSelectors } from '@/store/global/selectors';
-
-const ParamsPanelToggle = memo(() => {
- const { t } = useTranslation('setting');
- const { pathname } = useLocation();
- const isHetero = useAgentStore(agentSelectors.isCurrentAgentHeterogeneous);
- const [showRightPanel, workingSidebarTab, setWorkingSidebarTab, toggleRightPanel, isStatusInit] =
- useGlobalStore((s) => [
- systemStatusSelectors.showRightPanel(s),
- s.status.workingSidebarTab,
- s.setWorkingSidebarTab,
- s.toggleRightPanel,
- systemStatusSelectors.isStatusInit(s),
- ]);
-
- const active = showRightPanel && workingSidebarTab === 'params';
-
- const handleClick = useCallback(() => {
- if (active) {
- toggleRightPanel(false);
- return;
- }
-
- setWorkingSidebarTab('params');
- toggleRightPanel(true);
- }, [active, setWorkingSidebarTab, toggleRightPanel]);
-
- if (isHetero || pathname.startsWith('/popup')) return null;
-
- // Defer render until status hydrates — toggleRightPanel is a no-op while
- // !isStatusInit and clicks would be silently dropped.
- if (!isStatusInit) return null;
-
- return (
- <ActionIcon
- active={active}
- icon={Settings2Icon}
- size={DESKTOP_HEADER_ICON_SMALL_SIZE}
- title={t('settingModel.params.panel.title')}
- tooltipProps={{
- placement: 'bottom',
- }}
- onClick={handleClick}
- />
- );
-});
-
-ParamsPanelToggle.displayName = 'ParamsPanelToggle';
-
-export default ParamsPanelToggle;
diff --git a/src/routes/(main)/agent/features/Conversation/Header/Tags/KnowledgeTag.tsx b/src/routes/(main)/agent/features/Conversation/Header/Tags/KnowledgeTag.tsx
deleted file mode 100644
index e7fcd979e69..00000000000
--- a/src/routes/(main)/agent/features/Conversation/Header/Tags/KnowledgeTag.tsx
+++ /dev/null
@@ -1,40 +0,0 @@
-'use client';
-
-import { type MenuProps } from '@lobehub/ui';
-import { DropdownMenu, Flexbox, Icon, Tag } from '@lobehub/ui';
-import { LibraryBig } from 'lucide-react';
-import { memo } from 'react';
-
-import KnowledgeIcon from '@/components/KnowledgeIcon';
-import { oneLineEllipsis } from '@/styles';
-import { type KnowledgeItem } from '@/types/knowledgeBase';
-
-export interface PluginTagProps {
- data: KnowledgeItem[];
-}
-
-const PluginTag = memo<PluginTagProps>(({ data }) => {
- if (data.length === 0) return null;
-
- const items: MenuProps['items'] = data.map((item) => ({
- icon: <KnowledgeIcon fileType={item.fileType} name={item.name} type={item.type} />,
- key: item.id,
- label: <Flexbox style={{ paddingInlineStart: 8 }}>{item.name}</Flexbox>,
- }));
-
- const count = data.length;
-
- return (
- <DropdownMenu items={items}>
- <Tag style={{ cursor: 'pointer' }}>
- {<Icon icon={LibraryBig} />}
- <div className={oneLineEllipsis} style={{ maxWidth: 140 }}>
- {data[0].name}
- </div>
- {count > 1 && <div>({data.length - 1}+)</div>}
- </Tag>
- </DropdownMenu>
- );
-});
-
-export default PluginTag;
diff --git a/src/routes/(main)/agent/features/Conversation/Header/Tags/SearchTags.tsx b/src/routes/(main)/agent/features/Conversation/Header/Tags/SearchTags.tsx
deleted file mode 100644
index 0b4b854952f..00000000000
--- a/src/routes/(main)/agent/features/Conversation/Header/Tags/SearchTags.tsx
+++ /dev/null
@@ -1,19 +0,0 @@
-import { Flexbox, Icon, Tag } from '@lobehub/ui';
-import { Globe } from 'lucide-react';
-import { memo } from 'react';
-import { useTranslation } from 'react-i18next';
-
-const SearchTag = memo(() => {
- const { t } = useTranslation('chat');
-
- return (
- <Flexbox height={22}>
- <Tag>
- {<Icon icon={Globe} />}
- <div>{t('search.title')}</div>
- </Tag>
- </Flexbox>
- );
-});
-
-export default SearchTag;
diff --git a/src/routes/(main)/agent/features/Conversation/Header/ViewSwitcher/index.tsx b/src/routes/(main)/agent/features/Conversation/Header/ViewSwitcher/index.tsx
deleted file mode 100644
index 06cebf49039..00000000000
--- a/src/routes/(main)/agent/features/Conversation/Header/ViewSwitcher/index.tsx
+++ /dev/null
@@ -1,120 +0,0 @@
-'use client';
-
-import { AGENT_CHAT_TOPIC_PAGE_URL, AGENT_CHAT_TOPIC_URL } from '@lobechat/const';
-import { Flexbox } from '@lobehub/ui';
-import { Tabs } from '@lobehub/ui/base-ui';
-import { createStaticStyles } from 'antd-style';
-import { FileText, MessageSquareText } from 'lucide-react';
-import { memo, useMemo } from 'react';
-import { useTranslation } from 'react-i18next';
-import { useLocation, useParams } from 'react-router';
-
-import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';
-import { useAgentStore } from '@/store/agent';
-import { agentSelectors } from '@/store/agent/selectors';
-import { useChatStore } from '@/store/chat';
-
-type ViewTab = 'chat' | 'page' | 'task';
-
-const styles = createStaticStyles(({ css }) => ({
- label: css`
- justify-content: center;
- width: 100%;
- min-width: 0;
- `,
- icon: css`
- display: none;
-
- @container agent-conv-header (max-width: 860px) {
- display: block;
- }
- `,
- text: css`
- display: block;
- text-align: center;
- white-space: nowrap;
-
- @container agent-conv-header (max-width: 860px) {
- display: none;
- }
- `,
-}));
-
-const ViewSwitcher = memo(() => {
- const { t } = useTranslation('chat');
- const navigate = useWorkspaceAwareNavigate();
- const location = useLocation();
- const params = useParams<{ aid?: string; topicId?: string }>();
- const activeTopicId = useChatStore((s) => s.activeTopicId);
- const isHeterogeneousAgent = useAgentStore(agentSelectors.isCurrentAgentHeterogeneous);
-
- const aid = params.aid;
- const topicId = params.topicId ?? activeTopicId ?? undefined;
-
- const currentTab = useMemo((): ViewTab => {
- if (!aid || !topicId) return 'chat';
- if (location.pathname.startsWith(AGENT_CHAT_TOPIC_PAGE_URL(aid, topicId))) return 'page';
- return 'chat';
- }, [aid, topicId, location.pathname]);
-
- const options = useMemo(
- () => [
- {
- key: 'chat',
- label: (
- <Flexbox
- horizontal
- align={'center'}
- className={styles.label}
- title={t('viewSwitcher.chat')}
- >
- <MessageSquareText className={styles.icon} size={16} />
- <span className={styles.text}>{t('viewSwitcher.chat')}</span>
- </Flexbox>
- ),
- },
- {
- key: 'page',
- label: (
- <Flexbox
- horizontal
- align={'center'}
- className={styles.label}
- title={t('viewSwitcher.page')}
- >
- <FileText className={styles.icon} size={16} />
- <span className={styles.text}>{t('viewSwitcher.page')}</span>
- </Flexbox>
- ),
- },
- ],
- [t],
- );
-
- const handleChange = (key: string) => {
- if (!aid) return;
-
- switch (key as ViewTab) {
- case 'chat': {
- if (topicId) navigate(AGENT_CHAT_TOPIC_URL(aid, topicId));
- break;
- }
- case 'page': {
- if (topicId) navigate(AGENT_CHAT_TOPIC_PAGE_URL(aid, topicId));
- break;
- }
- case 'task': {
- navigate(`/agent/${aid}/channel`);
- break;
- }
- }
- };
-
- if (!topicId || isHeterogeneousAgent) return null;
-
- return <Tabs activeKey={currentTab} items={options} size={'small'} onChange={handleChange} />;
-});
-
-ViewSwitcher.displayName = 'ViewSwitcher';
-
-export default ViewSwitcher;
diff --git a/src/routes/(main)/agent/features/Conversation/WorkingSidebar/AgentSummary.tsx b/src/routes/(main)/agent/features/Conversation/WorkingSidebar/AgentSummary.tsx
deleted file mode 100644
index 63dfa5618e0..00000000000
--- a/src/routes/(main)/agent/features/Conversation/WorkingSidebar/AgentSummary.tsx
+++ /dev/null
@@ -1,106 +0,0 @@
-import { Avatar, Flexbox } from '@lobehub/ui';
-import { Button } from '@lobehub/ui/base-ui';
-import { createStaticStyles, cssVar } from 'antd-style';
-import { memo, useMemo } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';
-import { getPlatformIcon } from '@/routes/(main)/agent/channel/const';
-import { useAgentStore } from '@/store/agent';
-import { agentSelectors } from '@/store/agent/selectors';
-import { useChatStore } from '@/store/chat';
-
-const styles = createStaticStyles(({ css }) => ({
- header: css`
- min-height: 128px;
- `,
- title: css`
- overflow: hidden;
-
- font-size: 16px;
- font-weight: 600;
- color: ${cssVar.colorText};
- text-overflow: ellipsis;
- white-space: nowrap;
- `,
- channelCount: css`
- font-size: 12px;
- color: ${cssVar.colorTextSecondary};
- `,
- channelIcon: css`
- flex-shrink: 0;
- `,
-}));
-
-const AgentSummary = memo(() => {
- const { t } = useTranslation(['chat', 'discover']);
- const navigate = useWorkspaceAwareNavigate();
- // WorkingSidebar renders outside the ConversationProvider, so take the routed
- // agent from the chat store (set by AgentIdSync, not the hijack-prone agent
- // store) and read its meta by id.
- const activeAgentId = useChatStore((s) => s.activeAgentId) || '';
- const meta = useAgentStore(agentSelectors.getAgentMetaById(activeAgentId));
- const { data: providers = [] } = useAgentStore((s) => s.useFetchBotProviders(activeAgentId));
- const { data: platforms = [] } = useAgentStore((s) => s.useFetchPlatformDefinitions());
- const title = meta.title || t('untitledAgent');
-
- const enabledChannels = useMemo(() => providers.filter((item) => item.enabled), [providers]);
-
- const channelIcons = useMemo(() => {
- const platformNameById = new Map(platforms.map((item) => [item.id, item.name]));
- const iconKeys = Array.from(
- new Set(
- enabledChannels.map((item) => {
- const name = platformNameById.get(item.platform) || item.platform;
- return name;
- }),
- ),
- );
-
- return iconKeys
- .map((key) => ({ Icon: getPlatformIcon(key), key }))
- .filter((item): item is { Icon: NonNullable<typeof item.Icon>; key: string } => !!item.Icon)
- .slice(0, 3);
- }, [enabledChannels, platforms]);
-
- return (
- <Flexbox
- className={styles.header}
- data-testid="workspace-summary"
- gap={8}
- padding={16}
- width={'100%'}
- >
- <Flexbox gap={12}>
- <Avatar avatar={meta.avatar} background={meta.backgroundColor} shape={'square'} size={44} />
- <Flexbox gap={4} style={{ minWidth: 0 }}>
- <Flexbox horizontal align={'center'} gap={6}>
- <strong className={styles.title}>{title}</strong>
- {channelIcons.map(({ Icon, key }) => (
- <Icon className={styles.channelIcon} key={key} size={14} />
- ))}
- {enabledChannels.length > channelIcons.length && (
- <span className={styles.channelCount}>
- +{enabledChannels.length - channelIcons.length}
- </span>
- )}
- </Flexbox>
- </Flexbox>
- </Flexbox>
- <Button
- block
- shape={'round'}
- size={'small'}
- style={{ color: cssVar.colorTextTertiary, width: 'fit-content' }}
- type={'fill'}
- onClick={() => activeAgentId && navigate(`/agent/${activeAgentId}/profile`)}
- >
- {t('user.editProfile', { ns: 'discover' })}
- </Button>
- </Flexbox>
- );
-});
-
-AgentSummary.displayName = 'AgentSummary';
-
-export default AgentSummary;
diff --git a/src/routes/(main)/community/(detail)/agent/features/Details/Overview/TagList.tsx b/src/routes/(main)/community/(detail)/agent/features/Details/Overview/TagList.tsx
deleted file mode 100644
index 34af75184ce..00000000000
--- a/src/routes/(main)/community/(detail)/agent/features/Details/Overview/TagList.tsx
+++ /dev/null
@@ -1,54 +0,0 @@
-'use client';
-
-import { Flexbox, Tag } from '@lobehub/ui';
-import { createStaticStyles } from 'antd-style';
-import qs from 'query-string';
-import { memo } from 'react';
-
-import WorkspaceLink from '@/features/Workspace/WorkspaceLink';
-import { useQuery } from '@/hooks/useQuery';
-import { type AssistantMarketSource } from '@/types/discover';
-
-const styles = createStaticStyles(({ cssVar, css }) => {
- return {
- tag: css`
- margin: 0;
- padding-block: 4px;
- padding-inline: 12px;
- border-radius: 16px;
-
- color: ${cssVar.colorTextSecondary};
- `,
- };
-});
-
-const TagList = memo<{ tags: string[] }>(({ tags }) => {
- const { source } = useQuery() as { source?: AssistantMarketSource };
- const marketSource = source === 'legacy' ? 'legacy' : undefined;
- const showTags = Boolean(tags?.length && tags?.length > 0);
- return (
- showTags && (
- <Flexbox horizontal gap={8} wrap={'wrap'}>
- {tags.map((tag) => (
- <WorkspaceLink
- key={tag}
- to={qs.stringifyUrl(
- {
- query: {
- q: tag,
- source: marketSource,
- },
- url: '/community/agent',
- },
- { skipNull: true },
- )}
- >
- <Tag className={styles.tag}>{tag}</Tag>
- </WorkspaceLink>
- ))}
- </Flexbox>
- )
- );
-});
-
-export default TagList;
diff --git a/src/routes/(main)/community/(detail)/agent/features/Sidebar/ActionButton/AddAgent.tsx b/src/routes/(main)/community/(detail)/agent/features/Sidebar/ActionButton/AddAgent.tsx
deleted file mode 100644
index 504e5056bae..00000000000
--- a/src/routes/(main)/community/(detail)/agent/features/Sidebar/ActionButton/AddAgent.tsx
+++ /dev/null
@@ -1,191 +0,0 @@
-'use client';
-
-import { AGENT_CHAT_URL } from '@lobechat/const';
-import { DropdownMenu, Flexbox, Icon } from '@lobehub/ui';
-import { Button, confirmModal } from '@lobehub/ui/base-ui';
-import { App } from 'antd';
-import { createStaticStyles } from 'antd-style';
-import { ChevronDownIcon } from 'lucide-react';
-import { memo, useState } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import { useActiveWorkspaceId } from '@/business/client/hooks/useActiveWorkspaceId';
-import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';
-import { usePermission } from '@/hooks/usePermission';
-import { agentService } from '@/services/agent';
-import { discoverService } from '@/services/discover';
-import { useAgentStore } from '@/store/agent';
-import { useHomeStore } from '@/store/home';
-
-import { useDetailContext } from '../../DetailProvider';
-
-const styles = createStaticStyles(({ css }) => ({
- buttonGroup: css`
- width: 100%;
- `,
- menuButton: css`
- padding-inline: 8px;
- border-start-start-radius: 0 !important;
- border-end-start-radius: 0 !important;
- `,
- primaryButton: css`
- border-start-end-radius: 0 !important;
- border-end-end-radius: 0 !important;
- `,
-}));
-
-const AddAgent = memo<{ mobile?: boolean }>(({ mobile }) => {
- const { avatar, description, tags, title, config, backgroundColor, identifier, editorData } =
- useDetailContext();
- const [isLoading, setIsLoading] = useState(false);
- const createAgent = useAgentStore((s) => s.createAgent);
- const refreshAgentList = useHomeStore((s) => s.refreshAgentList);
- const { message } = App.useApp();
- const navigate = useWorkspaceAwareNavigate();
- const { t } = useTranslation('discover');
- const { allowed: canCreate } = usePermission('create_content');
- const activeWorkspaceId = useActiveWorkspaceId();
-
- const meta = {
- avatar,
- backgroundColor,
- description,
- marketIdentifier: identifier,
- tags,
- title,
- };
-
- const checkDuplicateAgent = async () => {
- if (!identifier) return false;
- return agentService.checkByMarketIdentifier(identifier);
- };
-
- const showDuplicateConfirmation = (callback: () => void) => {
- confirmModal({
- cancelText: t('cancel', { ns: 'common' }),
- content: t('assistants.duplicateAdd.content', { title }),
- okText: t('assistants.duplicateAdd.ok'),
- onOk: callback,
- title: t('assistants.duplicateAdd.title'),
- });
- };
-
- const createAgentWithMarketIdentifier = async (shouldNavigate = true) => {
- if (!canCreate || !config) return;
-
- // Note: agentService.createAgent automatically normalizes market config (handles model as object)
- // In workspace mode, default the new agent to the user's Private bucket
- // — they can promote it to the workspace later via "Publish to Workspace".
- const agentData = {
- config: {
- ...config,
- editorData,
- ...meta,
- },
- ...(activeWorkspaceId ? { visibility: 'private' as const } : {}),
- };
-
- const result = await createAgent(agentData);
- await refreshAgentList();
-
- // Report agent installation to marketplace if it has a market identifier
- if (identifier) {
- discoverService.reportAgentInstall(identifier);
- discoverService.reportAgentEvent({
- event: 'add',
- identifier,
- source: location.pathname,
- });
- }
-
- void shouldNavigate;
-
- return result;
- };
-
- const handleCreateAndConverse = async () => {
- if (!canCreate) return;
- setIsLoading(true);
- try {
- const result = await createAgentWithMarketIdentifier(true);
- message.success(t('assistants.addAgentSuccess'));
- navigate(AGENT_CHAT_URL(result!.agentId, mobile));
- } finally {
- setIsLoading(false);
- }
- };
-
- const handleCreate = async () => {
- if (!canCreate) return;
- setIsLoading(true);
- try {
- await createAgentWithMarketIdentifier(false);
- message.success(t('assistants.addAgentSuccess'));
- } finally {
- setIsLoading(false);
- }
- };
-
- const handleAddAgentAndConverse = async () => {
- if (!canCreate || !config) return;
-
- const isDuplicate = await checkDuplicateAgent();
- if (isDuplicate) {
- showDuplicateConfirmation(handleCreateAndConverse);
- } else {
- await handleCreateAndConverse();
- }
- };
-
- const handleAddAgent = async () => {
- if (!canCreate || !config) return;
-
- const isDuplicate = await checkDuplicateAgent();
- if (isDuplicate) {
- showDuplicateConfirmation(handleCreate);
- } else {
- await handleCreate();
- }
- };
-
- const menuItems = [
- {
- disabled: !canCreate,
- key: 'addAgent',
- label: t('assistants.addAgent'),
- onClick: handleAddAgent,
- },
- ];
-
- return (
- <Flexbox horizontal className={styles.buttonGroup} gap={0}>
- <Button
- block
- className={styles.primaryButton}
- disabled={!canCreate}
- loading={isLoading}
- size={'large'}
- style={{ flex: 1, width: 'unset' }}
- type={'primary'}
- onClick={handleAddAgentAndConverse}
- >
- {t('assistants.addAgentAndConverse')}
- </Button>
- <DropdownMenu
- items={menuItems}
- popupProps={{ style: { minWidth: 267 } }}
- triggerProps={{ disabled: isLoading || !canCreate }}
- >
- <Button
- className={styles.menuButton}
- disabled={isLoading || !canCreate}
- icon={<Icon icon={ChevronDownIcon} />}
- size={'large'}
- type={'primary'}
- />
- </DropdownMenu>
- </Flexbox>
- );
-});
-
-export default AddAgent;
diff --git a/src/routes/(main)/community/(detail)/features/Back.tsx b/src/routes/(main)/community/(detail)/features/Back.tsx
deleted file mode 100644
index a51a6edc1b2..00000000000
--- a/src/routes/(main)/community/(detail)/features/Back.tsx
+++ /dev/null
@@ -1,37 +0,0 @@
-'use client';
-
-import { Flexbox, Icon } from '@lobehub/ui';
-import { createStaticStyles } from 'antd-style';
-import { ArrowLeft } from 'lucide-react';
-import { type CSSProperties } from 'react';
-import { memo } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import WorkspaceLink from '@/features/Workspace/WorkspaceLink';
-
-const styles = createStaticStyles(({ css, cssVar }) => {
- return {
- back: css`
- color: ${cssVar.colorTextDescription};
-
- &:hover {
- color: ${cssVar.colorText};
- }
- `,
- };
-});
-
-const Back = memo<{ href: string; style?: CSSProperties }>(({ href, style }) => {
- const { t } = useTranslation('discover');
-
- return (
- <WorkspaceLink className={styles.back} style={{ marginBottom: 8, ...style }} to={href}>
- <Flexbox horizontal align={'center'} gap={8}>
- <Icon icon={ArrowLeft} />
- {t(`back`)}
- </Flexbox>
- </WorkspaceLink>
- );
-});
-
-export default Back;
diff --git a/src/routes/(main)/community/(detail)/features/Block.tsx b/src/routes/(main)/community/(detail)/features/Block.tsx
deleted file mode 100644
index d5294ba2c36..00000000000
--- a/src/routes/(main)/community/(detail)/features/Block.tsx
+++ /dev/null
@@ -1,49 +0,0 @@
-import { type FlexboxProps } from '@lobehub/ui';
-import { Flexbox, Icon } from '@lobehub/ui';
-import { Button } from '@lobehub/ui/base-ui';
-import { createStaticStyles } from 'antd-style';
-import { ChevronRight } from 'lucide-react';
-import { memo } from 'react';
-
-import WorkspaceLink from '@/features/Workspace/WorkspaceLink';
-
-const styles = createStaticStyles(({ css, cssVar }) => ({
- more: css`
- display: flex;
- align-items: center;
- color: ${cssVar.colorTextSecondary};
- `,
- title: css`
- margin-block: 0;
- font-size: 16px;
- font-weight: bold;
- line-height: 1.2;
- `,
-}));
-
-interface BlockProps extends FlexboxProps {
- more?: string;
- moreLink?: string;
- title: string;
-}
-
-const Block = memo<BlockProps>(({ title, more, moreLink, children, ...rest }) => {
- return (
- <Flexbox gap={16} style={{ position: 'relative' }} width={'100%'}>
- <Flexbox horizontal align={'center'} gap={16} justify={'space-between'} width={'100%'}>
- <h2 className={styles.title}>{title}</h2>
- {moreLink && (
- <WorkspaceLink target={moreLink.startsWith('http') ? '_blank' : undefined} to={moreLink}>
- <Button className={styles.more} type={'text'}>
- <span>{more}</span>
- <Icon icon={ChevronRight} />
- </Button>
- </WorkspaceLink>
- )}
- </Flexbox>
- <Flexbox {...rest}>{children}</Flexbox>
- </Flexbox>
- );
-});
-
-export default Block;
diff --git a/src/routes/(main)/community/(detail)/features/Breadcrumb.tsx b/src/routes/(main)/community/(detail)/features/Breadcrumb.tsx
deleted file mode 100644
index 0a77992692a..00000000000
--- a/src/routes/(main)/community/(detail)/features/Breadcrumb.tsx
+++ /dev/null
@@ -1,80 +0,0 @@
-'use client';
-
-import { CopyButton, Flexbox } from '@lobehub/ui';
-import { type BreadcrumbProps } from 'antd';
-import { Breadcrumb as AntdBreadcrumb } from 'antd';
-import { cssVar } from 'antd-style';
-import { memo, useMemo } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import WorkspaceLink from '@/features/Workspace/WorkspaceLink';
-import { DiscoverTab } from '@/types/discover';
-
-const Breadcrumb = memo<{ identifier: string; tab: DiscoverTab }>(({ tab, identifier }) => {
- const { t } = useTranslation('discover');
-
- const tabLabel = useMemo(() => {
- if (tab === DiscoverTab.Mcp) return 'MCP Servers';
- if (tab === DiscoverTab.User) return t('tab.user');
- return t(`tab.${tab}` as any);
- }, [tab, t]);
-
- // For user tab, we don't show the middle breadcrumb as there's no user list page
- const items: BreadcrumbProps['items'] = useMemo(() => {
- if (tab === DiscoverTab.User) {
- return [
- {
- title: <WorkspaceLink to="/community">Community</WorkspaceLink>,
- },
- {
- title: (
- <Flexbox
- horizontal
- align="center"
- gap={4}
- style={{
- color: cssVar.colorTextSecondary,
- }}
- >
- @{identifier}
- </Flexbox>
- ),
- },
- ];
- }
-
- return [
- {
- title: <WorkspaceLink to="/community">Community</WorkspaceLink>,
- },
- {
- title: <WorkspaceLink to={`/community/${tab}`}>{tabLabel}</WorkspaceLink>,
- },
- {
- title: (
- <Flexbox
- horizontal
- align="center"
- gap={4}
- style={{
- color: cssVar.colorTextSecondary,
- }}
- >
- {identifier}
- <CopyButton
- content={identifier}
- size={{
- blockSize: 22,
- size: 14,
- }}
- />
- </Flexbox>
- ),
- },
- ];
- }, [tab, identifier, tabLabel]);
-
- return <AntdBreadcrumb items={items} />;
-});
-
-export default Breadcrumb;
diff --git a/src/routes/(main)/community/(detail)/features/DetailLayout.tsx b/src/routes/(main)/community/(detail)/features/DetailLayout.tsx
deleted file mode 100644
index d3f9d80ad64..00000000000
--- a/src/routes/(main)/community/(detail)/features/DetailLayout.tsx
+++ /dev/null
@@ -1,59 +0,0 @@
-'use client';
-
-import { Flexbox } from '@lobehub/ui';
-import { useResponsive } from 'antd-style';
-import { type ReactNode } from 'react';
-import { memo } from 'react';
-
-import Footer from '@/features/Setting/Footer';
-
-import SidebarContainer from './SidebarContainer';
-
-interface DetailLayoutProps {
- actions?: ReactNode;
- children?: ReactNode;
- header: ReactNode;
- mobile?: boolean;
- sidebar?: ReactNode;
- statistics?: ReactNode;
-}
-
-const DetailLayout = memo<DetailLayoutProps>(
- ({ statistics, mobile, header, sidebar, children, actions }) => {
- const { md = true } = useResponsive();
-
- if (mobile || !md)
- return (
- <>
- {header}
- <Flexbox gap={16} width={'100%'}>
- {actions}
- {statistics}
- </Flexbox>
- {children}
- {sidebar}
- <Footer />
- </>
- );
-
- return (
- <>
- {header}
- <Flexbox horizontal gap={32} width={'100%'}>
- <Flexbox flex={1} gap={48} style={{ overflow: 'hidden', position: 'relative' }}>
- {children}
- </Flexbox>
- <SidebarContainer>
- <Flexbox gap={16} width={'100%'}>
- {actions}
- {statistics}
- </Flexbox>
- {sidebar}
- </SidebarContainer>
- </Flexbox>
- </>
- );
- },
-);
-
-export default DetailLayout;
diff --git a/src/routes/(main)/community/(detail)/features/HighlightBlock.tsx b/src/routes/(main)/community/(detail)/features/HighlightBlock.tsx
deleted file mode 100644
index 70e29e0ef36..00000000000
--- a/src/routes/(main)/community/(detail)/features/HighlightBlock.tsx
+++ /dev/null
@@ -1,81 +0,0 @@
-'use client';
-
-import { type FlexboxProps } from '@lobehub/ui';
-import { Flexbox, Icon } from '@lobehub/ui';
-import { createStaticStyles } from 'antd-style';
-import { type LucideIcon } from 'lucide-react';
-import { type ReactNode } from 'react';
-import { memo } from 'react';
-
-import { useServerConfigStore } from '@/store/serverConfig';
-
-import CardBanner from '../../components/CardBanner';
-
-const styles = createStaticStyles(({ css, cssVar }) => ({
- background: css`
- pointer-events: none;
-
- position: absolute;
- z-index: 0;
- inset: 0;
- transform: scale(3);
-
- overflow: hidden;
-
- &::before {
- content: '';
-
- position: absolute;
- z-index: 1;
- inset: 0;
-
- width: 100%;
- height: 100%;
-
- background: color-mix(in srgb, ${cssVar.colorBgContainer} 50%, transparent);
- }
- `,
- container: css`
- position: relative;
- overflow: hidden;
- border-radius: ${cssVar.borderRadiusLG};
- box-shadow:
- 0 0 0 1px ${cssVar.colorFill} inset,
- ${cssVar.boxShadowTertiary};
- `,
- header: css`
- position: relative;
- overflow: hidden;
- height: 58px;
- border-block-end: 1px solid ${cssVar.colorBorderSecondary};
- `,
-}));
-
-interface HighlightBlockProps extends FlexboxProps {
- avatar?: string | ReactNode;
- icon: LucideIcon;
- title: string;
-}
-
-const HighlightBlock = memo<HighlightBlockProps>(({ avatar, title, icon, children, ...rest }) => {
- const mobile = useServerConfigStore((s) => s.isMobile);
- return (
- <Flexbox className={styles.container} flex={'none'} width={'100%'} {...rest}>
- <Flexbox
- horizontal
- align={'center'}
- className={styles.header}
- flex={'none'}
- gap={12}
- padding={16}
- >
- <Icon icon={icon} size={20} style={{ zIndex: 1 }} />
- <h2 style={{ fontSize: 16, fontWeight: 'bold', margin: 0, zIndex: 1 }}>{title}</h2>
- <CardBanner avatar={avatar} className={styles.background} size={mobile ? 64 : 512} />
- </Flexbox>
- {children}
- </Flexbox>
- );
-});
-
-export default HighlightBlock;
diff --git a/src/routes/(main)/community/(detail)/group_agent/features/Details/Members/index.tsx b/src/routes/(main)/community/(detail)/group_agent/features/Details/Members/index.tsx
deleted file mode 100644
index 54862dfea8b..00000000000
--- a/src/routes/(main)/community/(detail)/group_agent/features/Details/Members/index.tsx
+++ /dev/null
@@ -1,137 +0,0 @@
-import { Avatar, Flexbox, Tag } from '@lobehub/ui';
-import { Card, Typography } from 'antd';
-import { Crown, User } from 'lucide-react';
-import { memo } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import { useDetailContext } from '../../DetailProvider';
-
-const { Title, Text, Paragraph } = Typography;
-
-const MemberCard = memo(
- ({
- agent,
- currentVersion,
- }: {
- agent: any;
- currentVersion: any;
- }) => {
- const { t } = useTranslation('discover');
- const isSupervisor = agent.role === 'supervisor';
-
- return (
- <Card hoverable>
- <Flexbox gap={12}>
- {/* Avatar and Basic Info */}
- <Flexbox horizontal align="center" gap={12}>
- <Avatar avatar={currentVersion.avatar || agent.name[0]} size={48} />
- <Flexbox flex={1} gap={4}>
- <Flexbox horizontal align="center" gap={8}>
- <Title level={5} style={{ margin: 0 }}>
- {currentVersion.name || agent.name}
- </Title>
- {isSupervisor ? (
- <Tag color="gold" icon={<Crown size={12} />}>
- {t('members.supervisor', { defaultValue: 'Supervisor' })}
- </Tag>
- ) : (
- <Tag color="blue" icon={<User size={12} />}>
- {t('members.participant', { defaultValue: 'Participant' })}
- </Tag>
- )}
- </Flexbox>
- <Text type="secondary">{agent.identifier}</Text>
- </Flexbox>
- </Flexbox>
-
- {/* Description */}
- {currentVersion.description && (
- <Paragraph ellipsis={{ rows: 2 }} style={{ margin: 0 }} type="secondary">
- {currentVersion.description}
- </Paragraph>
- )}
-
- {/* System Role (if available) */}
- {currentVersion.config?.systemRole && (
- <Flexbox gap={4}>
- <Text strong>{t('members.systemRole', { defaultValue: 'System Role' })}:</Text>
- <Paragraph ellipsis={{ rows: 3 }} style={{ margin: 0 }} type="secondary">
- {currentVersion.config.systemRole}
- </Paragraph>
- </Flexbox>
- )}
-
- {/* Metadata */}
- <Flexbox horizontal gap={8} wrap="wrap">
- {currentVersion.version && (
- <Text type="secondary">
- {t('members.version', { defaultValue: 'Version' })}: {currentVersion.version}
- </Text>
- )}
- {currentVersion.tokenUsage !== undefined && (
- <Text type="secondary">
- {t('members.tokenUsage', { defaultValue: 'Token Usage' })}:{' '}
- {currentVersion.tokenUsage}
- </Text>
- )}
- </Flexbox>
-
- {/* URL */}
- {currentVersion.url && (
- <Text
- ellipsis
- copyable={{ text: currentVersion.url }}
- style={{ fontSize: 12 }}
- type="secondary"
- >
- {currentVersion.url}
- </Text>
- )}
- </Flexbox>
- </Card>
- );
- },
-);
-
-MemberCard.displayName = 'MemberCard';
-
-const Members = memo(() => {
- const { t } = useTranslation('discover');
- const { memberAgents = [] } = useDetailContext();
-
- // Sort: supervisors first, then by displayOrder
- const sortedMembers = [...(memberAgents || [])].sort((a: any, b: any) => {
- const aRole = a.role || a.agent?.role;
- const bRole = b.role || b.agent?.role;
- if (aRole === 'supervisor' && bRole !== 'supervisor') return -1;
- if (aRole !== 'supervisor' && bRole === 'supervisor') return 1;
- const aOrder = a.displayOrder || a.agent?.displayOrder || 0;
- const bOrder = b.displayOrder || b.agent?.displayOrder || 0;
- return aOrder - bOrder;
- });
-
- return (
- <Flexbox gap={16}>
- <Title level={4}>
- {t('members.title', { defaultValue: 'Member Agents' })} ({memberAgents?.length || 0})
- </Title>
-
- <Flexbox gap={12}>
- {sortedMembers.map((member: any, index) => {
- // Support both flat structure and nested structure
- const agent = member.agent || member;
- const currentVersion = member.currentVersion || member;
- return (
- <MemberCard
- agent={agent}
- currentVersion={currentVersion}
- key={agent.identifier || index}
- />
- );
- })}
- </Flexbox>
- </Flexbox>
- );
-});
-
-export default Members;
diff --git a/src/routes/(main)/community/(detail)/group_agent/features/Details/Related/index.tsx b/src/routes/(main)/community/(detail)/group_agent/features/Details/Related/index.tsx
deleted file mode 100644
index fe390def6bb..00000000000
--- a/src/routes/(main)/community/(detail)/group_agent/features/Details/Related/index.tsx
+++ /dev/null
@@ -1,89 +0,0 @@
-import { Avatar, Flexbox, Grid, Text } from '@lobehub/ui';
-import qs from 'query-string';
-import { memo } from 'react';
-import { useTranslation } from 'react-i18next';
-import urlJoin from 'url-join';
-
-import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';
-import { type DiscoverGroupAgentItem } from '@/types/discover';
-
-import Title from '../../../../../features/Title';
-import { useDetailContext } from '../../DetailProvider';
-
-const GroupAgentCard = memo<DiscoverGroupAgentItem>((item) => {
- const navigate = useWorkspaceAwareNavigate();
-
- const handleClick = () => {
- if (!item.identifier) return;
- navigate(
- qs.stringifyUrl({
- url: urlJoin('/community/group_agent', item.identifier),
- }),
- );
- };
-
- return (
- <Flexbox
- gap={12}
- padding={16}
- style={{
- border: '1px solid var(--lobe-border-color)',
- borderRadius: 8,
- cursor: 'pointer',
- transition: 'all 0.2s',
- }}
- onClick={handleClick}
- >
- <Flexbox horizontal align="center" gap={12}>
- <Avatar avatar={item.avatar || item.title[0]} shape="square" size={48} />
- <Flexbox flex={1} gap={4}>
- <Text ellipsis style={{ fontWeight: 500 }}>
- {item.title}
- </Text>
- <Text ellipsis style={{ fontSize: 12, opacity: 0.65 }} type="secondary">
- {item.description}
- </Text>
- </Flexbox>
- </Flexbox>
- </Flexbox>
- );
-});
-
-const Related = memo(() => {
- const { t } = useTranslation('discover');
- const { related = [], category } = useDetailContext();
-
- return (
- <Flexbox gap={16}>
- <Title
- more={t('groupAgents.details.related.more', { defaultValue: 'View More' })}
- moreLink={qs.stringifyUrl(
- {
- query: {
- category,
- },
- url: '/community/group_agent',
- },
- { skipNull: true },
- )}
- >
- {t('groupAgents.details.related.listTitle', { defaultValue: 'Related Group Agents' })}
- </Title>
- {related.length > 0 ? (
- <Grid rows={4}>
- {related.map((item) => (
- <GroupAgentCard key={item.identifier} {...item} />
- ))}
- </Grid>
- ) : (
- <Flexbox align="center" padding={32} style={{ color: '#999' }}>
- {t('groupAgents.details.related.empty', {
- defaultValue: 'No related group agents found',
- })}
- </Flexbox>
- )}
- </Flexbox>
- );
-});
-
-export default Related;
diff --git a/src/routes/(main)/community/(detail)/group_agent/features/Sidebar/ActionButton/AddGroupAgent.tsx b/src/routes/(main)/community/(detail)/group_agent/features/Sidebar/ActionButton/AddGroupAgent.tsx
deleted file mode 100644
index bd4145a13d3..00000000000
--- a/src/routes/(main)/community/(detail)/group_agent/features/Sidebar/ActionButton/AddGroupAgent.tsx
+++ /dev/null
@@ -1,281 +0,0 @@
-'use client';
-
-import { DropdownMenu, Flexbox, Icon } from '@lobehub/ui';
-import { Button, confirmModal } from '@lobehub/ui/base-ui';
-import { App } from 'antd';
-import { createStaticStyles } from 'antd-style';
-import { ChevronDownIcon } from 'lucide-react';
-import { memo, useState } from 'react';
-import { useTranslation } from 'react-i18next';
-import urlJoin from 'url-join';
-
-import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';
-import { usePermission } from '@/hooks/usePermission';
-import { chatGroupService } from '@/services/chatGroup';
-import { discoverService } from '@/services/discover';
-import { useAgentGroupStore } from '@/store/agentGroup';
-
-import { useDetailContext } from '../../DetailProvider';
-
-const styles = createStaticStyles(({ css }) => ({
- buttonGroup: css`
- width: 100%;
- `,
- menuButton: css`
- padding-inline: 8px;
- border-start-start-radius: 0 !important;
- border-end-start-radius: 0 !important;
- `,
- primaryButton: css`
- border-start-end-radius: 0 !important;
- border-end-end-radius: 0 !important;
- `,
-}));
-
-const AddGroupAgent = memo<{ mobile?: boolean }>(() => {
- const {
- avatar,
- description,
- tags,
- title,
- config,
- backgroundColor,
- identifier,
- memberAgents = [],
- } = useDetailContext();
- const [isLoading, setIsLoading] = useState(false);
- const { message } = App.useApp();
- const { t } = useTranslation('discover');
- const navigate = useWorkspaceAwareNavigate();
- const loadGroups = useAgentGroupStore((s) => s.loadGroups);
- const { allowed: canCreate } = usePermission('create_content');
-
- const meta = {
- avatar,
- backgroundColor,
- description,
- tags,
- title,
- };
-
- // Check if a group with the same title already exists
- const checkDuplicateGroup = async () => {
- if (!title) return false;
- try {
- const groups = await chatGroupService.getGroups();
- return groups.some((g) => g.title === title);
- } catch {
- return false;
- }
- };
-
- const showDuplicateConfirmation = (callback: () => void) => {
- confirmModal({
- cancelText: t('cancel', { ns: 'common' }),
- content: t('groupAgents.duplicateAdd.content', {
- defaultValue: 'This group agent has already been added. Do you want to add it again?',
- title,
- }),
- okText: t('groupAgents.duplicateAdd.ok', { defaultValue: 'Add Anyway' }),
- onOk: callback,
- title: t('groupAgents.duplicateAdd.title', { defaultValue: 'Group Already Added' }),
- });
- };
-
- const createGroupFromMarket = async (shouldNavigate = true) => {
- if (!canCreate) return;
- if (!config) {
- message.error(
- t('groupAgents.noConfig', { defaultValue: 'Group configuration not available' }),
- );
- return;
- }
-
- // Find supervisor from memberAgents
- const supervisorMember = memberAgents.find((member: any) => {
- const agent = member.agent || member;
- const role = member.role || agent.role;
- return role === 'supervisor';
- });
-
- // Prepare supervisor config
- let supervisorConfig;
- if (supervisorMember) {
- // Type assertion needed because actual API data structure differs from type definition
- const member = supervisorMember as any;
- const agent = member.agent || member;
- const currentVersion = member.currentVersion || member;
- const rawConfig = {
- avatar: currentVersion.avatar,
- backgroundColor: currentVersion.backgroundColor,
- description: currentVersion.description,
- model: currentVersion.config?.model || currentVersion.model,
- params: currentVersion.config?.params || currentVersion.params,
- provider: currentVersion.config?.provider || currentVersion.provider,
- systemRole:
- currentVersion.config?.systemRole ||
- currentVersion.config?.systemPrompt ||
- currentVersion.systemRole ||
- currentVersion.content,
- tags: currentVersion.tags,
- title: currentVersion.name || agent.name || 'Supervisor',
- };
- // Filter out null/undefined values
- supervisorConfig = Object.fromEntries(
- Object.entries(rawConfig).filter(([_, v]) => v != null),
- );
- }
-
- // Prepare group config
- const groupConfig = {
- config: {
- allowDM: config.allowDM,
- openingMessage: config.openingMessage,
- openingQuestions: config.openingQuestions,
- revealDM: config.revealDM,
- },
- // Group content is the supervisor's systemRole (for backward compatibility)
- content: supervisorConfig?.systemRole || config.systemRole,
- ...meta,
- };
-
- // Prepare member agents from market data
- // Filter out supervisor role as it will be created separately using supervisorConfig
- const members = memberAgents
- .filter((member: any) => {
- const agent = member.agent || member;
- const role = member.role || agent.role;
- return role !== 'supervisor';
- })
- .map((member: any) => {
- const agent = member.agent || member;
- const currentVersion = member.currentVersion || member;
- return {
- avatar: currentVersion.avatar,
- backgroundColor: currentVersion.backgroundColor,
- description: currentVersion.description,
- model: currentVersion.config?.model || currentVersion.model,
- plugins: currentVersion.plugins,
- provider: currentVersion.config?.provider || currentVersion.provider,
- systemRole:
- currentVersion.config?.systemRole ||
- currentVersion.config?.systemPrompt ||
- currentVersion.systemRole ||
- currentVersion.content,
- tags: currentVersion.tags,
- title: currentVersion.name || agent.name,
- };
- });
-
- try {
- // Create group with all members in one request
- const result = await chatGroupService.createGroupWithMembers(
- groupConfig,
- members,
- supervisorConfig,
- );
-
- // Refresh group list
- await loadGroups();
-
- // Report installation to marketplace
- if (identifier) {
- discoverService.reportAgentInstall(identifier);
- discoverService.reportAgentEvent({
- event: 'add',
- identifier,
- source: location.pathname,
- });
- }
-
- message.success(
- t('groupAgents.addSuccess', { defaultValue: 'Group agent added successfully!' }),
- );
-
- if (shouldNavigate) {
- navigate(urlJoin('/group', result.groupId));
- }
-
- return result;
- } catch (error) {
- console.error('Failed to create group from market:', error);
- message.error(
- t('groupAgents.addError', {
- defaultValue: 'Failed to add group agent. Please try again.',
- }),
- );
- throw error;
- }
- };
-
- const handleAddAndConverse = async () => {
- if (!canCreate) return;
- setIsLoading(true);
- try {
- const isDuplicate = await checkDuplicateGroup();
- if (isDuplicate) {
- showDuplicateConfirmation(() => createGroupFromMarket(true));
- } else {
- await createGroupFromMarket(true);
- }
- } finally {
- setIsLoading(false);
- }
- };
-
- const handleAdd = async () => {
- if (!canCreate) return;
- setIsLoading(true);
- try {
- const isDuplicate = await checkDuplicateGroup();
- if (isDuplicate) {
- showDuplicateConfirmation(() => createGroupFromMarket(false));
- } else {
- await createGroupFromMarket(false);
- }
- } finally {
- setIsLoading(false);
- }
- };
-
- const menuItems = [
- {
- disabled: !canCreate,
- key: 'addGroup',
- label: t('groupAgents.addGroup', { defaultValue: 'Add Group' }),
- onClick: handleAdd,
- },
- ];
-
- return (
- <Flexbox horizontal className={styles.buttonGroup} gap={0}>
- <Button
- block
- className={styles.primaryButton}
- disabled={!canCreate}
- loading={isLoading}
- size={'large'}
- style={{ flex: 1, width: 'unset' }}
- type={'primary'}
- onClick={handleAddAndConverse}
- >
- {t('groupAgents.addAndConverse', { defaultValue: 'Add & Start Conversation' })}
- </Button>
- <DropdownMenu
- items={menuItems}
- popupProps={{ style: { minWidth: 267 } }}
- triggerProps={{ disabled: isLoading || !canCreate }}
- >
- <Button
- className={styles.menuButton}
- disabled={isLoading || !canCreate}
- icon={<Icon icon={ChevronDownIcon} />}
- size={'large'}
- type={'primary'}
- />
- </DropdownMenu>
- </Flexbox>
- );
-});
-
-export default AddGroupAgent;
diff --git a/src/routes/(main)/community/(detail)/user/features/UserFavoriteAgents.tsx b/src/routes/(main)/community/(detail)/user/features/UserFavoriteAgents.tsx
deleted file mode 100644
index 7894a4c5fa8..00000000000
--- a/src/routes/(main)/community/(detail)/user/features/UserFavoriteAgents.tsx
+++ /dev/null
@@ -1,309 +0,0 @@
-'use client';
-
-import {
- Avatar,
- Block,
- Flexbox,
- Grid,
- Icon,
- stopPropagation,
- Tag,
- Text,
- Tooltip,
-} from '@lobehub/ui';
-import { App } from 'antd';
-import { createStaticStyles, cx } from 'antd-style';
-import { ClockIcon, DownloadIcon, Heart } from 'lucide-react';
-import qs from 'query-string';
-import { memo, useCallback } from 'react';
-import { useTranslation } from 'react-i18next';
-import urlJoin from 'url-join';
-
-import PublishedTime from '@/components/PublishedTime';
-import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';
-import WorkspaceLink from '@/features/Workspace/WorkspaceLink';
-import { useMarketAuth } from '@/layout/AuthProvider/MarketAuth';
-import { type FavoriteAgentItem } from '@/services/social';
-import { socialService } from '@/services/social';
-import { useDiscoverStore } from '@/store/discover';
-import { formatIntergerNumber } from '@/utils/format';
-
-import { useUserDetailContext } from './DetailProvider';
-
-const styles = createStaticStyles(({ css, cssVar }) => {
- return {
- desc: css`
- flex: 1;
- margin: 0 !important;
- color: ${cssVar.colorTextSecondary};
- `,
- favoriteButton: css`
- cursor: pointer;
-
- position: absolute;
- inset-block-start: 12px;
- inset-inline-end: 12px;
-
- color: ${cssVar.colorError};
-
- opacity: 0;
-
- transition: opacity 0.2s;
- `,
- footer: css`
- margin-block-start: 16px;
- border-block-start: 1px dashed ${cssVar.colorBorder};
- background: ${cssVar.colorBgContainer};
- `,
- secondaryDesc: css`
- font-size: 12px;
- color: ${cssVar.colorTextDescription};
- `,
- statTag: css`
- border-radius: 4px;
-
- font-family: ${cssVar.fontFamilyCode};
- font-size: 11px;
- color: ${cssVar.colorTextSecondary};
-
- background: ${cssVar.colorFillTertiary};
- `,
- title: css`
- margin: 0 !important;
- font-size: 16px !important;
- font-weight: 500 !important;
-
- &:hover {
- color: ${cssVar.colorLink};
- }
- `,
- wrapper: css`
- &:hover .favorite-button {
- opacity: 1;
- }
- `,
- };
-});
-
-interface FavoriteAgentCardProps extends FavoriteAgentItem {
- onUnfavorite: (identifier: string) => void;
- showUnfavorite: boolean;
-}
-
-const FavoriteAgentCard = memo<FavoriteAgentCardProps>(
- ({
- avatar,
- name,
- description,
- createdAt,
- category,
- identifier,
- installCount,
- onUnfavorite,
- showUnfavorite,
- }) => {
- const { t } = useTranslation('discover');
- const navigate = useWorkspaceAwareNavigate();
-
- const link = qs.stringifyUrl(
- {
- query: { source: 'new' },
- url: urlJoin('/community/agent', identifier),
- },
- { skipNull: true },
- );
-
- return (
- <Block
- clickable
- className={styles.wrapper}
- height={'100%'}
- variant={'outlined'}
- width={'100%'}
- style={{
- cursor: 'pointer',
- overflow: 'hidden',
- position: 'relative',
- }}
- onClick={() => navigate(link)}
- >
- {showUnfavorite && (
- <Tooltip title={t('user.unfavorite')}>
- <div
- className={cx('favorite-button', styles.favoriteButton)}
- onClick={(e) => {
- e.stopPropagation();
- onUnfavorite(identifier);
- }}
- >
- <Icon fill="currentColor" icon={Heart} size={16} />
- </div>
- </Tooltip>
- )}
- <Flexbox
- horizontal
- align={'flex-start'}
- gap={16}
- justify={'space-between'}
- padding={16}
- width={'100%'}
- >
- <Flexbox
- horizontal
- gap={12}
- style={{
- overflow: 'hidden',
- }}
- >
- <Avatar avatar={avatar} shape={'square'} size={40} style={{ flex: 'none' }} />
- <Flexbox
- flex={1}
- gap={2}
- style={{
- overflow: 'hidden',
- }}
- >
- <Flexbox horizontal align={'center'} gap={8}>
- <WorkspaceLink
- style={{ color: 'inherit', flex: 1, overflow: 'hidden' }}
- to={link}
- onClick={stopPropagation}
- >
- <Text ellipsis as={'h3'} className={styles.title} style={{ flex: 1 }}>
- {name}
- </Text>
- </WorkspaceLink>
- </Flexbox>
- </Flexbox>
- </Flexbox>
- </Flexbox>
- <Flexbox flex={1} gap={12} paddingInline={16}>
- <Text
- as={'p'}
- className={styles.desc}
- ellipsis={{
- rows: 3,
- }}
- >
- {description}
- </Text>
- <Flexbox horizontal align={'center'} gap={4}>
- {installCount !== undefined && (
- <Tooltip
- placement={'top'}
- styles={{ root: { pointerEvents: 'none' } }}
- title={t('assistants.downloads')}
- >
- <Tag className={styles.statTag} icon={<Icon icon={DownloadIcon} />}>
- {formatIntergerNumber(installCount)}
- </Tag>
- </Tooltip>
- )}
- </Flexbox>
- </Flexbox>
- <Flexbox
- horizontal
- align={'center'}
- className={styles.footer}
- justify={'space-between'}
- padding={16}
- >
- <Flexbox
- horizontal
- align={'center'}
- className={styles.secondaryDesc}
- justify={'space-between'}
- >
- <Flexbox horizontal align={'center'} gap={4}>
- <Icon icon={ClockIcon} size={14} />
- <PublishedTime className={styles.secondaryDesc} date={createdAt} />
- </Flexbox>
- {category && t(`category.assistant.${category}` as any)}
- </Flexbox>
- </Flexbox>
- </Block>
- );
- },
-);
-
-interface UserFavoriteAgentsProps {
- rows?: number;
-}
-
-const UserFavoriteAgents = memo<UserFavoriteAgentsProps>(({ rows = 4 }) => {
- const { t } = useTranslation('discover');
- const { message } = App.useApp();
- const { user, isOwner } = useUserDetailContext();
- const { session } = useMarketAuth();
-
- const useFavoriteAgents = useDiscoverStore((s) => s.useFavoriteAgents);
- const removeFavorite = useDiscoverStore((s) => s.removeFavorite);
-
- const { data, mutate } = useFavoriteAgents(user.id);
-
- // Set access token for social service
- if (session?.accessToken) {
- socialService.setAccessToken(session.accessToken);
- }
-
- const handleUnfavorite = useCallback(
- async (identifier: string) => {
- try {
- const agent = data?.items.find((a) => a.identifier === identifier);
- if (agent) {
- await removeFavorite('agent', (agent as any).id);
- await mutate();
- message.success(t('user.unfavoriteSuccess'));
- }
- } catch (error) {
- console.error('Unfavorite failed:', error);
- message.error(t('user.unfavoriteFailed'));
- }
- },
- [data, removeFavorite, mutate, message, t],
- );
-
- // SDK returns { data: [{ agent: {...}, favoritedAt: string }] } or flat array
- const rawData = data?.items ?? (data as any)?.data ?? [];
- const agents: FavoriteAgentItem[] = rawData.map((item: any) => {
- const agent = item.agent || item;
- return {
- avatar: agent.icon || agent.avatar || '',
- category: agent.category || '',
- createdAt: item.favoritedAt || agent.favoritedAt || agent.createdAt,
- description: agent.description || '',
- identifier: agent.identifier,
- installCount: agent.installCount,
- name: agent.name,
- tags: agent.tags || [],
- };
- });
-
- // Don't render if no favorite agents
- if (agents.length === 0) {
- return null;
- }
-
- return (
- <Flexbox gap={16}>
- <Flexbox horizontal align={'center'} gap={8}>
- <Text fontSize={16} weight={500}>
- {t('user.favoriteAgents')}
- </Text>
- <Tag>{agents.length}</Tag>
- </Flexbox>
- <Grid rows={rows} width={'100%'}>
- {agents.map((item) => (
- <FavoriteAgentCard
- key={item.identifier}
- {...item}
- showUnfavorite={isOwner}
- onUnfavorite={handleUnfavorite}
- />
- ))}
- </Grid>
- </Flexbox>
- );
-});
-
-export default UserFavoriteAgents;
diff --git a/src/routes/(main)/community/(detail)/user/features/UserFavoritePlugins.tsx b/src/routes/(main)/community/(detail)/user/features/UserFavoritePlugins.tsx
deleted file mode 100644
index c35f2760383..00000000000
--- a/src/routes/(main)/community/(detail)/user/features/UserFavoritePlugins.tsx
+++ /dev/null
@@ -1,283 +0,0 @@
-'use client';
-
-import {
- Avatar,
- Block,
- Flexbox,
- Grid,
- Icon,
- stopPropagation,
- Tag,
- Text,
- Tooltip,
-} from '@lobehub/ui';
-import { App } from 'antd';
-import { createStaticStyles, cx } from 'antd-style';
-import { ClockIcon, Heart } from 'lucide-react';
-import qs from 'query-string';
-import { memo, useCallback } from 'react';
-import { useTranslation } from 'react-i18next';
-import urlJoin from 'url-join';
-
-import PublishedTime from '@/components/PublishedTime';
-import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';
-import WorkspaceLink from '@/features/Workspace/WorkspaceLink';
-import { useMarketAuth } from '@/layout/AuthProvider/MarketAuth';
-import { type FavoritePluginItem } from '@/services/social';
-import { socialService } from '@/services/social';
-import { useDiscoverStore } from '@/store/discover';
-
-import { useUserDetailContext } from './DetailProvider';
-
-const styles = createStaticStyles(({ css, cssVar }) => {
- return {
- desc: css`
- flex: 1;
- margin: 0 !important;
- color: ${cssVar.colorTextSecondary};
- `,
- favoriteButton: css`
- cursor: pointer;
-
- position: absolute;
- inset-block-start: 12px;
- inset-inline-end: 12px;
-
- color: ${cssVar.colorError};
-
- opacity: 0;
-
- transition: opacity 0.2s;
- `,
- footer: css`
- margin-block-start: 16px;
- border-block-start: 1px dashed ${cssVar.colorBorder};
- background: ${cssVar.colorBgContainer};
- `,
- secondaryDesc: css`
- font-size: 12px;
- color: ${cssVar.colorTextDescription};
- `,
- title: css`
- margin: 0 !important;
- font-size: 16px !important;
- font-weight: 500 !important;
-
- &:hover {
- color: ${cssVar.colorLink};
- }
- `,
- wrapper: css`
- &:hover .favorite-button {
- opacity: 1;
- }
- `,
- };
-});
-
-interface FavoritePluginCardProps extends FavoritePluginItem {
- onUnfavorite: (identifier: string) => void;
- showUnfavorite: boolean;
-}
-
-const FavoritePluginCard = memo<FavoritePluginCardProps>(
- ({
- avatar,
- name,
- description,
- createdAt,
- category,
- identifier,
- onUnfavorite,
- showUnfavorite,
- }) => {
- const { t } = useTranslation('discover');
- const navigate = useWorkspaceAwareNavigate();
-
- const link = qs.stringifyUrl(
- {
- url: urlJoin('/community/plugin', identifier),
- },
- { skipNull: true },
- );
-
- return (
- <Block
- clickable
- className={styles.wrapper}
- height={'100%'}
- variant={'outlined'}
- width={'100%'}
- style={{
- cursor: 'pointer',
- overflow: 'hidden',
- position: 'relative',
- }}
- onClick={() => navigate(link)}
- >
- {showUnfavorite && (
- <Tooltip title={t('user.unfavorite')}>
- <div
- className={cx('favorite-button', styles.favoriteButton)}
- onClick={(e) => {
- e.stopPropagation();
- onUnfavorite(identifier);
- }}
- >
- <Icon fill="currentColor" icon={Heart} size={16} />
- </div>
- </Tooltip>
- )}
- <Flexbox
- horizontal
- align={'flex-start'}
- gap={16}
- justify={'space-between'}
- padding={16}
- width={'100%'}
- >
- <Flexbox
- horizontal
- gap={12}
- style={{
- overflow: 'hidden',
- }}
- >
- <Avatar avatar={avatar} shape={'square'} size={40} style={{ flex: 'none' }} />
- <Flexbox
- flex={1}
- gap={2}
- style={{
- overflow: 'hidden',
- }}
- >
- <Flexbox horizontal align={'center'} gap={8}>
- <WorkspaceLink
- style={{ color: 'inherit', flex: 1, overflow: 'hidden' }}
- to={link}
- onClick={stopPropagation}
- >
- <Text ellipsis as={'h3'} className={styles.title} style={{ flex: 1 }}>
- {name}
- </Text>
- </WorkspaceLink>
- </Flexbox>
- </Flexbox>
- </Flexbox>
- </Flexbox>
- <Flexbox flex={1} gap={12} paddingInline={16}>
- <Text
- as={'p'}
- className={styles.desc}
- ellipsis={{
- rows: 3,
- }}
- >
- {description}
- </Text>
- </Flexbox>
- <Flexbox
- horizontal
- align={'center'}
- className={styles.footer}
- justify={'space-between'}
- padding={16}
- >
- <Flexbox
- horizontal
- align={'center'}
- className={styles.secondaryDesc}
- justify={'space-between'}
- >
- <Flexbox horizontal align={'center'} gap={4}>
- <Icon icon={ClockIcon} size={14} />
- <PublishedTime className={styles.secondaryDesc} date={createdAt} />
- </Flexbox>
- {category && t(`category.plugin.${category}` as any)}
- </Flexbox>
- </Flexbox>
- </Block>
- );
- },
-);
-
-interface UserFavoritePluginsProps {
- rows?: number;
-}
-
-const UserFavoritePlugins = memo<UserFavoritePluginsProps>(({ rows = 4 }) => {
- const { t } = useTranslation('discover');
- const { message } = App.useApp();
- const { user, isOwner } = useUserDetailContext();
- const { session } = useMarketAuth();
-
- const useFavoritePlugins = useDiscoverStore((s) => s.useFavoritePlugins);
- const removeFavorite = useDiscoverStore((s) => s.removeFavorite);
-
- const { data, mutate } = useFavoritePlugins(user.id);
-
- // Set access token for social service
- if (session?.accessToken) {
- socialService.setAccessToken(session.accessToken);
- }
-
- const handleUnfavorite = useCallback(
- async (identifier: string) => {
- try {
- const plugin = data?.items.find((p) => p.identifier === identifier);
- if (plugin) {
- await removeFavorite('plugin', (plugin as any).id);
- await mutate();
- message.success(t('user.unfavoriteSuccess'));
- }
- } catch (error) {
- console.error('Unfavorite failed:', error);
- message.error(t('user.unfavoriteFailed'));
- }
- },
- [data, removeFavorite, mutate, message, t],
- );
-
- // SDK returns { data: [{ plugin: {...}, favoritedAt: string }] } or flat array
- const rawData = data?.items ?? (data as any)?.data ?? [];
- const plugins: FavoritePluginItem[] = rawData.map((item: any) => {
- const plugin = item.plugin || item;
- return {
- avatar: plugin.icon || plugin.avatar || '',
- category: plugin.category || '',
- createdAt: item.favoritedAt || plugin.favoritedAt || plugin.createdAt,
- description: plugin.description || '',
- identifier: plugin.identifier,
- name: plugin.name,
- tags: plugin.tags || [],
- };
- });
-
- // Don't render if no favorite plugins
- if (plugins.length === 0) {
- return null;
- }
-
- return (
- <Flexbox gap={16}>
- <Flexbox horizontal align={'center'} gap={8}>
- <Text fontSize={16} weight={500}>
- {t('user.favoritePlugins')}
- </Text>
- <Tag>{plugins.length}</Tag>
- </Flexbox>
- <Grid rows={rows} width={'100%'}>
- {plugins.map((item) => (
- <FavoritePluginCard
- key={item.identifier}
- {...item}
- showUnfavorite={isOwner}
- onUnfavorite={handleUnfavorite}
- />
- ))}
- </Grid>
- </Flexbox>
- );
-});
-
-export default UserFavoritePlugins;
diff --git a/src/routes/(main)/community/(detail)/user/features/UserForkedAgentGroups.tsx b/src/routes/(main)/community/(detail)/user/features/UserForkedAgentGroups.tsx
deleted file mode 100644
index 7bdc313aa3d..00000000000
--- a/src/routes/(main)/community/(detail)/user/features/UserForkedAgentGroups.tsx
+++ /dev/null
@@ -1,63 +0,0 @@
-'use client';
-
-import { Flexbox, Grid, Tag, Text } from '@lobehub/ui';
-import { Pagination } from 'antd';
-import { GitForkIcon } from 'lucide-react';
-import { memo, useMemo, useState } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import { type DiscoverGroupAgentItem } from '@/types/discover';
-
-import UserGroupCard from './UserGroupCard';
-
-interface UserForkedAgentGroupsProps {
- agentGroups?: DiscoverGroupAgentItem[];
- pageSize?: number;
- rows?: number;
-}
-
-const UserForkedAgentGroups = memo<UserForkedAgentGroupsProps>(
- ({ agentGroups = [], rows = 4, pageSize = 10 }) => {
- const { t } = useTranslation('discover');
- const [currentPage, setCurrentPage] = useState(1);
-
- const paginatedGroups = useMemo(() => {
- const startIndex = (currentPage - 1) * pageSize;
- return agentGroups.slice(startIndex, startIndex + pageSize);
- }, [agentGroups, currentPage, pageSize]);
-
- if (agentGroups.length === 0) return null;
-
- const showPagination = agentGroups.length > pageSize;
-
- return (
- <Flexbox gap={16}>
- <Flexbox horizontal align={'center'} gap={8}>
- <GitForkIcon size={16} />
- <Text fontSize={16} weight={500}>
- {t('user.forkedAgentGroups')}
- </Text>
- <Tag>{agentGroups.length}</Tag>
- </Flexbox>
- <Grid rows={rows} width={'100%'}>
- {paginatedGroups.map((group, index) => (
- <UserGroupCard key={group.identifier || index} {...group} />
- ))}
- </Grid>
- {showPagination && (
- <Flexbox align={'center'} justify={'center'}>
- <Pagination
- current={currentPage}
- pageSize={pageSize}
- showSizeChanger={false}
- total={agentGroups.length}
- onChange={(page) => setCurrentPage(page)}
- />
- </Flexbox>
- )}
- </Flexbox>
- );
- },
-);
-
-export default UserForkedAgentGroups;
diff --git a/src/routes/(main)/community/(detail)/user/features/UserForkedAgents.tsx b/src/routes/(main)/community/(detail)/user/features/UserForkedAgents.tsx
deleted file mode 100644
index 348aa43d767..00000000000
--- a/src/routes/(main)/community/(detail)/user/features/UserForkedAgents.tsx
+++ /dev/null
@@ -1,61 +0,0 @@
-'use client';
-
-import { Flexbox, Grid, Tag, Text } from '@lobehub/ui';
-import { Pagination } from 'antd';
-import { GitForkIcon } from 'lucide-react';
-import { memo, useMemo, useState } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import { type DiscoverAssistantItem } from '@/types/discover';
-
-import UserAgentCard from './UserAgentCard';
-
-interface UserForkedAgentsProps {
- agents?: DiscoverAssistantItem[];
- pageSize?: number;
- rows?: number;
-}
-
-const UserForkedAgents = memo<UserForkedAgentsProps>(({ agents = [], rows = 4, pageSize = 10 }) => {
- const { t } = useTranslation('discover');
- const [currentPage, setCurrentPage] = useState(1);
-
- const paginatedAgents = useMemo(() => {
- const startIndex = (currentPage - 1) * pageSize;
- return agents.slice(startIndex, startIndex + pageSize);
- }, [agents, currentPage, pageSize]);
-
- if (agents.length === 0) return null;
-
- const showPagination = agents.length > pageSize;
-
- return (
- <Flexbox gap={16}>
- <Flexbox horizontal align={'center'} gap={8}>
- <GitForkIcon size={16} />
- <Text fontSize={16} weight={500}>
- {t('user.forkedAgents')}
- </Text>
- <Tag>{agents.length}</Tag>
- </Flexbox>
- <Grid rows={rows} width={'100%'}>
- {paginatedAgents.map((agent, index) => (
- <UserAgentCard key={agent.identifier || index} {...agent} />
- ))}
- </Grid>
- {showPagination && (
- <Flexbox align={'center'} justify={'center'}>
- <Pagination
- current={currentPage}
- pageSize={pageSize}
- showSizeChanger={false}
- total={agents.length}
- onChange={(page) => setCurrentPage(page)}
- />
- </Flexbox>
- )}
- </Flexbox>
- );
-});
-
-export default UserForkedAgents;
diff --git a/src/routes/(main)/community/(list)/(home)/loading.tsx b/src/routes/(main)/community/(list)/(home)/loading.tsx
deleted file mode 100644
index 080e88017e4..00000000000
--- a/src/routes/(main)/community/(list)/(home)/loading.tsx
+++ /dev/null
@@ -1,28 +0,0 @@
-import { memo } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import ListLoading from '@/routes/(main)/community/components/ListLoading';
-import Title from '@/routes/(main)/community/components/Title';
-
-import CreatorRewardBanner from './features/CreatorRewardBanner';
-
-const Loading = memo(() => {
- const { t } = useTranslation('discover');
-
- return (
- <>
- <CreatorRewardBanner />
- <Title more={t('home.more')} moreLink={'/community/agent'}>
- {t('home.featuredAssistants')}
- </Title>
- <ListLoading length={8} rows={4} />
- <div />
- <Title more={t('home.more')} moreLink={'/community/mcp'}>
- {t('home.featuredTools')}
- </Title>
- <ListLoading length={8} rows={4} />
- </>
- );
-});
-
-export default Loading;
diff --git a/src/routes/(main)/community/(list)/agent/Client.tsx b/src/routes/(main)/community/(list)/agent/Client.tsx
deleted file mode 100644
index 555b96056c5..00000000000
--- a/src/routes/(main)/community/(list)/agent/Client.tsx
+++ /dev/null
@@ -1,48 +0,0 @@
-'use client';
-
-import { Flexbox } from '@lobehub/ui';
-import { memo } from 'react';
-
-import { withSuspense } from '@/components/withSuspense';
-import { useQuery } from '@/hooks/useQuery';
-import { useDiscoverStore } from '@/store/discover';
-import { type AssistantMarketSource, type AssistantQueryParams } from '@/types/discover';
-import { DiscoverTab } from '@/types/discover';
-
-import Pagination from '../features/Pagination';
-import List from './features/List';
-import Loading from './loading';
-
-const Client = memo<{ mobile?: boolean }>(() => {
- const { q, page, category, sort, order, ownerId, source } = useQuery() as AssistantQueryParams;
- const marketSource = (source as AssistantMarketSource | undefined) ?? 'new';
- const useAssistantList = useDiscoverStore((s) => s.useAssistantList);
- const { data, isLoading } = useAssistantList({
- category,
- order,
- ownerId,
- page,
- pageSize: 21,
- q,
- sort,
- source: marketSource,
- });
-
- if (isLoading || !data) return <Loading />;
-
- const { items, currentPage, pageSize, totalCount } = data;
-
- return (
- <Flexbox gap={32} width={'100%'}>
- <List data={items} />
- <Pagination
- currentPage={currentPage}
- pageSize={pageSize}
- tab={DiscoverTab.Assistants}
- total={totalCount}
- />
- </Flexbox>
- );
-});
-
-export default withSuspense(Client);
diff --git a/src/routes/(main)/community/(list)/agent/features/MarketSourceSwitch.tsx b/src/routes/(main)/community/(list)/agent/features/MarketSourceSwitch.tsx
deleted file mode 100644
index f7f01d17183..00000000000
--- a/src/routes/(main)/community/(list)/agent/features/MarketSourceSwitch.tsx
+++ /dev/null
@@ -1,78 +0,0 @@
-'use client';
-
-import { type DropdownItem, type DropdownMenuCheckboxItem } from '@lobehub/ui';
-import { DropdownMenu, Icon } from '@lobehub/ui';
-import { Button } from '@lobehub/ui/base-ui';
-import { ChevronDown, Store } from 'lucide-react';
-import { memo, useMemo } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import { useQuery } from '@/hooks/useQuery';
-import { useQueryRoute } from '@/hooks/useQueryRoute';
-import { type AssistantMarketSource } from '@/types/discover';
-
-const MarketSourceSwitch = memo(() => {
- const { t } = useTranslation('discover');
- const router = useQueryRoute();
- const query = useQuery() as { source?: AssistantMarketSource };
- const currentSource = (query.source as AssistantMarketSource) ?? 'new';
-
- type MarketSourceItem = Extract<DropdownItem, { type?: 'item' }> & {
- key: AssistantMarketSource;
- label: string;
- };
-
- const items = useMemo<MarketSourceItem[]>(
- () => [
- {
- key: 'new',
- label: t('assistants.marketSource.new'),
- },
- {
- key: 'legacy',
- label: t('assistants.marketSource.legacy'),
- },
- ],
- [t],
- );
-
- const handleChange = (value: AssistantMarketSource) => {
- router.push('/community/agent', {
- query: {
- page: null,
- source: value === 'new' ? null : value,
- },
- });
- };
-
- const menuItems = useMemo<DropdownMenuCheckboxItem[]>(
- () =>
- items.map((item): DropdownMenuCheckboxItem => ({
- checked: item.key === currentSource,
- closeOnClick: true,
- key: item.key,
- label: item.label,
- onCheckedChange: (checked: boolean) => {
- if (checked) {
- handleChange(item.key);
- }
- },
- type: 'checkbox',
- })),
- [currentSource, handleChange, items],
- );
-
- return (
- <DropdownMenu items={menuItems} trigger="both">
- <Button icon={<Icon icon={Store} />} type={'text'}>
- {t('assistants.marketSource.label')}:{' '}
- {items.find((item) => item.key === currentSource)?.label}
- <Icon icon={ChevronDown} />
- </Button>
- </DropdownMenu>
- );
-});
-
-MarketSourceSwitch.displayName = 'MarketSourceSwitch';
-
-export default MarketSourceSwitch;
diff --git a/src/routes/(main)/community/_layout/Header.tsx b/src/routes/(main)/community/_layout/Header.tsx
deleted file mode 100644
index 06f28262df6..00000000000
--- a/src/routes/(main)/community/_layout/Header.tsx
+++ /dev/null
@@ -1,44 +0,0 @@
-import { Flexbox } from '@lobehub/ui';
-import { cssVar, useTheme } from 'antd-style';
-import { memo, useMemo } from 'react';
-
-import { isCustomBranding } from '@/const/version';
-import NavHeader from '@/features/NavHeader';
-
-import CreateButton from '../features/CreateButton';
-import StoreSearchBar from '../features/Search';
-import UserAvatar from '../features/UserAvatar';
-import { styles } from './Header/style';
-
-const Header = memo(() => {
- const theme = useTheme(); // Keep for colorBgContainerSecondary (not in cssVar)
- const cssVariables = useMemo<Record<string, string>>(
- () => ({
- '--header-bg': theme.colorBgContainerSecondary,
- '--header-border-color': cssVar.colorBorderSecondary,
- }),
- [theme.colorBgContainerSecondary],
- );
-
- return (
- <NavHeader
- className={styles.headerContainer}
- style={cssVariables}
- right={
- <Flexbox horizontal align="center" gap={8}>
- {!isCustomBranding && <CreateButton />}
- <UserAvatar />
- </Flexbox>
- }
- styles={{
- center: { flex: 1, maxWidth: 720 },
- left: { flex: 1, maxWidth: 120 },
- right: { flex: 1, maxWidth: 160 },
- }}
- >
- <StoreSearchBar />
- </NavHeader>
- );
-});
-
-export default Header;
diff --git a/src/routes/(main)/community/components/GitHubAvatar.tsx b/src/routes/(main)/community/components/GitHubAvatar.tsx
deleted file mode 100644
index 0e117850c50..00000000000
--- a/src/routes/(main)/community/components/GitHubAvatar.tsx
+++ /dev/null
@@ -1,20 +0,0 @@
-import { type AvatarProps } from '@lobehub/ui';
-import { Avatar } from '@lobehub/ui';
-import qs from 'query-string';
-import { memo } from 'react';
-import urlJoin from 'url-join';
-
-interface GitHubAvatarProps extends Omit<AvatarProps, 'avatar'> {
- username: string;
-}
-
-const GitHubAvatar = memo<GitHubAvatarProps>(({ username, size = 24 }) => {
- const url = qs.stringifyUrl({
- query: { size: size * 2 },
- url: urlJoin('https://github.com', `${username}.png`),
- });
-
- return <Avatar alt={username} avatar={url} shape={'square'} size={size} />;
-});
-
-export default GitHubAvatar;
diff --git a/src/routes/(main)/community/components/GridLoadingCard.tsx b/src/routes/(main)/community/components/GridLoadingCard.tsx
deleted file mode 100644
index 321b6552b94..00000000000
--- a/src/routes/(main)/community/components/GridLoadingCard.tsx
+++ /dev/null
@@ -1,103 +0,0 @@
-'use client';
-
-import { Block, Flexbox, Grid, Skeleton } from '@lobehub/ui';
-import { createStaticStyles } from 'antd-style';
-import { memo } from 'react';
-
-const styles = createStaticStyles(({ css, cssVar }) => ({
- footer: css`
- border-block-start: 1px dashed ${cssVar.colorBorder};
- background: ${cssVar.colorBgContainer};
- `,
-}));
-
-const Card = memo<{ banner?: boolean }>(({ banner }) => {
- return (
- <Block height={'100%'} style={{ overflow: 'hidden' }} variant={'outlined'} width={'100%'}>
- {banner && <Skeleton.Block active height={64} width={'100%'} />}
- {/* Header with avatar and title */}
- <Flexbox horizontal gap={16} padding={16}>
- <Flexbox horizontal gap={12} style={{ flex: 1, overflow: 'hidden' }}>
- <Skeleton.Avatar active shape="square" size={40} style={{ flex: 'none' }} />
- <Flexbox flex={1} gap={4} style={{ overflow: 'hidden' }}>
- <Skeleton.Button
- active
- size={'small'}
- style={{
- height: 20,
- width: '80%',
- }}
- />
- <Skeleton.Button
- active
- size={'small'}
- style={{
- height: 14,
- width: '50%',
- }}
- />
- </Flexbox>
- </Flexbox>
- <Skeleton.Button
- active
- size={'small'}
- style={{
- height: 24,
- width: 24,
- }}
- />
- </Flexbox>
-
- {/* Description */}
- <Flexbox gap={12} paddingInline={16}>
- <Skeleton.Paragraph active fontSize={14} rows={3} style={{ marginBottom: 0 }} />
- <Flexbox horizontal gap={8}>
- <Skeleton.Button
- active
- size={'small'}
- style={{
- height: 20,
- width: 60,
- }}
- />
- <Skeleton.Button
- active
- size={'small'}
- style={{
- height: 20,
- width: 50,
- }}
- />
- </Flexbox>
- </Flexbox>
-
- {/* Footer */}
- <Flexbox horizontal className={styles.footer} gap={4} padding={16} style={{ marginTop: 12 }}>
- <Skeleton.Button
- active
- size={'small'}
- style={{
- height: 14,
- width: 100,
- }}
- />
- </Flexbox>
- </Block>
- );
-});
-
-interface GridLoadingCardProps {
- banner?: boolean;
- count?: number;
- rows?: number;
-}
-
-const GridLoadingCard = memo<GridLoadingCardProps>(({ count = 8, rows = 4, banner }) => (
- <Grid maxItemWidth={280} rows={rows}>
- {Array.from({ length: count }).map((_, index) => (
- <Card banner={banner} key={index} />
- ))}
- </Grid>
-));
-
-export default GridLoadingCard;
diff --git a/src/routes/(main)/community/components/Loading.tsx b/src/routes/(main)/community/components/Loading.tsx
deleted file mode 100644
index 6a0031c753b..00000000000
--- a/src/routes/(main)/community/components/Loading.tsx
+++ /dev/null
@@ -1,17 +0,0 @@
-'use client';
-
-import { Skeleton } from '@lobehub/ui';
-import { memo } from 'react';
-
-import Title from './Title';
-
-const Loading = memo<{ title: string }>(({ title }) => {
- return (
- <>
- <Title>{title}</Title>
- <Skeleton active paragraph={{ rows: 8 }} title={false} />
- </>
- );
-});
-
-export default Loading;
diff --git a/src/routes/(main)/community/components/SearchResultCount.tsx b/src/routes/(main)/community/components/SearchResultCount.tsx
deleted file mode 100644
index 929f8a72095..00000000000
--- a/src/routes/(main)/community/components/SearchResultCount.tsx
+++ /dev/null
@@ -1,36 +0,0 @@
-'use client';
-
-import { createStaticStyles } from 'antd-style';
-import { memo } from 'react';
-import { Trans } from 'react-i18next';
-
-import Title from './Title';
-
-const styles = createStaticStyles(({ css, cssVar }) => ({
- highlight: css`
- color: ${cssVar.colorInfo};
-
- &::before,
- &::after {
- content: '\`';
- }
- `,
-}));
-
-const SearchResultCount = memo<{ count: number; keyword: string }>(({ keyword, count }) => {
- return (
- <Title>
- <Trans
- components={{ highlight: <span className={styles.highlight} /> }}
- i18nKey={'search.result'}
- ns={'discover'}
- values={{
- count,
- keyword,
- }}
- />
- </Title>
- );
-});
-
-export default SearchResultCount;
diff --git a/src/routes/(main)/community/components/VirtuosoGridList/index.tsx b/src/routes/(main)/community/components/VirtuosoGridList/index.tsx
deleted file mode 100644
index 86ce7cc012e..00000000000
--- a/src/routes/(main)/community/components/VirtuosoGridList/index.tsx
+++ /dev/null
@@ -1,60 +0,0 @@
-import { type DivProps } from '@lobehub/ui';
-import { Flexbox, Grid } from '@lobehub/ui';
-import { memo } from 'react';
-import { type VirtuosoGridProps } from 'react-virtuoso';
-import { VirtuosoGrid } from 'react-virtuoso';
-
-import { useScrollParent } from './useScrollParent';
-
-export const VirtuosoList = memo<VirtuosoGridProps<any, any>>(({ data, ...rest }) => {
- const scrollParent = useScrollParent();
- const initialItemCount = data && data?.length >= 8 ? 8 : data?.length;
- return (
- <VirtuosoGrid
- customScrollParent={scrollParent}
- data={data}
- increaseViewportBy={typeof window !== 'undefined' ? window.innerHeight : 0}
- initialItemCount={initialItemCount}
- overscan={24}
- components={{
- // eslint-disable-next-line @eslint-react/no-nested-component-definitions
- List: (({ ref, ...props }: DivProps & { ref?: React.RefObject<HTMLDivElement | null> }) => (
- <Flexbox gap={16} ref={ref} {...props} />
- )) as any,
- }}
- {...rest}
- />
- );
-});
-
-const VirtuosoGridList = memo<VirtuosoGridProps<any, any>>(
- ({ data, initialItemCount, rows = 4, ...rest }) => {
- const scrollParent = useScrollParent();
- const count = data && data?.length >= 8 ? 8 : data?.length;
- const maxInitialItemCount =
- data && data?.length && initialItemCount && initialItemCount > data?.length
- ? data?.length
- : initialItemCount;
- return (
- <VirtuosoGrid
- customScrollParent={scrollParent}
- data={data}
- increaseViewportBy={typeof window !== 'undefined' ? window.innerHeight : 0}
- initialItemCount={maxInitialItemCount || count}
- overscan={24}
- components={{
- // eslint-disable-next-line @eslint-react/no-nested-component-definitions
- List: (({
- ref,
- ...props
- }: DivProps & { ref?: React.RefObject<HTMLDivElement | null> }) => (
- <Grid gap={16} maxItemWidth={280} ref={ref} rows={rows} {...props} />
- )) as any,
- }}
- {...rest}
- />
- );
- },
-);
-
-export default VirtuosoGridList;
diff --git a/src/routes/(main)/community/features/LikeButton.tsx b/src/routes/(main)/community/features/LikeButton.tsx
deleted file mode 100644
index ff93842f236..00000000000
--- a/src/routes/(main)/community/features/LikeButton.tsx
+++ /dev/null
@@ -1,74 +0,0 @@
-import { Flexbox, Icon, Tooltip, TooltipGroup } from '@lobehub/ui';
-import { Button } from '@lobehub/ui/base-ui';
-import { ThumbsDownIcon, ThumbsUpIcon } from 'lucide-react';
-import { memo } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import { formatShortenNumber } from '@/utils/format';
-
-import { styles } from '../components/Statistic';
-
-interface LikeButtonProps {
- count: number;
- isDisliked?: boolean;
- isLiked?: boolean;
- onDislikeClick?: (active: boolean) => void;
- onLikeClick?: (active: boolean) => void;
- showDislike?: boolean;
-}
-
-const LikeButton = memo<LikeButtonProps>(
- ({ count, onLikeClick, onDislikeClick, isLiked, showDislike, isDisliked }) => {
- const { t } = useTranslation('discover');
-
- if (showDislike)
- return (
- <TooltipGroup>
- <Flexbox horizontal flex={1.75} gap={4}>
- <Tooltip title={t('like')}>
- <Button
- block
- className={styles.number}
- icon={ThumbsUpIcon}
- size={'large'}
- style={{ flex: 1 }}
- type={isLiked ? 'primary' : undefined}
- onClick={() => onLikeClick?.(!isLiked)}
- >
- {formatShortenNumber(count)}
- </Button>
- </Tooltip>
- <Tooltip title={t('dislike')}>
- <Button
- className={styles.number}
- icon={<Icon icon={ThumbsDownIcon} />}
- size={'large'}
- style={{ flex: 'none' }}
- type={isDisliked ? 'primary' : 'default'}
- onClick={() => onDislikeClick?.(!isDisliked)}
- />
- </Tooltip>
- </Flexbox>
- </TooltipGroup>
- );
-
- return (
- <Flexbox align={'center'} flex={1} justify={'center'} style={{ position: 'relative' }}>
- <Tooltip title={t('like')}>
- <Button
- className={styles.number}
- icon={<Icon icon={ThumbsUpIcon} />}
- size={'large'}
- style={{ width: '100%' }}
- type={isLiked ? 'primary' : 'default'}
- onClick={() => onLikeClick?.(!isLiked)}
- >
- {formatShortenNumber(count)}
- </Button>
- </Tooltip>
- </Flexbox>
- );
- },
-);
-
-export default LikeButton;
diff --git a/src/routes/(main)/components/Link.tsx b/src/routes/(main)/components/Link.tsx
deleted file mode 100644
index c13eae61562..00000000000
--- a/src/routes/(main)/components/Link.tsx
+++ /dev/null
@@ -1,22 +0,0 @@
-import React, { memo } from 'react';
-import { type LinkProps as ReactRouterLinkProps } from 'react-router';
-import { Link as ReactRouterLink } from 'react-router';
-
-interface LinkProps extends Omit<ReactRouterLinkProps, 'to'> {
- children?: React.ReactNode;
- href?: string;
- to?: string;
-}
-
-/**
- * Link component for React Router
- * Provides a Next.js-like API (href prop) while using React Router internally
- */
-const Link = memo<LinkProps>(({ href, to, ...props }) => {
- const linkTo = href || to || '/';
- return <ReactRouterLink {...props} to={linkTo} />;
-});
-
-Link.displayName = 'Link';
-
-export default Link;
diff --git a/src/routes/(main)/eval/bench/[benchmarkId]/features/DatasetTabs/index.tsx b/src/routes/(main)/eval/bench/[benchmarkId]/features/DatasetTabs/index.tsx
deleted file mode 100644
index b68b4b1e8f6..00000000000
--- a/src/routes/(main)/eval/bench/[benchmarkId]/features/DatasetTabs/index.tsx
+++ /dev/null
@@ -1,31 +0,0 @@
-'use client';
-
-import { Empty } from '@lobehub/ui';
-import { Tabs } from '@lobehub/ui/base-ui';
-import { Database } from 'lucide-react';
-import { memo } from 'react';
-import { useTranslation } from 'react-i18next';
-
-interface DatasetTabsProps {
- activeDatasetId?: string;
- datasets: any[];
- onChange: (datasetId: string) => void;
-}
-
-const DatasetTabs = memo<DatasetTabsProps>(({ datasets, activeDatasetId, onChange }) => {
- const { t } = useTranslation('eval');
-
- if (datasets.length === 0) {
- return <Empty description={t('dataset.empty')} icon={Database} />;
- }
-
- return (
- <Tabs
- activeKey={activeDatasetId || datasets[0]?.id}
- items={datasets.map((d: any) => ({ key: d.id, label: d.name }))}
- onChange={onChange}
- />
- );
-});
-
-export default DatasetTabs;
diff --git a/src/routes/(main)/eval/bench/[benchmarkId]/features/RunCards/index.tsx b/src/routes/(main)/eval/bench/[benchmarkId]/features/RunCards/index.tsx
deleted file mode 100644
index 5f13432f973..00000000000
--- a/src/routes/(main)/eval/bench/[benchmarkId]/features/RunCards/index.tsx
+++ /dev/null
@@ -1,98 +0,0 @@
-'use client';
-
-import { ActionIcon, Flexbox, Icon, Text } from '@lobehub/ui';
-import { Button } from '@lobehub/ui/base-ui';
-import { createStaticStyles, cssVar } from 'antd-style';
-import { Play, Plus } from 'lucide-react';
-import { memo } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import { runSelectors, useEvalStore } from '@/store/eval';
-
-import RunSummaryCard from './RunSummaryCard';
-
-const styles = createStaticStyles(({ css }) => ({
- emptyCard: css`
- align-items: center;
- justify-content: center;
-
- padding-block: 32px;
- padding-inline: 20px;
- border: 1px dashed ${cssVar.colorBorderSecondary};
- border-radius: ${cssVar.borderRadius};
-
- text-align: center;
-
- background: ${cssVar.colorFillQuaternary};
- `,
- iconBox: css`
- display: flex;
- flex-shrink: 0;
- align-items: center;
- justify-content: center;
-
- width: 40px;
- height: 40px;
- border-radius: ${cssVar.borderRadius};
-
- background: ${cssVar.colorFillTertiary};
- `,
-}));
-
-interface RunCardsProps {
- benchmarkId: string;
- datasetId?: string;
- onCreateRun: () => void;
-}
-
-const RunCards = memo<RunCardsProps>(({ datasetId, onCreateRun, benchmarkId }) => {
- const { t } = useTranslation('eval');
- const useFetchDatasetRuns = useEvalStore((s) => s.useFetchDatasetRuns);
- const runList = useEvalStore(runSelectors.datasetRunList(datasetId!));
- useFetchDatasetRuns(datasetId);
-
- return (
- <Flexbox gap={12}>
- <Flexbox horizontal align="center" justify="space-between">
- <Text weight={600}>{t('benchmark.detail.tabs.runs')}</Text>
- <ActionIcon
- icon={Plus}
- size="small"
- title={t('run.actions.create')}
- onClick={onCreateRun}
- />
- </Flexbox>
- {runList.length === 0 ? (
- <Flexbox className={styles.emptyCard} gap={12}>
- <div className={styles.iconBox}>
- <Icon icon={Play} size={20} style={{ color: cssVar.colorTextQuaternary }} />
- </div>
- <Flexbox align="center" gap={2}>
- <Text color={cssVar.colorTextTertiary}>{t('run.empty.title')}</Text>
- <Text color={cssVar.colorTextQuaternary} fontSize={12}>
- {t('run.empty.description')}
- </Text>
- </Flexbox>
- <Button icon={<Plus size={14} />} size="small" type="primary" onClick={onCreateRun}>
- {t('run.actions.create')}
- </Button>
- </Flexbox>
- ) : (
- <Flexbox gap={8}>
- {runList.map((run) => (
- <RunSummaryCard
- benchmarkId={benchmarkId}
- id={run.id}
- key={run.id}
- metrics={run.metrics ?? undefined}
- name={run.name ?? undefined}
- status={run.status}
- />
- ))}
- </Flexbox>
- )}
- </Flexbox>
- );
-});
-
-export default RunCards;
diff --git a/src/routes/(main)/eval/bench/[benchmarkId]/features/TestCaseList/index.tsx b/src/routes/(main)/eval/bench/[benchmarkId]/features/TestCaseList/index.tsx
deleted file mode 100644
index 3ad3617067b..00000000000
--- a/src/routes/(main)/eval/bench/[benchmarkId]/features/TestCaseList/index.tsx
+++ /dev/null
@@ -1,88 +0,0 @@
-'use client';
-
-import { Flexbox, Text } from '@lobehub/ui';
-import { Badge, Table } from 'antd';
-import type { ColumnsType } from 'antd/es/table';
-import { cssVar } from 'antd-style';
-import { memo, useState } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import { useEvalStore } from '@/store/eval';
-
-const DIFFICULTY_COLORS: Record<string, { bg: string; color: string }> = {
- easy: { bg: cssVar.colorSuccessBg, color: cssVar.colorSuccess },
- hard: { bg: cssVar.colorErrorBg, color: cssVar.colorError },
- medium: { bg: cssVar.colorWarningBg, color: cssVar.colorWarning },
-};
-
-interface TestCaseListProps {
- datasetId: string;
-}
-
-const TestCaseList = memo<TestCaseListProps>(({ datasetId }) => {
- const { t } = useTranslation('eval');
- const [pagination, setPagination] = useState({ current: 1, pageSize: 20 });
-
- const useFetchTestCases = useEvalStore((s) => s.useFetchTestCases);
-
- const { data: testCaseData, isLoading: loading } = useFetchTestCases({
- datasetId,
- limit: pagination.pageSize,
- offset: (pagination.current - 1) * pagination.pageSize,
- });
-
- const data = testCaseData?.data || [];
- const total = testCaseData?.total || 0;
-
- const columns: ColumnsType<any> = [
- {
- dataIndex: ['content', 'input'],
- ellipsis: true,
- key: 'input',
- render: (text: string) => (
- <Text ellipsis style={{ maxWidth: 400 }}>
- {text}
- </Text>
- ),
- title: t('table.columns.input'),
- width: 400,
- },
- {
- dataIndex: ['metadata', 'difficulty'],
- key: 'difficulty',
- render: (difficulty: string) => {
- if (!difficulty) return '-';
- const c = DIFFICULTY_COLORS[difficulty] || DIFFICULTY_COLORS.easy;
- return (
- <Badge
- style={{ backgroundColor: c.bg, borderColor: c.color + '30', color: c.color }}
- >
- {t(`difficulty.${difficulty}` as any)}
- </Badge>
- );
- },
- title: t('table.columns.difficulty'),
- width: 100,
- },
- ];
-
- return (
- <Flexbox gap={12}>
- <Table
- columns={columns}
- dataSource={data}
- loading={loading}
- rowKey="id"
- size="small"
- pagination={{
- current: pagination.current,
- onChange: (page, pageSize) => setPagination({ current: page, pageSize }),
- pageSize: pagination.pageSize,
- total,
- }}
- />
- </Flexbox>
- );
-});
-
-export default TestCaseList;
diff --git a/src/routes/(main)/eval/bench/[benchmarkId]/features/TestCasesTab/index.tsx b/src/routes/(main)/eval/bench/[benchmarkId]/features/TestCasesTab/index.tsx
deleted file mode 100644
index 78c305870e4..00000000000
--- a/src/routes/(main)/eval/bench/[benchmarkId]/features/TestCasesTab/index.tsx
+++ /dev/null
@@ -1,389 +0,0 @@
-'use client';
-
-import { ActionIcon, Flexbox, Input, Text } from '@lobehub/ui';
-import { Badge, Card, Table } from 'antd';
-import type { ColumnsType } from 'antd/es/table';
-import { createStaticStyles, cssVar } from 'antd-style';
-import { Eye, Search } from 'lucide-react';
-import { memo, useMemo, useState } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import { useEvalStore } from '@/store/eval';
-
-import SegmentBar from '../../../../features/SegmentBar';
-import { createTestCasePreviewModal } from '../TestCasePreviewModal';
-
-const styles = createStaticStyles(({ css }) => ({
- card: css`
- .ant-card-body {
- padding: 0;
- }
- `,
- filterButton: css`
- cursor: pointer;
-
- padding-block: 4px;
- padding-inline: 8px;
- border: none;
-
- font-size: ${cssVar.fontSizeSM};
- font-weight: 500;
- text-transform: capitalize;
-
- background: transparent;
-
- transition:
- color 0.15s ease,
- background 0.15s ease;
-
- &[data-active='true'] {
- color: ${cssVar.colorText};
- background: ${cssVar.colorFillSecondary};
- }
-
- &[data-active='false'] {
- color: ${cssVar.colorTextTertiary};
-
- &:hover {
- color: ${cssVar.colorText};
- }
- }
-
- &:not(:first-child) {
- border-inline-start: 1px solid ${cssVar.colorBorderSecondary};
- }
-
- &:focus-visible {
- outline: 2px solid ${cssVar.colorPrimary};
- outline-offset: -1px;
- }
-
- @media (prefers-reduced-motion: reduce) {
- transition: none;
- }
- `,
- filterContainer: css`
- overflow: hidden;
- display: flex;
- border: 1px solid ${cssVar.colorBorderSecondary};
- border-radius: ${cssVar.borderRadiusSM};
- `,
- header: css`
- padding-block: 12px;
- padding-inline: 16px;
- border-block-end: 1px solid ${cssVar.colorBorderSecondary};
- `,
- headerTitle: css`
- font-size: ${cssVar.fontSize};
- font-weight: 600;
- color: ${cssVar.colorText};
- `,
- indexCell: css`
- font-family: ${cssVar.fontFamilyCode};
- font-size: ${cssVar.fontSizeSM};
- color: ${cssVar.colorTextTertiary};
- `,
- inputCell: css`
- overflow: hidden;
-
- max-width: 400px;
- margin: 0;
-
- color: ${cssVar.colorText};
- text-overflow: ellipsis;
- white-space: nowrap;
- `,
- // Summary strip — case total as a mono figure plus the difficulty mix bar,
- // sitting between the title row and the table.
- summaryDot: css`
- width: 8px;
- height: 8px;
- border-radius: 999px;
- `,
- summaryRow: css`
- display: flex;
- gap: 16px;
- align-items: center;
-
- padding-block: 12px;
- padding-inline: 16px;
- border-block-end: 1px solid ${cssVar.colorBorderSecondary};
- `,
- summaryValue: css`
- font-family: ${cssVar.fontFamilyCode};
- font-size: ${cssVar.fontSizeLG};
- font-weight: 600;
- line-height: 1;
- color: ${cssVar.colorText};
- `,
- searchIcon: css`
- position: absolute;
- inset-block-start: 50%;
- inset-inline-start: 12px;
- transform: translateY(-50%);
-
- color: ${cssVar.colorTextTertiary};
- `,
- searchInput: css`
- width: 192px;
- padding-inline-start: 32px;
- font-size: ${cssVar.fontSizeSM};
- `,
- table: css`
- .ant-table {
- font-size: ${cssVar.fontSize};
- }
-
- .ant-table-thead > tr > th {
- font-size: ${cssVar.fontSizeSM};
- font-weight: 500;
- color: ${cssVar.colorTextTertiary};
- background: ${cssVar.colorFillQuaternary};
- }
-
- .ant-table-tbody > tr {
- &:hover {
- background: ${cssVar.colorFillQuaternary};
- }
- }
- `,
-}));
-
-interface TestCasesTabProps {
- datasetId: string;
-}
-
-const TestCasesTab = memo<TestCasesTabProps>(({ datasetId }) => {
- const { t } = useTranslation('eval');
- const [pagination, setPagination] = useState({ current: 1, pageSize: 8 });
- const [search, setSearch] = useState('');
- const [diffFilter, setDiffFilter] = useState<'all' | 'easy' | 'medium' | 'hard'>('all');
-
- const useFetchTestCases = useEvalStore((s) => s.useFetchTestCases);
-
- const { data: testCaseData, isLoading: loading } = useFetchTestCases({
- datasetId,
- limit: pagination.pageSize,
- offset: (pagination.current - 1) * pagination.pageSize,
- });
-
- const data = testCaseData?.data || [];
- const total = testCaseData?.total || 0;
-
- // Difficulty mix across the loaded page — drives the summary strip's bar.
- const difficulty = useMemo(() => {
- const counts = { easy: 0, hard: 0, medium: 0 };
- for (const c of data) {
- const d = c?.metadata?.difficulty as 'easy' | 'hard' | 'medium' | undefined;
- if (d === 'easy' || d === 'medium' || d === 'hard') counts[d] += 1;
- }
- return {
- counts,
- segments: [
- { color: cssVar.colorSuccess, value: counts.easy },
- { color: cssVar.colorWarning, value: counts.medium },
- { color: cssVar.colorError, value: counts.hard },
- ],
- tagged: counts.easy + counts.medium + counts.hard,
- };
- }, [data]);
-
- // Client-side filtering
- const filteredData = data.filter((c: any) => {
- if (diffFilter !== 'all' && c.metadata?.difficulty !== diffFilter) return false;
- if (search && !c.content?.input?.toLowerCase().includes(search.toLowerCase())) return false;
- return true;
- });
-
- const getDifficultyBadge = (difficulty: string) => {
- const config: Record<string, { bg: string; color: string }> = {
- easy: {
- bg: cssVar.colorSuccessBg,
- color: cssVar.colorSuccess,
- },
- hard: {
- bg: cssVar.colorErrorBg,
- color: cssVar.colorError,
- },
- medium: {
- bg: cssVar.colorWarningBg,
- color: cssVar.colorWarning,
- },
- };
-
- const c = config[difficulty] || config.easy;
- return (
- <Badge
- style={{
- backgroundColor: c.bg,
- borderColor: c.color + '30',
- color: c.color,
- fontSize: 12,
- textTransform: 'capitalize',
- }}
- >
- {difficulty}
- </Badge>
- );
- };
-
- const columns: ColumnsType<any> = [
- {
- dataIndex: 'id',
- key: 'index',
- render: (_: any, __: any, index: number) => (
- <span className={styles.indexCell}>
- {(pagination.current - 1) * pagination.pageSize + index + 1}
- </span>
- ),
- title: '#',
- width: 64,
- },
- {
- dataIndex: ['content', 'input'],
- ellipsis: true,
- key: 'input',
- render: (text: string) => <p className={styles.inputCell}>{text}</p>,
- title: t('table.columns.input'),
- },
- {
- dataIndex: ['metadata', 'difficulty'],
- key: 'difficulty',
- render: (difficulty: string) => (difficulty ? getDifficultyBadge(difficulty) : '-'),
- title: t('table.columns.difficulty'),
- width: 96,
- },
- {
- dataIndex: ['metadata', 'tags'],
- key: 'tags',
- render: (tags: string[]) =>
- tags?.length > 0 ? (
- <Flexbox horizontal gap={4}>
- {tags.slice(0, 1).map((tag) => (
- <Badge
- key={tag}
- style={{
- backgroundColor: 'transparent',
- borderColor: cssVar.colorBorder,
- color: cssVar.colorTextTertiary,
- fontSize: 12,
- }}
- >
- {tag}
- </Badge>
- ))}
- </Flexbox>
- ) : (
- '-'
- ),
- title: t('table.columns.tags'),
- width: 112,
- },
- {
- key: 'actions',
- render: (_: any, record: any) => (
- <ActionIcon
- icon={Eye}
- size="small"
- onClick={() => createTestCasePreviewModal({ testCase: record })}
- />
- ),
- width: 64,
- },
- ];
-
- return (
- <>
- <Card className={styles.card}>
- <div className={styles.header}>
- <Flexbox horizontal align="center" justify="space-between">
- <span className={styles.headerTitle}>{t('benchmark.detail.tabs.data')}</span>
- <Flexbox horizontal align="center" gap={12}>
- <div style={{ position: 'relative' }}>
- <Search className={styles.searchIcon} size={14} />
- <Input
- className={styles.searchInput}
- placeholder={t('testCase.search.placeholder')}
- size="small"
- value={search}
- onChange={(e) => {
- setSearch(e.target.value);
- setPagination({ ...pagination, current: 1 });
- }}
- />
- </div>
- <div className={styles.filterContainer}>
- {(['all', 'easy', 'medium', 'hard'] as const).map((f) => (
- <button
- className={styles.filterButton}
- data-active={diffFilter === f}
- key={f}
- onClick={() => {
- setDiffFilter(f);
- setPagination({ ...pagination, current: 1 });
- }}
- >
- {f}
- </button>
- ))}
- </div>
- </Flexbox>
- </Flexbox>
- </div>
-
- <div className={styles.summaryRow}>
- <Flexbox gap={2}>
- <span className={styles.summaryValue}>{total}</span>
- <Text color={cssVar.colorTextTertiary} fontSize={12}>
- {t('benchmark.detail.stats.cases')}
- </Text>
- </Flexbox>
- {difficulty.tagged > 0 && (
- <Flexbox flex={1} gap={6} style={{ maxWidth: 320, minWidth: 0 }}>
- <SegmentBar segments={difficulty.segments} />
- <Flexbox horizontal gap={12} style={{ flexWrap: 'wrap' }}>
- {(['easy', 'medium', 'hard'] as const).map((d) => (
- <Flexbox horizontal align="center" gap={6} key={d}>
- <span
- className={styles.summaryDot}
- style={{
- background:
- d === 'easy'
- ? cssVar.colorSuccess
- : d === 'medium'
- ? cssVar.colorWarning
- : cssVar.colorError,
- }}
- />
- <Text color={cssVar.colorTextTertiary} fontSize={12}>
- {t(`difficulty.${d}`)} {difficulty.counts[d]}
- </Text>
- </Flexbox>
- ))}
- </Flexbox>
- </Flexbox>
- )}
- </div>
-
- <div className={styles.table}>
- <Table
- columns={columns}
- dataSource={filteredData}
- loading={loading}
- rowKey="id"
- size="middle"
- pagination={{
- current: pagination.current,
- onChange: (page, pageSize) => setPagination({ current: page, pageSize }),
- pageSize: pagination.pageSize,
- showSizeChanger: false,
- total: filteredData.length,
- }}
- />
- </div>
- </Card>
- </>
- );
-});
-
-export default TestCasesTab;
diff --git a/src/routes/(main)/eval/bench/[benchmarkId]/runs/[runId]/features/RunInfo/index.tsx b/src/routes/(main)/eval/bench/[benchmarkId]/runs/[runId]/features/RunInfo/index.tsx
deleted file mode 100644
index 2f9127b193a..00000000000
--- a/src/routes/(main)/eval/bench/[benchmarkId]/runs/[runId]/features/RunInfo/index.tsx
+++ /dev/null
@@ -1,111 +0,0 @@
-'use client';
-
-import { AGENT_PROFILE_URL } from '@lobechat/const';
-import { Avatar, Flexbox } from '@lobehub/ui';
-import { Button } from '@lobehub/ui/base-ui';
-import { Descriptions, Tag, Typography } from 'antd';
-import { memo } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import WorkspaceLink from '@/features/Workspace/WorkspaceLink';
-
-interface RunInfoProps {
- benchmarkId: string;
- run: {
- config?: {
- agentSnapshot?: {
- avatar?: string | null;
- model?: string | null;
- provider?: string | null;
- title?: string | null;
- };
- concurrency?: number;
- timeout?: number;
- };
- dataset?: {
- description?: string | null;
- id: string;
- name: string;
- };
- targetAgent?: {
- avatar?: string | null;
- id: string;
- model?: string;
- provider?: string;
- title?: string | null;
- };
- targetAgentId?: string | null;
- };
-}
-
-const RunInfo = memo<RunInfoProps>(({ benchmarkId, run }) => {
- const { t } = useTranslation('eval');
-
- const snapshot = run.config?.agentSnapshot;
- const agentTitle = run.targetAgent?.title || t('run.detail.agent.unnamed');
- const agentAvatar = snapshot?.avatar || run.targetAgent?.avatar;
- const agentModel = snapshot?.model || run.targetAgent?.model;
- const agentProvider = snapshot?.provider || run.targetAgent?.provider;
-
- const handleOpenAgent = () => {
- if (run.targetAgentId) {
- window.open(AGENT_PROFILE_URL(run.targetAgentId), '_blank');
- }
- };
-
- return (
- <Descriptions
- column={{ lg: 3, md: 2, sm: 1 }}
- size="small"
- items={[
- {
- children: run.dataset ? (
- <WorkspaceLink
- target="_blank"
- to={`/eval/bench/${benchmarkId}/datasets/${run.dataset.id}`}
- >
- <Tag style={{ cursor: 'pointer' }}>{run.dataset.name}</Tag>
- </WorkspaceLink>
- ) : (
- <Typography.Text type="secondary">-</Typography.Text>
- ),
- key: 'dataset',
- label: t('run.detail.dataset'),
- },
- {
- children: run.targetAgentId ? (
- <Flexbox horizontal align="center" gap={8}>
- <Avatar avatar={agentAvatar} size={20} />
- <Button
- size="small"
- style={{ height: 'auto', padding: 0 }}
- type="text"
- onClick={handleOpenAgent}
- >
- {agentTitle}
- </Button>
- </Flexbox>
- ) : (
- <Typography.Text type="secondary">{t('run.detail.agent.none')}</Typography.Text>
- ),
- key: 'agent',
- label: t('run.detail.agent'),
- },
- {
- children: agentModel ? (
- <Tag>
- {agentProvider ? `${agentProvider} / ` : ''}
- {agentModel}
- </Tag>
- ) : (
- <Typography.Text type="secondary">-</Typography.Text>
- ),
- key: 'model',
- label: t('run.detail.model'),
- },
- ]}
- />
- );
-});
-
-export default RunInfo;
diff --git a/src/routes/(main)/eval/features/BenchmarkCard/RunRow.tsx b/src/routes/(main)/eval/features/BenchmarkCard/RunRow.tsx
deleted file mode 100644
index f68fc133d9b..00000000000
--- a/src/routes/(main)/eval/features/BenchmarkCard/RunRow.tsx
+++ /dev/null
@@ -1,219 +0,0 @@
-'use client';
-
-import { Flexbox, Icon, Text } from '@lobehub/ui';
-import { createStaticStyles, cssVar } from 'antd-style';
-import { AlertTriangle, ArrowRight, CheckCircle2, XCircle } from 'lucide-react';
-import { memo } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import WorkspaceLink from '@/features/Workspace/WorkspaceLink';
-
-import StatusBadge from '../StatusBadge';
-
-const styles = createStaticStyles(({ css }) => ({
- meta: css`
- font-size: ${cssVar.fontSizeSM};
- color: ${cssVar.colorTextTertiary};
- `,
- mono: css`
- font-family: ${cssVar.fontFamilyCode};
- `,
- name: css`
- overflow: hidden;
-
- font-weight: 500;
- color: ${cssVar.colorText};
- text-overflow: ellipsis;
- white-space: nowrap;
- `,
- passRate: css`
- font-family: ${cssVar.fontFamilyCode};
- font-size: ${cssVar.fontSize};
- font-weight: 600;
- color: ${cssVar.colorText};
- `,
- progressFill: css`
- height: 100%;
- border-radius: 999px;
-
- background: ${cssVar.colorPrimary};
-
- transition: width 0.3s ease;
-
- @media (prefers-reduced-motion: reduce) {
- transition: none;
- }
- `,
- progressTrack: css`
- overflow: hidden;
-
- width: 100%;
- height: 4px;
- border-radius: 999px;
-
- background: ${cssVar.colorFillTertiary};
- `,
- row: css`
- cursor: pointer;
-
- padding-block: 8px;
- padding-inline: 12px;
- border: 1px solid ${cssVar.colorBorderSecondary};
- border-radius: ${cssVar.borderRadius};
-
- transition:
- border-color 0.15s ease,
- background 0.15s ease;
-
- &:hover {
- border-color: ${cssVar.colorBorder};
- background: ${cssVar.colorFillTertiary};
- }
-
- @media (prefers-reduced-motion: reduce) {
- transition: none;
- }
- `,
- separator: css`
- color: ${cssVar.colorBorderSecondary};
- `,
- stat: css`
- display: inline-flex;
- gap: 4px;
- align-items: center;
- font-size: ${cssVar.fontSizeSM};
- `,
-}));
-
-interface RunRowProps {
- agentName?: string;
- benchmarkId: string;
- completedCases?: number;
- cost?: number;
- createdAt?: string;
- errorCount?: number;
- failCount?: number;
- id: string;
- model?: string;
- name?: string;
- passCount?: number;
- passRate?: number;
- score?: number;
- status: string;
- totalCases?: number;
-}
-
-const RunRow = memo<RunRowProps>(
- ({
- id,
- name,
- status,
- benchmarkId,
- model,
- agentName,
- createdAt,
- passCount = 0,
- failCount = 0,
- errorCount = 0,
- passRate,
- cost,
- completedCases = 0,
- totalCases = 0,
- }) => {
- const { t } = useTranslation('eval');
-
- const formatDate = (iso?: string) => {
- if (!iso) return '';
- const d = new Date(iso);
- return d.toLocaleDateString('en-US', { day: 'numeric', month: 'short' });
- };
-
- const progress = totalCases > 0 ? Math.round((completedCases / totalCases) * 100) : 0;
- const hasStats =
- (status === 'completed' || status === 'running') && passCount + failCount + errorCount > 0;
-
- return (
- <WorkspaceLink
- style={{ color: 'inherit', textDecoration: 'none' }}
- to={`/eval/bench/${benchmarkId}/runs/${id}`}
- >
- <Flexbox horizontal align={'center'} className={styles.row} gap={12}>
- <Flexbox flex={1} gap={2} style={{ minWidth: 0 }}>
- <Flexbox horizontal align={'center'} gap={8}>
- <span className={styles.name}>{name || id.slice(0, 8)}</span>
- <StatusBadge status={status} />
- </Flexbox>
- <Flexbox horizontal align={'center'} className={styles.meta} gap={4}>
- {createdAt && <span>{formatDate(createdAt)}</span>}
- {createdAt && agentName && <span className={styles.separator}>/</span>}
- {agentName && <span>{agentName}</span>}
- {(createdAt || agentName) && model && <span className={styles.separator}>/</span>}
- {model && <span className={styles.mono}>{model}</span>}
- {cost != null && cost > 0 && (
- <>
- <span className={styles.separator}>/</span>
- <span>${cost.toFixed(2)}</span>
- </>
- )}
- </Flexbox>
- </Flexbox>
-
- {status === 'running' ? (
- <Flexbox align={'flex-end'} gap={4} style={{ width: 100 }}>
- <Flexbox
- horizontal
- align={'center'}
- justify={'space-between'}
- style={{ width: '100%' }}
- >
- <Text color={cssVar.colorTextTertiary} fontSize={12}>
- {completedCases}/{totalCases}
- </Text>
- <Text color={cssVar.colorTextTertiary} fontSize={12}>
- {progress}%
- </Text>
- </Flexbox>
- <div className={styles.progressTrack}>
- <div className={styles.progressFill} style={{ width: `${progress}%` }} />
- </div>
- </Flexbox>
- ) : hasStats ? (
- <Flexbox horizontal align={'center'} gap={12}>
- <span className={styles.stat} style={{ color: cssVar.colorSuccess }}>
- <Icon icon={CheckCircle2} size={12} />
- {passCount}
- </span>
- <span className={styles.stat} style={{ color: cssVar.colorError }}>
- <Icon icon={XCircle} size={12} />
- {failCount}
- </span>
- {errorCount > 0 && (
- <span className={styles.stat} style={{ color: cssVar.colorWarning }}>
- <Icon icon={AlertTriangle} size={12} />
- {errorCount}
- </span>
- )}
- {passRate != null && (
- <span className={styles.passRate}>{(passRate * 100).toFixed(0)}%</span>
- )}
- </Flexbox>
- ) : status === 'failed' ? (
- <span className={styles.meta}>
- {t('benchmark.card.run.beforeFailure', { completed: completedCases, total: totalCases })}
- </span>
- ) : (
- <span className={styles.meta}>{t('benchmark.card.run.queued')}</span>
- )}
-
- <Icon
- icon={ArrowRight}
- size={14}
- style={{ color: cssVar.colorTextTertiary, flexShrink: 0 }}
- />
- </Flexbox>
- </WorkspaceLink>
- );
- },
-);
-
-export default RunRow;
diff --git a/src/routes/(main)/group/_layout/Sidebar/GroupConfig/GroupRole.tsx b/src/routes/(main)/group/_layout/Sidebar/GroupConfig/GroupRole.tsx
deleted file mode 100644
index 13a088f13af..00000000000
--- a/src/routes/(main)/group/_layout/Sidebar/GroupConfig/GroupRole.tsx
+++ /dev/null
@@ -1,96 +0,0 @@
-'use client';
-
-import { Flexbox } from '@lobehub/ui';
-import { EditableMessage } from '@lobehub/ui/chat';
-import { type MouseEvent } from 'react';
-import { memo } from 'react';
-import { useTranslation } from 'react-i18next';
-import { useParams } from 'react-router';
-
-import GroupInfo from '@/features/GroupInfo';
-import { usePermission } from '@/hooks/usePermission';
-import { useAgentGroupStore } from '@/store/agentGroup';
-import { agentGroupSelectors } from '@/store/agentGroup/selectors';
-import { type LobeSession } from '@/types/session';
-
-import { styles } from './style';
-
-interface GroupRoleProps {
- currentSession?: LobeSession;
- editing: boolean;
- editorModalOpen: boolean;
- setEditing: (editing: boolean) => void;
- setEditorModalOpen: (open: boolean) => void;
-}
-
-const GroupRole = memo<GroupRoleProps>(
- ({ currentSession, editorModalOpen, setEditorModalOpen, setEditing, editing }) => {
- const { t } = useTranslation('chat');
- const { allowed: canEdit } = usePermission('edit_own_content');
-
- const { gid } = useParams<{ gid: string }>();
- const activeGroupId = useAgentGroupStore((s) => s.activeGroupId);
- const updateGroupConfig = useAgentGroupStore((s) => s.updateGroupConfig);
- const groupConfig = useAgentGroupStore((s) => agentGroupSelectors.getGroupConfig(gid ?? '')(s));
-
- const handleSystemPromptChange = async (value: string) => {
- if (!canEdit) return;
- if (!activeGroupId) return;
- await updateGroupConfig({ systemPrompt: value });
- };
-
- const handleOpenWithEdit = (e: MouseEvent) => {
- e.stopPropagation();
- if (!canEdit) return;
-
- setEditing(true);
- setEditorModalOpen(true);
- };
-
- const handleOpen = (e: MouseEvent) => {
- e.stopPropagation();
- if (editorModalOpen) return;
- if (e.altKey) handleOpenWithEdit(e);
- setEditorModalOpen(true);
- };
-
- return (
- <Flexbox height={200} paddingInline={8} onClick={handleOpen}>
- <EditableMessage
- classNames={{ markdown: styles.prompt }}
- editing={editing}
- markdownProps={{ enableLatex: false, enableMermaid: false }}
- openModal={editorModalOpen}
- placeholder={`${t('settingGroup.systemPrompt.placeholder', { ns: 'setting' })}...`}
- value={groupConfig?.systemPrompt || ''}
- model={{
- extra: <GroupInfo meta={currentSession?.meta} style={{ marginBottom: 16 }} />,
- }}
- styles={{
- markdown: {
- opacity: groupConfig?.systemPrompt ? undefined : 0.5,
- overflow: 'visible',
- },
- }}
- text={{
- cancel: t('cancel', { ns: 'common' }),
- confirm: t('ok', { ns: 'common' }),
- edit: t('edit', { ns: 'common' }),
- title: t('settingGroup.systemPrompt.title', { ns: 'setting' }),
- }}
- onChange={handleSystemPromptChange}
- onOpenChange={setEditorModalOpen}
- onEditingChange={(next) => {
- if (!canEdit) return;
-
- setEditing(next);
- }}
- />
- </Flexbox>
- );
- },
-);
-
-GroupRole.displayName = 'GroupRole';
-
-export default GroupRole;
diff --git a/src/routes/(main)/group/_layout/Sidebar/GroupConfig/Header/index.tsx b/src/routes/(main)/group/_layout/Sidebar/GroupConfig/Header/index.tsx
deleted file mode 100644
index ca435bdba42..00000000000
--- a/src/routes/(main)/group/_layout/Sidebar/GroupConfig/Header/index.tsx
+++ /dev/null
@@ -1,38 +0,0 @@
-'use client';
-
-import { Flexbox, Text } from '@lobehub/ui';
-import { memo } from 'react';
-import { useTranslation } from 'react-i18next';
-import { useParams } from 'react-router';
-
-import { useAgentGroupStore } from '@/store/agentGroup';
-import { agentGroupSelectors } from '@/store/agentGroup/selectors';
-
-import Avatar from './Avatar';
-
-const HeaderInfo = memo(() => {
- const { t } = useTranslation('chat');
- const { gid } = useParams<{ gid: string }>();
- const groupMeta = useAgentGroupStore((s) => agentGroupSelectors.getGroupMeta(gid ?? '')(s));
-
- const displayTitle = groupMeta.title || t('untitledGroup');
-
- return (
- <Flexbox
- horizontal
- align={'center'}
- flex={1}
- gap={8}
- style={{
- overflow: 'hidden',
- }}
- >
- <Avatar />
- <Text ellipsis weight={500}>
- {displayTitle}
- </Text>
- </Flexbox>
- );
-});
-
-export default HeaderInfo;
diff --git a/src/routes/(main)/group/_layout/Sidebar/Topic/TopicListContent/index.tsx b/src/routes/(main)/group/_layout/Sidebar/Topic/TopicListContent/index.tsx
deleted file mode 100644
index 23a6e2b17ef..00000000000
--- a/src/routes/(main)/group/_layout/Sidebar/Topic/TopicListContent/index.tsx
+++ /dev/null
@@ -1,56 +0,0 @@
-'use client';
-
-import React, { memo } from 'react';
-import { useTranslation } from 'react-i18next';
-import urlJoin from 'url-join';
-
-import EmptyNavItem from '@/features/NavPanel/components/EmptyNavItem';
-import SkeletonList from '@/features/NavPanel/components/SkeletonList';
-import { useFetchChatTopics } from '@/hooks/useFetchChatTopics';
-import { useQueryRoute } from '@/hooks/useQueryRoute';
-import { useAgentGroupStore } from '@/store/agentGroup';
-import { useChatStore } from '@/store/chat';
-import { topicSelectors } from '@/store/chat/selectors';
-import { useUserStore } from '@/store/user';
-import { preferenceSelectors } from '@/store/user/selectors';
-
-import ByTimeMode from './ByTimeMode';
-import FlatMode from './FlatMode';
-import SearchResult from './SearchResult';
-
-const TopicListContent = memo(() => {
- const { t } = useTranslation('topic');
- const router = useQueryRoute();
- const topicLength = useChatStore((s) => topicSelectors.currentTopicLength(s));
- const [isUndefinedTopics, isInSearchMode] = useChatStore((s) => [
- topicSelectors.isUndefinedTopics(s),
- topicSelectors.isInSearchMode(s),
- ]);
- const activeGroupId = useAgentGroupStore((s) => s.activeGroupId);
- const topicGroupMode = useUserStore(preferenceSelectors.topicGroupMode);
-
- useFetchChatTopics();
-
- if (isInSearchMode) return <SearchResult />;
-
- // Show skeleton when current session's topic data is not yet loaded
- if (isUndefinedTopics) return <SkeletonList />;
-
- return (
- <>
- {topicLength === 0 && activeGroupId && (
- <EmptyNavItem
- title={t('actions.addNewTopic')}
- onClick={() => {
- router.push(urlJoin('/group', activeGroupId));
- }}
- />
- )}
- {topicGroupMode === 'flat' ? <FlatMode /> : <ByTimeMode />}
- </>
- );
-});
-
-TopicListContent.displayName = 'TopicListContent';
-
-export default TopicListContent;
diff --git a/src/routes/(main)/group/_layout/Sidebar/Topic/TopicSearchBar/index.tsx b/src/routes/(main)/group/_layout/Sidebar/Topic/TopicSearchBar/index.tsx
deleted file mode 100644
index 5f6ab98e11f..00000000000
--- a/src/routes/(main)/group/_layout/Sidebar/Topic/TopicSearchBar/index.tsx
+++ /dev/null
@@ -1,59 +0,0 @@
-'use client';
-
-import { SearchBar } from '@lobehub/ui';
-import { useUnmount } from 'ahooks';
-import { memo, useState } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import { useChatStore } from '@/store/chat';
-import { useServerConfigStore } from '@/store/serverConfig';
-
-const TopicSearchBar = memo<{ onClear?: () => void }>(({ onClear }) => {
- const { t } = useTranslation('topic');
-
- const [tempValue, setTempValue] = useState('');
- const [searchKeyword, setSearchKeywords] = useState('');
- const mobile = useServerConfigStore((s) => s.isMobile);
- const [activeAgentId, useSearchTopics] = useChatStore((s) => [
- s.activeAgentId,
- s.useSearchTopics,
- ]);
-
- useSearchTopics(searchKeyword, { agentId: activeAgentId });
-
- useUnmount(() => {
- useChatStore.setState({ inSearchingMode: false, isSearchingTopic: false });
- });
-
- const startSearchTopic = () => {
- if (tempValue === searchKeyword) return;
-
- setSearchKeywords(tempValue);
- useChatStore.setState({ inSearchingMode: !!tempValue, isSearchingTopic: !!tempValue });
- };
-
- return (
- <SearchBar
- autoFocus
- placeholder={t('searchPlaceholder')}
- spotlight={!mobile}
- value={tempValue}
- variant={'filled'}
- onPressEnter={startSearchTopic}
- onBlur={() => {
- if (tempValue === '') {
- onClear?.();
-
- return;
- }
-
- startSearchTopic();
- }}
- onChange={(e) => {
- setTempValue(e.target.value);
- }}
- />
- );
-});
-
-export default TopicSearchBar;
diff --git a/src/routes/(main)/group/features/Conversation/ChatItem/Thread.tsx b/src/routes/(main)/group/features/Conversation/ChatItem/Thread.tsx
deleted file mode 100644
index bcd47af26cf..00000000000
--- a/src/routes/(main)/group/features/Conversation/ChatItem/Thread.tsx
+++ /dev/null
@@ -1,71 +0,0 @@
-import { Flexbox, Text } from '@lobehub/ui';
-import { createStaticStyles, cx } from 'antd-style';
-import isEqual from 'fast-deep-equal';
-import { type CSSProperties } from 'react';
-import { memo } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import { useIsDark } from '@/hooks/useIsDark';
-import { useChatStore } from '@/store/chat';
-import { threadSelectors } from '@/store/chat/selectors';
-
-import ThreadItem from './ThreadItem';
-
-const styles = createStaticStyles(({ css, cssVar }) => ({
- container: css`
- cursor: pointer;
-
- padding-block: 8px 4px;
- padding-inline: 4px;
- border-radius: 6px;
-
- background: ${cssVar.colorFillQuaternary};
- `,
- container_dark: css`
- background: ${cssVar.colorFillTertiary};
- `,
-}));
-
-interface ThreadProps {
- id: string;
- placement: 'start' | 'end';
- style?: CSSProperties;
-}
-
-const Thread = memo<ThreadProps>(({ id, placement, style }) => {
- const { t } = useTranslation('chat');
- const isDarkMode = useIsDark();
-
- const threads = useChatStore(threadSelectors.getThreadsBySourceMsgId(id), isEqual);
-
- return (
- <Flexbox
- direction={placement === 'end' ? 'horizontal-reverse' : 'horizontal'}
- gap={12}
- paddingInline={16}
- style={{ marginTop: -12, paddingBottom: 16, ...style }}
- >
- <div style={{ width: 40 }} />
- <Flexbox
- className={cx(styles.container, isDarkMode && styles.container_dark)}
- gap={4}
- padding={4}
- style={{ width: 'fit-content' }}
- >
- <Flexbox horizontal gap={8} paddingInline={6}>
- <Text style={{ fontSize: 12 }} type={'secondary'}>
- {t('thread.title')}
- {threads.length}
- </Text>
- </Flexbox>
- <Flexbox>
- {threads.map((thread) => (
- <ThreadItem key={thread.id} {...thread} />
- ))}
- </Flexbox>
- </Flexbox>
- </Flexbox>
- );
-});
-
-export default Thread;
diff --git a/src/routes/(main)/group/features/Conversation/Header/Tags/KnowledgeTag.tsx b/src/routes/(main)/group/features/Conversation/Header/Tags/KnowledgeTag.tsx
deleted file mode 100644
index c39109c15d6..00000000000
--- a/src/routes/(main)/group/features/Conversation/Header/Tags/KnowledgeTag.tsx
+++ /dev/null
@@ -1,42 +0,0 @@
-'use client';
-
-import { type MenuProps } from '@lobehub/ui';
-import { DropdownMenu, Flexbox, Icon, Tag } from '@lobehub/ui';
-import { LibraryBig } from 'lucide-react';
-import { memo } from 'react';
-
-import KnowledgeIcon from '@/components/KnowledgeIcon';
-import { oneLineEllipsis } from '@/styles';
-import { type KnowledgeItem } from '@/types/knowledgeBase';
-
-export interface PluginTagProps {
- data: KnowledgeItem[];
-}
-
-const PluginTag = memo<PluginTagProps>(({ data }) => {
- if (data.length === 0) return null;
-
- const items: MenuProps['items'] = data.map((item) => ({
- icon: <KnowledgeIcon fileType={item.fileType} name={item.name} type={item.type} />,
- key: item.id,
- label: <Flexbox style={{ paddingInlineStart: 8 }}>{item.name}</Flexbox>,
- }));
-
- const count = data.length;
-
- return (
- <DropdownMenu items={items}>
- <div>
- <Tag>
- {<Icon icon={LibraryBig} />}
- <div className={oneLineEllipsis} style={{ maxWidth: 140 }}>
- {data[0].name}
- </div>
- {count > 1 && <div>({data.length - 1}+)</div>}
- </Tag>
- </div>
- </DropdownMenu>
- );
-});
-
-export default PluginTag;
diff --git a/src/routes/(main)/group/features/Conversation/Header/Tags/SearchTags.tsx b/src/routes/(main)/group/features/Conversation/Header/Tags/SearchTags.tsx
deleted file mode 100644
index 0b4b854952f..00000000000
--- a/src/routes/(main)/group/features/Conversation/Header/Tags/SearchTags.tsx
+++ /dev/null
@@ -1,19 +0,0 @@
-import { Flexbox, Icon, Tag } from '@lobehub/ui';
-import { Globe } from 'lucide-react';
-import { memo } from 'react';
-import { useTranslation } from 'react-i18next';
-
-const SearchTag = memo(() => {
- const { t } = useTranslation('chat');
-
- return (
- <Flexbox height={22}>
- <Tag>
- {<Icon icon={Globe} />}
- <div>{t('search.title')}</div>
- </Tag>
- </Flexbox>
- );
-});
-
-export default SearchTag;
diff --git a/src/routes/(main)/group/features/Conversation/Header/Tags/index.tsx b/src/routes/(main)/group/features/Conversation/Header/Tags/index.tsx
deleted file mode 100644
index e8f3baf5751..00000000000
--- a/src/routes/(main)/group/features/Conversation/Header/Tags/index.tsx
+++ /dev/null
@@ -1,18 +0,0 @@
-import { Flexbox } from '@lobehub/ui';
-import { memo } from 'react';
-
-import MemberCountTag from './MemberCountTag';
-
-/**
- * TitleTags for Group context - always shows MemberCountTag
- * since we're always in a group session here
- */
-const TitleTags = memo(() => {
- return (
- <Flexbox horizontal align={'center'} gap={12}>
- <MemberCountTag />
- </Flexbox>
- );
-});
-
-export default TitleTags;
diff --git a/src/routes/(main)/group/features/Conversation/MainChatInput/GroupChat.tsx b/src/routes/(main)/group/features/Conversation/MainChatInput/GroupChat.tsx
deleted file mode 100644
index a6b661cea85..00000000000
--- a/src/routes/(main)/group/features/Conversation/MainChatInput/GroupChat.tsx
+++ /dev/null
@@ -1,121 +0,0 @@
-'use client';
-
-import { type SlashOptions } from '@lobehub/editor';
-import { Alert, Avatar, Flexbox } from '@lobehub/ui';
-import { isEqual } from 'es-toolkit/compat';
-import { memo, Suspense, useMemo } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import { DEFAULT_AVATAR } from '@/const/meta';
-import { type ActionKeys } from '@/features/ChatInput';
-import { ChatInputProvider, DesktopChatInput } from '@/features/ChatInput';
-import { useConversationStore } from '@/features/Conversation';
-import { contextSelectors } from '@/features/Conversation/store';
-import GroupAvatar from '@/features/GroupAvatar';
-import WideScreenContainer from '@/features/WideScreenContainer';
-import { useAgentGroupStore } from '@/store/agentGroup';
-import { agentGroupSelectors } from '@/store/agentGroup/selectors';
-import { useChatStore } from '@/store/chat';
-import { agentRunSelectors } from '@/store/chat/selectors';
-
-import MessageFromUrl from './MessageFromUrl';
-import { useSendMenuItems } from './useSendMenuItems';
-
-const leftActions: ActionKeys[] = ['typo', 'fileUpload', '---', ['tools', 'params', 'clear']];
-
-const dmLeftActions: ActionKeys[] = ['typo', 'fileUpload'];
-
-const rightActions: ActionKeys[] = ['contextWindow'];
-
-/**
- * Message Editor for Group Chat along with DM Portal
- */
-const Desktop = memo((props: { targetMemberId?: string }) => {
- const { t } = useTranslation('chat');
-
- const isDMPortal = !!props.targetMemberId;
- const groupId = useConversationStore(contextSelectors.groupId);
- const currentGroupMembers = useAgentGroupStore(
- (s) => agentGroupSelectors.getGroupAgents(groupId ?? '')(s),
- isEqual,
- );
- const isGroupConfigLoading = useAgentGroupStore(agentGroupSelectors.isGroupsInit);
-
- const [mainInputSendErrorMsg, clearSendMessageError] = useChatStore((s) => [
- agentRunSelectors.isCurrentSendMessageError(s),
- s.clearSendMessageError,
- ]);
-
- const mentionItems: SlashOptions['items'] = useMemo(() => {
- if (!currentGroupMembers) return [];
- return [
- {
- icon: (
- <GroupAvatar
- size={24}
- avatars={
- currentGroupMembers?.map((member) => ({
- avatar: member.avatar || DEFAULT_AVATAR,
- background: member.backgroundColor || undefined,
- })) || []
- }
- />
- ),
- key: 'ALL_MEMBERS',
- label: t('memberSelection.allMembers'),
- metadata: { id: 'ALL_MEMBERS' },
- },
- ...currentGroupMembers.map((member) => ({
- icon: (
- <Avatar
- avatar={member.avatar}
- background={member.backgroundColor ?? undefined}
- size={24}
- />
- ),
- key: member.id,
- label: member.title,
- metadata: { id: member.id },
- })),
- ];
- }, [currentGroupMembers, t]);
-
- const sendMenuItems = useSendMenuItems();
-
- return (
- <ChatInputProvider
- leftActions={isDMPortal ? dmLeftActions : leftActions}
- mentionItems={mentionItems}
- rightActions={isDMPortal ? [] : rightActions}
- chatInputEditorRef={(instance) => {
- if (!instance) return;
- useChatStore.setState({ mainInputEditor: instance });
- }}
- sendMenu={{
- items: sendMenuItems,
- }}
- onMarkdownContentChange={(content) => {
- useChatStore.setState({ inputMessage: content });
- }}
- >
- <WideScreenContainer>
- {mainInputSendErrorMsg && (
- <Flexbox paddingBlock={'0 6px'} paddingInline={12}>
- <Alert
- closable
- title={t('input.errorMsg', { errorMsg: mainInputSendErrorMsg })}
- type={'warning'}
- onClose={clearSendMessageError}
- />
- </Flexbox>
- )}
- <DesktopChatInput isConfigLoading={isGroupConfigLoading} />
- </WideScreenContainer>
- <Suspense>
- <MessageFromUrl />
- </Suspense>
- </ChatInputProvider>
- );
-});
-
-export default Desktop;
diff --git a/src/routes/(main)/group/features/Portal/_layout/Desktop.tsx b/src/routes/(main)/group/features/Portal/_layout/Desktop.tsx
deleted file mode 100644
index fb6bc84bd1c..00000000000
--- a/src/routes/(main)/group/features/Portal/_layout/Desktop.tsx
+++ /dev/null
@@ -1,11 +0,0 @@
-import { PortalContent } from '@/features/Portal/router';
-
-import Body from '../features/Body';
-
-const Layout = () => {
- return (
- <PortalContent renderBody={(body) => <Body>{body}</Body>} />
- );
-};
-
-export default Layout;
diff --git a/src/routes/(main)/group/features/Portal/_layout/Mobile.tsx b/src/routes/(main)/group/features/Portal/_layout/Mobile.tsx
deleted file mode 100644
index 4ff0fbce194..00000000000
--- a/src/routes/(main)/group/features/Portal/_layout/Mobile.tsx
+++ /dev/null
@@ -1,59 +0,0 @@
-'use client';
-
-import { Flexbox } from '@lobehub/ui';
-import { createStaticStyles, cx } from 'antd-style';
-import { type ReactNode } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import ImperativeModal from '@/components/ImperativeModal';
-import { PortalContent } from '@/features/Portal/router';
-import { useChatStore } from '@/store/chat';
-import { portalThreadSelectors } from '@/store/chat/selectors';
-
-const styles = createStaticStyles(({ css, cssVar }) => ({
- container: css`
- background: linear-gradient(${cssVar.colorBgElevated}, ${cssVar.colorBgContainer}) !important;
- `,
-}));
-
-const Layout = () => {
- const [showMobilePortal, isPortalThread, clearPortalStack] = useChatStore((s) => [
- s.showPortal,
- portalThreadSelectors.showThread(s),
- s.clearPortalStack,
- ]);
- const { t } = useTranslation('portal');
-
- const renderBody = (body: ReactNode) => (
- <Flexbox gap={8} height={'calc(100% - 52px)'} padding={'0 8px'} style={{ overflow: 'hidden' }}>
- <Flexbox
- height={'100%'}
- style={{ marginInline: -8, overflow: 'hidden', position: 'relative' }}
- width={'calc(100% + 16px)'}
- >
- {body}
- </Flexbox>
- </Flexbox>
- );
-
- return (
- <ImperativeModal
- allowFullscreen
- destroyOnHidden
- className={cx(isPortalThread && styles.container)}
- footer={null}
- height={'95%'}
- open={showMobilePortal}
- title={t('title')}
- styles={{
- body: { padding: 0 },
- header: { display: 'none' },
- }}
- onCancel={() => clearPortalStack()}
- >
- <PortalContent renderBody={renderBody} />
- </ImperativeModal>
- );
-};
-
-export default Layout;
diff --git a/src/routes/(main)/home/_layout/Body/BottomMenu/index.tsx b/src/routes/(main)/home/_layout/Body/BottomMenu/index.tsx
deleted file mode 100644
index d073b88e287..00000000000
--- a/src/routes/(main)/home/_layout/Body/BottomMenu/index.tsx
+++ /dev/null
@@ -1,12 +0,0 @@
-import { memo } from 'react';
-
-/**
- * BottomMenu items (Community, Resources) are now rendered by Body
- * based on sidebarSectionOrder for drag-and-drop reordering support.
- * This component is kept as a placeholder for potential future use.
- */
-const BottomMenu = memo(() => {
- return null;
-});
-
-export default BottomMenu;
diff --git a/src/routes/(main)/home/_layout/Body/InboxEntry.tsx b/src/routes/(main)/home/_layout/Body/InboxEntry.tsx
deleted file mode 100644
index bba013f2bb8..00000000000
--- a/src/routes/(main)/home/_layout/Body/InboxEntry.tsx
+++ /dev/null
@@ -1,88 +0,0 @@
-'use client';
-
-import { AGENT_CHAT_URL, DEFAULT_INBOX_AVATAR } from '@lobechat/const';
-import { Avatar, Icon } from '@lobehub/ui';
-import { createStaticStyles } from 'antd-style';
-import { Loader2 } from 'lucide-react';
-import { memo } from 'react';
-
-import NavItem from '@/features/NavPanel/components/NavItem';
-import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';
-import WorkspaceLink from '@/features/Workspace/WorkspaceLink';
-import { useAgentStore } from '@/store/agent';
-import { agentSelectors, builtinAgentSelectors } from '@/store/agent/selectors';
-import { useChatStore } from '@/store/chat';
-import { operationSelectors } from '@/store/chat/selectors';
-import { isModifierClick } from '@/utils/navigation';
-
-const styles = createStaticStyles(({ css, cssVar }) => ({
- runningBadge: css`
- pointer-events: none;
-
- position: absolute;
- inset-block-end: -3px;
- inset-inline-end: -3px;
-
- display: inline-flex;
- align-items: center;
- justify-content: center;
-
- width: 14px;
- height: 14px;
- border: 1.5px solid ${cssVar.colorBgContainer};
- border-radius: 999px;
-
- color: ${cssVar.colorWarning};
-
- background: ${cssVar.colorBgContainer};
- `,
- wrapper: css`
- position: relative;
- display: inline-flex;
- `,
-}));
-
-const InboxEntry = memo(() => {
- const navigate = useWorkspaceAwareNavigate();
- const inboxAgentId = useAgentStore(builtinAgentSelectors.inboxAgentId);
- const inboxMeta = useAgentStore(agentSelectors.getAgentMetaById(inboxAgentId!));
- const isLoading = useChatStore(
- inboxAgentId ? operationSelectors.isAgentVisiblyRunning(inboxAgentId) : () => false,
- );
-
- const title = inboxMeta.title || 'Lobe AI';
- const avatar = inboxMeta.avatar || DEFAULT_INBOX_AVATAR;
- const url = AGENT_CHAT_URL(inboxAgentId, false);
-
- const avatarNode = <Avatar emojiScaleWithBackground avatar={avatar} shape={'square'} size={24} />;
-
- return (
- <WorkspaceLink
- aria-label={title}
- to={url}
- onClick={(e) => {
- if (isModifierClick(e)) return;
- e.preventDefault();
- navigate(url);
- }}
- >
- <NavItem
- title={title}
- icon={
- isLoading ? (
- <span className={styles.wrapper}>
- {avatarNode}
- <span className={styles.runningBadge}>
- <Icon spin icon={Loader2} size={9} />
- </span>
- </span>
- ) : (
- avatarNode
- )
- }
- />
- </WorkspaceLink>
- );
-});
-
-export default InboxEntry;
diff --git a/src/routes/(main)/home/_layout/Body/Project/index.tsx b/src/routes/(main)/home/_layout/Body/Project/index.tsx
deleted file mode 100644
index 1de34365420..00000000000
--- a/src/routes/(main)/home/_layout/Body/Project/index.tsx
+++ /dev/null
@@ -1,42 +0,0 @@
-'use client';
-
-import { AccordionItem, ContextMenuTrigger, Text } from '@lobehub/ui';
-import React, { memo,Suspense } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import SkeletonList from '@/features/NavPanel/components/SkeletonList';
-
-import Actions from './Actions';
-import List from './List';
-import { useProjectActionsDropdownMenu } from './useDropdownMenu';
-
-interface ProjectProps {
- itemKey: string;
-}
-
-const Project = memo<ProjectProps>(({ itemKey }) => {
- const { t } = useTranslation('common');
- const dropdownMenu = useProjectActionsDropdownMenu();
- return (
- <AccordionItem
- action={<Actions />}
- itemKey={itemKey}
- paddingBlock={4}
- paddingInline={'8px 4px'}
- headerWrapper={(header) => (
- <ContextMenuTrigger items={dropdownMenu}>{header}</ContextMenuTrigger>
- )}
- title={
- <Text ellipsis fontSize={12} type={'secondary'} weight={500}>
- {t('navPanel.library')}
- </Text>
- }
- >
- <Suspense fallback={<SkeletonList />}>
- <List />
- </Suspense>
- </AccordionItem>
- );
-});
-
-export default Project;
diff --git a/src/routes/(main)/home/_layout/CreateGroupModal/index.tsx b/src/routes/(main)/home/_layout/CreateGroupModal/index.tsx
deleted file mode 100644
index 0fb5945a46a..00000000000
--- a/src/routes/(main)/home/_layout/CreateGroupModal/index.tsx
+++ /dev/null
@@ -1,166 +0,0 @@
-'use client';
-
-import { Flexbox, stopPropagation } from '@lobehub/ui';
-import { Button } from '@lobehub/ui/base-ui';
-import { App } from 'antd';
-import { createStaticStyles } from 'antd-style';
-import { memo, useEffect, useState } from 'react';
-import { useTranslation } from 'react-i18next';
-import useSWR from 'swr';
-
-import ImperativeModal from '@/components/ImperativeModal';
-import { usePermission } from '@/hooks/usePermission';
-import { groupKeys } from '@/libs/swr/keys';
-import { agentService } from '@/services/agent';
-import { useGlobalStore } from '@/store/global';
-import { useHomeStore } from '@/store/home';
-
-import { type AgentItemData } from './AgentItem';
-import AvailableAgentList from './AvailableAgentList';
-import SelectedAgentList from './SelectedAgentList';
-import { useAgentSelectionStore } from './store';
-
-const styles = createStaticStyles(({ css, cssVar }) => ({
- container: css`
- display: flex;
- flex-direction: row;
-
- height: 500px;
- border: 1px solid ${cssVar.colorBorderSecondary};
- border-radius: ${cssVar.borderRadius};
- `,
- rightColumn: css`
- display: flex;
- flex: 1;
- flex-direction: column;
- `,
-}));
-
-export interface CreateGroupModalProps {
- id: string;
- onCancel: () => void;
- open: boolean;
-}
-
-const CreateGroupModal = memo<CreateGroupModalProps>(({ id, onCancel, open }) => {
- const { t } = useTranslation(['chat', 'common']);
- const { allowed: canCreate } = usePermission('create_content');
- const { message } = App.useApp();
-
- const toggleExpandSessionGroup = useGlobalStore((s) => s.toggleExpandSessionGroup);
- const [updateAgentGroup, addGroup] = useHomeStore((s) => [s.updateAgentGroup, s.addGroup]);
-
- const [groupName, setGroupName] = useState('');
- const [isCreating, setIsCreating] = useState(false);
-
- const selectedAgentIds = useAgentSelectionStore((s) => s.selectedAgentIds);
- const setSelectedAgents = useAgentSelectionStore((s) => s.setSelectedAgents);
- const clearSelection = useAgentSelectionStore((s) => s.clearSelection);
-
- // Fetch all agents
- const { data: allAgents = [], isLoading: isLoadingAgents } = useSWR<AgentItemData[]>(
- open ? groupKeys.queryAgentsForCreate() : null,
- () => agentService.queryAgents(),
- );
-
- // Clear state when modal closes
- useEffect(() => {
- if (!open) {
- setGroupName('');
- clearSelection();
- }
- }, [open, clearSelection]);
-
- // Pre-select the initial agent when modal opens
- useEffect(() => {
- if (open && id) {
- setSelectedAgents([id]);
- }
- }, [open, id, setSelectedAgents]);
-
- const handleConfirm = async () => {
- if (!canCreate) return;
-
- if (groupName.length === 0 || groupName.length > 20 || groupName.trim() === '') {
- message.warning(t('sessionGroup.tooLong'));
- return;
- }
-
- if (selectedAgentIds.length === 0) {
- message.warning(t('sessionGroup.noSelectedAgents'));
- return;
- }
-
- try {
- setIsCreating(true);
- const groupId = await addGroup(groupName);
-
- // Move all selected agents to the new group
- await Promise.all(selectedAgentIds.map((agentId) => updateAgentGroup(agentId, groupId)));
-
- toggleExpandSessionGroup(groupId, true);
- message.success(t('sessionGroup.createSuccess'));
- clearSelection();
- onCancel();
- } catch (error) {
- console.error('Failed to create group:', error);
- } finally {
- setIsCreating(false);
- }
- };
-
- const handleCancel = () => {
- setGroupName('');
- clearSelection();
- onCancel();
- };
-
- const isConfirmDisabled =
- !canCreate || groupName.trim() === '' || selectedAgentIds.length === 0 || isCreating;
-
- return (
- <div onClick={stopPropagation}>
- <ImperativeModal
- allowFullscreen
- destroyOnHidden
- open={open}
- title={t('sessionGroup.createGroup')}
- width={800}
- footer={
- <Flexbox horizontal gap={8} justify="end">
- <Button onClick={handleCancel}>{t('cancel', { ns: 'common' })}</Button>
- <Button
- disabled={isConfirmDisabled}
- loading={isCreating}
- type="primary"
- onClick={handleConfirm}
- >
- {t('sessionGroup.createGroup')}
- </Button>
- </Flexbox>
- }
- onCancel={handleCancel}
- >
- <Flexbox horizontal className={styles.container}>
- {/* Left Column - Available Agents */}
- <AvailableAgentList agents={allAgents} isLoading={isLoadingAgents} />
-
- {/* Right Column - Selected Agents and Group Name */}
- <Flexbox className={styles.rightColumn}>
- <SelectedAgentList
- agents={allAgents}
- groupName={groupName}
- onGroupNameChange={(name) => {
- if (!canCreate) return;
-
- setGroupName(name);
- }}
- />
- </Flexbox>
- </Flexbox>
- </ImperativeModal>
- </div>
- );
-});
-
-export default CreateGroupModal;
diff --git a/src/routes/(main)/home/features/FeaturedPlugins/index.tsx b/src/routes/(main)/home/features/FeaturedPlugins/index.tsx
deleted file mode 100644
index 9af8ac30688..00000000000
--- a/src/routes/(main)/home/features/FeaturedPlugins/index.tsx
+++ /dev/null
@@ -1,58 +0,0 @@
-'use client';
-
-import { MCP } from '@lobehub/icons';
-import { ActionIcon, DropdownMenu, Grid } from '@lobehub/ui';
-import { cssVar } from 'antd-style';
-import { MoreHorizontal } from 'lucide-react';
-import { memo, Suspense } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';
-
-import GroupBlock from '../components/GroupBlock';
-import GroupSkeleton from '../components/GroupSkeleton';
-import { RECENT_BLOCK_SIZE } from '../const';
-import FeaturedPluginsList from './List';
-
-const FeaturedPlugins = memo(() => {
- const { t } = useTranslation('discover');
- const navigate = useWorkspaceAwareNavigate();
-
- return (
- <GroupBlock
- icon={<MCP color={cssVar.colorTextDescription} size={18} />}
- title={t('home.featuredPlugins')}
- action={
- <DropdownMenu
- items={[
- {
- key: 'all-plugins',
- label: t('home.more'),
- onClick: () => {
- navigate('/community/mcp');
- },
- },
- ]}
- >
- <ActionIcon icon={MoreHorizontal} size="small" />
- </DropdownMenu>
- }
- >
- <Grid gap={12} maxItemWidth={320} rows={4} width={'100%'}>
- <Suspense
- fallback={
- <GroupSkeleton
- height={RECENT_BLOCK_SIZE.PLUGIN.HEIGHT}
- rows={6}
- width={RECENT_BLOCK_SIZE.PLUGIN.WIDTH}
- />
- }
- >
- <FeaturedPluginsList />
- </Suspense>
- </Grid>
- </GroupBlock>
- );
-});
-
-export default FeaturedPlugins;
diff --git a/src/routes/(main)/home/features/InputArea/StarterList.tsx b/src/routes/(main)/home/features/InputArea/StarterList.tsx
deleted file mode 100644
index bd6bb4ed5f6..00000000000
--- a/src/routes/(main)/home/features/InputArea/StarterList.tsx
+++ /dev/null
@@ -1,181 +0,0 @@
-import { ModelIcon } from '@lobehub/icons';
-import { Center, Skeleton, Tag, Tooltip } from '@lobehub/ui';
-import { Button } from '@lobehub/ui/base-ui';
-import { App } from 'antd';
-import { createStaticStyles, cx } from 'antd-style';
-import { memo, useCallback, useState } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import {
- type BusinessModelModeConfig,
- useBusinessModelModeConfig,
-} from '@/business/client/hooks/useBusinessAgentMode';
-import type { HomeNewModelItem } from '@/business/client/hooks/useHomeNewModels';
-import { useHomeNewModels } from '@/business/client/hooks/useHomeNewModels';
-import { usePermission } from '@/hooks/usePermission';
-import { useStableNavigate } from '@/hooks/useStableNavigate';
-import { agentService } from '@/services/agent';
-import { useAgentStore } from '@/store/agent';
-import { agentByIdSelectors } from '@/store/agent/selectors';
-
-import { useResolvedHomeAgentId } from '../AgentSelect/useResolvedHomeAgentId';
-import { useStarterModelDefaults } from './useStarterModelDefaults';
-
-const styles = createStaticStyles(({ css, cssVar }) => ({
- button: css`
- height: 40px;
- border-color: ${cssVar.colorFillSecondary};
- background: transparent;
- box-shadow: none !important;
-
- &:hover {
- border-color: ${cssVar.colorFillSecondary} !important;
- background: ${cssVar.colorBgElevated} !important;
- }
- `,
- container: css`
- flex-wrap: wrap;
- `,
- newTag: css`
- padding-inline: 10px !important;
- border-radius: 999px !important;
- `,
-}));
-
-const getStarterItemKey = (item: HomeNewModelItem) => `${item.type}:${item.model}`;
-const getStarterItemProvider = (item: HomeNewModelItem, fallbackProvider: string) =>
- item.provider ?? fallbackProvider;
-const skeletonWidths = [112, 150, 126, 138];
-
-const StarterList = memo(() => {
- const { t } = useTranslation('home');
- const navigate = useStableNavigate();
- const { message } = App.useApp();
- const { agentId: activeAgentId } = useResolvedHomeAgentId();
- const { allowed: canCreateContent, reason } = usePermission('create_content');
- const updateAgentConfigById = useAgentStore((s) => s.updateAgentConfigById);
- const [switchingKey, setSwitchingKey] = useState<string | null>(null);
- const { defaultHomeNewModels, fallbackChatProvider } = useStarterModelDefaults();
- const { isLoading, items } = useHomeNewModels(defaultHomeNewModels);
- const applyBusinessModelModeConfig = useBusinessModelModeConfig();
-
- const handleClick = useCallback(
- async (item: HomeNewModelItem) => {
- if (!canCreateContent) return;
-
- const key = getStarterItemKey(item);
-
- if (item.type === 'video') {
- navigate(`/video?model=${item.model}`);
- return;
- }
-
- if (item.type === 'image') {
- navigate(`/image?model=${item.model}`);
- return;
- }
-
- if (item.type === 'chat') {
- if (!activeAgentId || switchingKey) return;
- setSwitchingKey(key);
- const provider = getStarterItemProvider(item, fallbackChatProvider);
- try {
- // Hydrate the agent's config before mutating so the optimistic update
- // doesn't drop pre-existing fields the home input never loaded.
- let agentState = useAgentStore.getState();
- if (!agentState.agentMap[activeAgentId]) {
- const config = await agentService.getAgentConfigById(activeAgentId);
- if (config) agentState.internal_dispatchAgentMap(activeAgentId, config);
- agentState = useAgentStore.getState();
- }
-
- const currentModel = agentByIdSelectors.getAgentModelById(activeAgentId)(agentState);
- const currentProvider =
- agentByIdSelectors.getAgentModelProviderById(activeAgentId)(agentState);
- const nextConfig: BusinessModelModeConfig = applyBusinessModelModeConfig({
- model: item.model,
- provider,
- });
- const shouldUpdateAgentMode =
- nextConfig.chatConfig?.enableAgentMode === false &&
- agentByIdSelectors.getAgentEnableModeById(activeAgentId)(agentState);
-
- if (
- currentModel === item.model &&
- currentProvider === provider &&
- !shouldUpdateAgentMode
- ) {
- message.info(t('starter.modelInUse', { name: item.title }));
- return;
- }
-
- await updateAgentConfigById(activeAgentId, nextConfig);
- message.success(t('starter.modelSwitched', { name: item.title }));
- } finally {
- setSwitchingKey(null);
- }
- return;
- }
- },
- [
- canCreateContent,
- navigate,
- activeAgentId,
- applyBusinessModelModeConfig,
- updateAgentConfigById,
- switchingKey,
- fallbackChatProvider,
- message,
- t,
- ],
- );
-
- return (
- <Center horizontal className={styles.container} gap={8}>
- <Tag className={styles.newTag} size={'small'}>
- {t('starter.newLabel')}
- </Tag>
- {isLoading
- ? defaultHomeNewModels.map((item, index) => (
- <Skeleton.Button
- active
- key={getStarterItemKey(item)}
- style={{
- borderRadius: 999,
- height: 40,
- width: skeletonWidths[index] ?? 126,
- }}
- />
- ))
- : items.map((item) => {
- const key = getStarterItemKey(item);
- const isSwitching = switchingKey === key;
- const button = (
- <Button
- className={cx(styles.button)}
- disabled={!canCreateContent || (!!switchingKey && !isSwitching)}
- icon={<ModelIcon model={item.iconModel ?? item.model} size={18} />}
- key={key}
- loading={isSwitching}
- shape={'round'}
- onClick={() => handleClick(item)}
- >
- {item.title}
- </Button>
- );
-
- if (!canCreateContent) {
- return (
- <Tooltip key={key} title={reason}>
- <div>{button}</div>
- </Tooltip>
- );
- }
-
- return button;
- })}
- </Center>
- );
-});
-
-export default StarterList;
diff --git a/src/routes/(main)/home/features/components/ScrollShadowWithButton/index.tsx b/src/routes/(main)/home/features/components/ScrollShadowWithButton/index.tsx
deleted file mode 100644
index ac78242b056..00000000000
--- a/src/routes/(main)/home/features/components/ScrollShadowWithButton/index.tsx
+++ /dev/null
@@ -1,117 +0,0 @@
-import { type FlexboxProps } from '@lobehub/ui';
-import { Flexbox, ScrollShadow } from '@lobehub/ui';
-import { Button } from '@lobehub/ui/base-ui';
-import { createStaticStyles, cx } from 'antd-style';
-import { ChevronLeft, ChevronRight } from 'lucide-react';
-import { memo, useCallback, useEffect, useRef, useState } from 'react';
-
-const styles = createStaticStyles(({ css, cssVar }) => ({
- button: css`
- position: absolute;
- z-index: 10;
- inset-block-start: 50%;
- transform: translateY(-50%);
-
- color: ${cssVar.colorTextSecondary};
-
- opacity: 0;
-
- transition: opacity ${cssVar.motionDurationMid} ${cssVar.motionEaseInOut};
-
- &:hover {
- border-color: ${cssVar.colorBorder} !important;
- box-shadow: ${cssVar.boxShadowTertiary} !important;
- }
- `,
- container: css`
- position: relative;
-
- &:hover .scroll-button {
- opacity: 1;
- }
- `,
- leftButton: css`
- inset-inline-start: 0;
- `,
- rightButton: css`
- inset-inline-end: 0;
- `,
-}));
-
-const ScrollShadowWithButton = memo<FlexboxProps>(({ children, ...rest }) => {
- const scrollRef = useRef<HTMLDivElement>(null);
- const [canScrollLeft, setCanScrollLeft] = useState(false);
- const [canScrollRight, setCanScrollRight] = useState(true);
-
- const checkScrollability = useCallback(() => {
- const container = scrollRef.current;
- if (!container) return;
-
- const { scrollLeft, scrollWidth, clientWidth } = container;
- setCanScrollLeft(scrollLeft > 0);
- setCanScrollRight(scrollLeft + clientWidth < scrollWidth - 1);
- }, []);
-
- const handleScroll = useCallback(
- (direction: 'left' | 'right') => {
- const container = scrollRef.current;
- if (!container) return;
-
- const scrollAmount = container.clientWidth / 1.5;
- const targetScroll =
- direction === 'left'
- ? container.scrollLeft - scrollAmount
- : container.scrollLeft + scrollAmount;
-
- container.scrollTo({
- behavior: 'smooth',
- left: targetScroll,
- });
-
- setTimeout(checkScrollability, 300);
- },
- [checkScrollability],
- );
-
- useEffect(() => {
- checkScrollability();
- }, []);
-
- return (
- <Flexbox horizontal className={styles.container} width={'100%'} {...rest}>
- {canScrollLeft && (
- <Button
- className={cx(styles.button, styles.leftButton, 'scroll-button')}
- icon={ChevronLeft}
- shape={'circle'}
- type={'default'}
- onClick={() => handleScroll('left')}
- />
- )}
- <ScrollShadow
- hideScrollBar
- offset={16}
- orientation={'horizontal'}
- ref={scrollRef}
- size={16}
- onScroll={checkScrollability}
- onScrollCapture={checkScrollability}
- >
- <Flexbox horizontal gap={12}>
- {children}
- </Flexbox>
- </ScrollShadow>
- {canScrollRight && (
- <Button
- className={cx(styles.button, styles.rightButton, 'scroll-button')}
- icon={ChevronRight}
- shape={'circle'}
- type={'default'}
- onClick={() => handleScroll('right')}
- />
- )}
- </Flexbox>
- );
-});
-
-export default ScrollShadowWithButton;
diff --git a/src/routes/(main)/resource/(home)/_layout/Body/LibraryList/EmptyStatus.tsx b/src/routes/(main)/resource/(home)/_layout/Body/LibraryList/EmptyStatus.tsx
deleted file mode 100644
index b7c19ede0ba..00000000000
--- a/src/routes/(main)/resource/(home)/_layout/Body/LibraryList/EmptyStatus.tsx
+++ /dev/null
@@ -1,60 +0,0 @@
-import { type IconType } from '@lobehub/icons';
-import { Flexbox } from '@lobehub/ui';
-import { createStaticStyles } from 'antd-style';
-import { memo } from 'react';
-import { Trans } from 'react-i18next';
-
-const styles = createStaticStyles(({ css, cssVar }) => ({
- container: css`
- font-size: 12px;
- color: ${cssVar.colorTextTertiary};
- `,
-
- paragraph: css`
- justify-content: center;
- width: 100%;
-
- kbd {
- margin-inline: 2px;
- padding-inline: 6px;
- border-radius: 4px;
- background: ${cssVar.colorFillTertiary};
- }
- `,
-}));
-
-const LineIcon: IconType = (({ ref, size = 130, style, ...rest }) => (
- <svg
- fill="currentColor"
- fillRule="evenodd"
- ref={ref}
- style={{ flex: 'none', lineHeight: 1, ...style }}
- viewBox="0 0 126 64"
- width={size}
- xmlns="http://www.w3.org/2000/svg"
- {...rest}
- >
- <path d="M.5 63a.5.5 0 001 0h-1zM122 1l-2.887 5h5.774L122 1zM1.5 62.042a.5.5 0 10-1 0h1zm-1-1.917a.5.5 0 001 0h-1zm1-1.917a.5.5 0 00-1 0h1zm-1-1.916a.5.5 0 001 0h-1zm1-1.917a.5.5 0 00-1 0h1zm-1-1.917a.5.5 0 101 0h-1zm1-1.916a.5.5 0 10-1 0h1zm-1-1.917a.5.5 0 001 0h-1zm1-1.917a.5.5 0 00-1 0h1zm-1-1.916a.5.5 0 001 0h-1zm1-1.917a.5.5 0 00-1 0h1zm-1-1.917a.5.5 0 101 0h-1zm1.063-1.938a.5.5 0 10-.991-.13l.991.13zm-.418-2.274a.5.5 0 00.924.383l-.924-.383zm1.904-1.312a.5.5 0 10-.793-.609l.793.61zm.776-2.178a.5.5 0 00.61.793l-.61-.793zm2.304-.187a.5.5 0 00-.383-.924l.383.924zm1.761-1.497a.5.5 0 00.13.991l-.13-.991zm2.12.928a.5.5 0 100-1v1zm2.019-1a.5.5 0 000 1v-1zm2.02 1a.5.5 0 000-1v1zm2.018-1a.5.5 0 000 1v-1zm2.02 1a.5.5 0 100-1v1zm2.019-1a.5.5 0 100 1v-1zm2.019 1a.5.5 0 000-1v1zm2.02-1a.5.5 0 000 1v-1zm2.018 1a.5.5 0 000-1v1zm2.02-1a.5.5 0 000 1v-1zm2.019 1a.5.5 0 100-1v1zm2.02-1a.5.5 0 100 1v-1zm2.018 1a.5.5 0 000-1v1zm2.02-1a.5.5 0 000 1v-1zm2.019 1a.5.5 0 100-1v1zm2.02-1a.5.5 0 100 1v-1zm2.018 1a.5.5 0 000-1v1zm2.02-1a.5.5 0 000 1v-1zm2.019 1a.5.5 0 000-1v1zm2.019-1a.5.5 0 000 1v-1zm2.02 1a.5.5 0 100-1v1zm2.018-1a.5.5 0 100 1v-1zm2.02 1a.5.5 0 000-1v1zm2.019-1a.5.5 0 000 1v-1zm2.02 1a.5.5 0 100-1v1zm2.018-1a.5.5 0 100 1v-1zm2.02 1a.5.5 0 000-1v1zm2.019-1a.5.5 0 000 1v-1zm2.02 1a.5.5 0 000-1v1zm2.018-1a.5.5 0 000 1v-1zm2.02 1a.5.5 0 100-1v1zm2.019-1a.5.5 0 100 1v-1zm2.019 1a.5.5 0 000-1v1zm2.02-1a.5.5 0 000 1v-1zm2.019 1a.5.5 0 000-1v1zm2.019-1a.5.5 0 100 1v-1zm2.019 1a.5.5 0 100-1v1zm2.02-1a.5.5 0 100 1v-1zm2.018 1a.5.5 0 000-1v1zm2.02-1a.5.5 0 000 1v-1zm2.019 1a.5.5 0 000-1v1zm2.02-1a.5.5 0 100 1v-1zm2.018 1a.5.5 0 100-1v1zm2.02-1a.5.5 0 100 1v-1zm2.019 1a.5.5 0 000-1v1zm2.019-1a.5.5 0 000 1v-1zm2.019 1a.5.5 0 000-1v1zm2.019-1a.5.5 0 000 1v-1zm2.02 1a.5.5 0 000-1v1zm2.019-1a.5.5 0 000 1v-1zm2.019 1a.5.5 0 000-1v1zm2.019-1a.5.5 0 000 1v-1zm2.12.928a.501.501 0 00-.13-.991l.13.991zm1.761-1.497a.501.501 0 00.383.924l-.383-.924zm2.304-.187a.5.5 0 00-.609-.793l.609.793zm.776-2.178a.5.5 0 10.793.609l-.793-.61zm1.904-1.312a.5.5 0 10-.924-.383l.924.383zm-.418-2.274a.5.5 0 10.991.13l-.991-.13zm1.063-1.938a.5.5 0 00-1 0h1zm-1-1.917a.5.5 0 001 0h-1zm1-1.917a.5.5 0 00-1 0h1zm-1-1.916a.5.5 0 001 0h-1zm1-1.917a.5.5 0 00-1 0h1zm-1-1.917a.5.5 0 001 0h-1zm1-1.916a.5.5 0 00-1 0h1zm-1-1.917a.5.5 0 001 0h-1zm1-1.917a.5.5 0 00-1 0h1zm-1-1.916a.5.5 0 001 0h-1zm1-1.917a.5.5 0 00-1 0h1zm-1-1.917a.5.5 0 001 0h-1zM1.5 63v-.958h-1V63h1zm0-2.875v-1.917h-1v1.917h1zm0-3.833v-1.917h-1v1.917h1zm0-3.834v-1.916h-1v1.916h1zm0-3.833v-1.917h-1v1.917h1zm0-3.833v-1.917h-1v1.917h1zm0-3.834V40h-1v.958h1zm0-.958c0-.333.022-.66.063-.98l-.991-.13A8.574 8.574 0 00.5 40h1zm.569-2.87c.253-.61.584-1.18.98-1.696l-.793-.609a8.49 8.49 0 00-1.11 1.921l.923.383zm2.365-3.08a7.487 7.487 0 011.695-.981l-.383-.924a8.495 8.495 0 00-1.92 1.111l.608.793zm3.586-1.487c.32-.041.648-.063.98-.063v-1c-.376 0-.746.024-1.11.072l.13.991zM9 32.5h1.01v-1H9v1zm3.029 0h2.02v-1h-2.02v1zm4.038 0h2.02v-1h-2.02v1zm4.039 0h2.019v-1h-2.02v1zm4.038 0h2.02v-1h-2.02v1zm4.039 0h2.019v-1h-2.02v1zm4.038 0h2.02v-1h-2.02v1zm4.039 0h2.019v-1h-2.02v1zm4.038 0h2.02v-1h-2.02v1zm4.038 0h2.02v-1h-2.02v1zm4.039 0h2.02v-1h-2.02v1zm4.038 0h2.02v-1h-2.02v1zm4.039 0h2.02v-1h-2.02v1zm4.038 0h2.02v-1h-2.02v1zm4.039 0h2.02v-1h-2.02v1zm4.038 0h2.02v-1h-2.02v1zm4.039 0h2.019v-1h-2.02v1zm4.038 0h2.02v-1h-2.02v1zm4.039 0h2.019v-1h-2.02v1zm4.038 0h2.02v-1h-2.02v1zm4.039 0h2.019v-1h-2.02v1zm4.038 0h2.02v-1h-2.02v1zm4.039 0h2.019v-1h-2.02v1zm4.038 0h2.019v-1h-2.019v1zm4.038 0h2.02v-1h-2.02v1zm4.039 0h2.019v-1h-2.019v1zm4.038 0H114v-1h-1.01v1zm1.01 0c.376 0 .746-.024 1.11-.072l-.13-.991c-.32.041-.648.063-.98.063v1zm3.254-.645a8.506 8.506 0 001.921-1.111l-.609-.793a7.519 7.519 0 01-1.695.98l.383.924zm3.49-2.68a8.516 8.516 0 001.111-1.921l-.924-.383a7.527 7.527 0 01-.98 1.695l.793.609zm1.684-4.066c.048-.363.072-.733.072-1.109h-1c0 .332-.022.66-.063.98l.991.13zM122.5 24v-.958h-1V24h1zm0-2.875v-1.917h-1v1.917h1zm0-3.833v-1.917h-1v1.917h1zm0-3.834v-1.916h-1v1.916h1zm0-3.833V7.708h-1v1.917h1zm0-3.833V3.875h-1v1.917h1z" />
- </svg>
-)) as IconType;
-
-const EmptyStatus = memo(() => {
- return (
- <Flexbox
- align={'flex-end'}
- className={styles.container}
- gap={12}
- paddingInline={20}
- width={'100%'}
- >
- <LineIcon />
- <Flexbox horizontal align={'center'} className={styles.paragraph}>
- <Trans i18nKey={'library.list.empty'} ns={'file'}>
- 点击 <kbd>+</kbd> 开始创建资源库
- </Trans>
- </Flexbox>
- </Flexbox>
- );
-});
-
-export default EmptyStatus;
diff --git a/src/routes/(main)/resource/features/modal/ModalPageClient.tsx b/src/routes/(main)/resource/features/modal/ModalPageClient.tsx
deleted file mode 100644
index 038198bf2e2..00000000000
--- a/src/routes/(main)/resource/features/modal/ModalPageClient.tsx
+++ /dev/null
@@ -1,33 +0,0 @@
-'use client';
-
-import { useCallback } from 'react';
-
-import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';
-
-import FileDetail from './FileDetail';
-import FilePreview from './FilePreview';
-import FullscreenModal from './FullscreenModal';
-
-interface ModalPageClientProps {
- id: string;
-}
-
-const ModalPageClient = ({ id }: ModalPageClientProps) => {
- const navigate = useWorkspaceAwareNavigate();
- const handleClose = useCallback(() => {
- if (typeof window === 'undefined') return;
-
- const { pathname, search } = window.location;
- const basePath = pathname.replace(/\/modal\/?$/, '');
-
- navigate(`${basePath || '/'}${search}`, { replace: true });
- }, [navigate]);
-
- return (
- <FullscreenModal detail={<FileDetail id={id} />} onClose={handleClose}>
- <FilePreview id={id} />
- </FullscreenModal>
- );
-};
-
-export default ModalPageClient;
diff --git a/src/routes/(main)/resource/library/features/LibraryMenu.tsx b/src/routes/(main)/resource/library/features/LibraryMenu.tsx
deleted file mode 100644
index 0d8767179a8..00000000000
--- a/src/routes/(main)/resource/library/features/LibraryMenu.tsx
+++ /dev/null
@@ -1,23 +0,0 @@
-'use client';
-
-import { Flexbox } from '@lobehub/ui';
-import { memo } from 'react';
-
-import LibraryHierarchy from '@/features/ResourceManager/components/LibraryHierarchy';
-
-import Head from '../_layout/Header/LibraryHead';
-
-const Menu = memo<{ id: string }>(({ id }) => {
- return (
- <Flexbox gap={16} height={'100%'} style={{ paddingTop: 12 }}>
- <Flexbox paddingInline={12}>
- <Head id={id} />
- </Flexbox>
- <LibraryHierarchy />
- </Flexbox>
- );
-});
-
-Menu.displayName = 'Menu';
-
-export default Menu;
diff --git a/src/routes/(main)/settings/agent/index.tsx b/src/routes/(main)/settings/agent/index.tsx
deleted file mode 100644
index 3443bb7ccd3..00000000000
--- a/src/routes/(main)/settings/agent/index.tsx
+++ /dev/null
@@ -1,26 +0,0 @@
-'use client';
-
-import { useTranslation } from 'react-i18next';
-
-import SettingHeader from '@/routes/(main)/settings/features/SettingHeader';
-
-import SystemAgentForm from './features/SystemAgentForm';
-
-const Page = () => {
- const { t } = useTranslation('setting');
- return (
- <>
- <SettingHeader title={t('tab.agent')} />
- <SystemAgentForm systemAgentKey="topic" />
- <SystemAgentForm systemAgentKey="generationTopic" />
- <SystemAgentForm systemAgentKey="translation" />
- <SystemAgentForm systemAgentKey="historyCompress" />
- <SystemAgentForm systemAgentKey="agentMeta" />
- <SystemAgentForm allowDisable systemAgentKey="followUpAction" />
- <SystemAgentForm allowDisable systemAgentKey="inputCompletion" />
- <SystemAgentForm allowDisable systemAgentKey="promptRewrite" />
- </>
- );
-};
-
-export default Page;
diff --git a/src/routes/(main)/settings/chat-appearance/index.tsx b/src/routes/(main)/settings/chat-appearance/index.tsx
deleted file mode 100644
index 67ef8286260..00000000000
--- a/src/routes/(main)/settings/chat-appearance/index.tsx
+++ /dev/null
@@ -1,18 +0,0 @@
-import { useTranslation } from 'react-i18next';
-
-import SettingHeader from '@/routes/(main)/settings/features/SettingHeader';
-
-import ChatAppearance from './features/ChatAppearance';
-
-const Page = () => {
- const { t } = useTranslation('setting');
-
- return (
- <>
- <SettingHeader title={t('tab.chatAppearance')} />
- <ChatAppearance />
- </>
- );
-};
-
-export default Page;
diff --git a/src/routes/(main)/settings/common/index.tsx b/src/routes/(main)/settings/common/index.tsx
deleted file mode 100644
index 28884f0bf91..00000000000
--- a/src/routes/(main)/settings/common/index.tsx
+++ /dev/null
@@ -1,19 +0,0 @@
-import { useTranslation } from 'react-i18next';
-
-import SettingHeader from '@/routes/(main)/settings/features/SettingHeader';
-
-import Appearance from './features/Appearance';
-import Common from './features/Common/Common';
-
-const Page = () => {
- const { t } = useTranslation('setting');
- return (
- <>
- <SettingHeader title={t('tab.common')} />
- <Common />
- <Appearance />
- </>
- );
-};
-
-export default Page;
diff --git a/src/routes/(main)/settings/features/UpgradeAlert.tsx b/src/routes/(main)/settings/features/UpgradeAlert.tsx
deleted file mode 100644
index 91a2a8eaa83..00000000000
--- a/src/routes/(main)/settings/features/UpgradeAlert.tsx
+++ /dev/null
@@ -1,41 +0,0 @@
-'use client';
-
-import { Alert, Flexbox } from '@lobehub/ui';
-import { Button } from '@lobehub/ui/base-ui';
-import { memo } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import { MANUAL_UPGRADE_URL } from '@/const/url';
-import { useGlobalStore } from '@/store/global';
-
-const UpgradeAlert = memo(() => {
- const [hasNewVersion, latestVersion] = useGlobalStore((s) => [s.hasNewVersion, s.latestVersion]);
- const { t } = useTranslation('common');
-
- if (!hasNewVersion) return;
-
- return (
- <Alert
- closable
- type={'info'}
- title={
- <Flexbox gap={8}>
- <p>{t('upgradeVersion.newVersion', { version: `v${latestVersion}` })}</p>
- <a
- aria-label={t('upgradeVersion.action')}
- href={MANUAL_UPGRADE_URL}
- rel="noreferrer"
- style={{ marginBottom: 6 }}
- target="_blank"
- >
- <Button block size={'small'} type={'primary'}>
- {t('upgradeVersion.action')}
- </Button>
- </a>
- </Flexbox>
- }
- />
- );
-});
-
-export default UpgradeAlert;
diff --git a/src/routes/(main)/settings/image/index.tsx b/src/routes/(main)/settings/image/index.tsx
deleted file mode 100644
index 7ab0c50c7b9..00000000000
--- a/src/routes/(main)/settings/image/index.tsx
+++ /dev/null
@@ -1,17 +0,0 @@
-import { useTranslation } from 'react-i18next';
-
-import SettingHeader from '@/routes/(main)/settings/features/SettingHeader';
-
-import Image from './features/Image';
-
-const Page = () => {
- const { t } = useTranslation('setting');
- return (
- <>
- <SettingHeader title={t('tab.image')} />
- <Image />
- </>
- );
-};
-
-export default Page;
diff --git a/src/routes/(main)/settings/tts/index.tsx b/src/routes/(main)/settings/tts/index.tsx
deleted file mode 100644
index 252ed1e7bdf..00000000000
--- a/src/routes/(main)/settings/tts/index.tsx
+++ /dev/null
@@ -1,17 +0,0 @@
-import { useTranslation } from 'react-i18next';
-
-import SettingHeader from '@/routes/(main)/settings/features/SettingHeader';
-
-import OpenAI from './features/OpenAI';
-
-const Page = () => {
- const { t } = useTranslation('setting');
- return (
- <>
- <SettingHeader title={t('tab.tts')} />
- <OpenAI />
- </>
- );
-};
-
-export default Page;
diff --git a/src/routes/(mobile)/chat/features/Topic/features/AgentConfig/index.tsx b/src/routes/(mobile)/chat/features/Topic/features/AgentConfig/index.tsx
deleted file mode 100644
index 451c08ecdb5..00000000000
--- a/src/routes/(mobile)/chat/features/Topic/features/AgentConfig/index.tsx
+++ /dev/null
@@ -1,85 +0,0 @@
-'use client';
-
-import { ActionIcon } from '@lobehub/ui';
-import { Edit } from 'lucide-react';
-import { type MouseEvent } from 'react';
-import { memo, useState } from 'react';
-import { useTranslation } from 'react-i18next';
-import useMergeState from 'use-merge-value';
-
-import { usePermission } from '@/hooks/usePermission';
-import { useAgentStore } from '@/store/agent';
-import { agentSelectors } from '@/store/agent/selectors';
-import { useGlobalStore } from '@/store/global';
-import { systemStatusSelectors } from '@/store/global/selectors';
-import { useSessionStore } from '@/store/session';
-import { sessionSelectors } from '@/store/session/selectors';
-
-import ConfigLayout from '../ConfigLayout';
-import Header from './Header';
-import SystemRole from './SystemRole';
-
-const AgentConfig = memo(() => {
- const [editing, setEditing] = useState(false);
-
- const [init, sessionId] = useSessionStore((s) => [
- sessionSelectors.isSomeSessionActive(s),
- s.activeId,
- ]);
-
- const [isAgentConfigLoading] = useAgentStore((s) => [agentSelectors.isAgentConfigLoading(s)]);
-
- const [showSystemRole, toggleSystemRole] = useGlobalStore((s) => [
- systemStatusSelectors.showSystemRole(s),
- s.toggleSystemRole,
- ]);
-
- const [open, setOpen] = useMergeState(false, {
- defaultValue: showSystemRole,
- onChange: toggleSystemRole,
- value: showSystemRole,
- });
-
- const { t } = useTranslation('common');
- const { allowed: canEdit } = usePermission('edit_own_content');
-
- const isLoading = !init || isAgentConfigLoading;
-
- const handleOpenWithEdit = (e: MouseEvent) => {
- if (!canEdit || isLoading) return;
-
- e.stopPropagation();
- setEditing(true);
- setOpen(true);
- };
-
- return (
- <ConfigLayout
- expandedHeight={200}
- headerStyle={{ cursor: 'pointer' }}
- sessionId={sessionId}
- title={<Header />}
- actions={
- <ActionIcon
- disabled={!canEdit}
- icon={Edit}
- size={'small'}
- title={t('edit')}
- onClick={handleOpenWithEdit}
- />
- }
- >
- <SystemRole
- editing={editing}
- isLoading={isLoading}
- open={open}
- setEditing={setEditing}
- setOpen={setOpen}
- />
- </ConfigLayout>
- );
-});
-
-AgentConfig.displayName = 'AgentConfig';
-
-export default AgentConfig;
diff --git a/src/routes/(mobile)/chat/settings/_layout/index.tsx b/src/routes/(mobile)/chat/settings/_layout/index.tsx
deleted file mode 100644
index 19bac54dff3..00000000000
--- a/src/routes/(mobile)/chat/settings/_layout/index.tsx
+++ /dev/null
@@ -1,17 +0,0 @@
-'use client';
-
-import { type PropsWithChildren } from 'react';
-
-import MobileContentLayout from '@/components/server/MobileNavLayout';
-import Footer from '@/features/Setting/Footer';
-
-import Header from './Header';
-
-const Layout = ({ children }: PropsWithChildren) => (
- <MobileContentLayout header={<Header />}>
- {children}
- <Footer />
- </MobileContentLayout>
-);
-
-export default Layout;
diff --git a/src/routes/(mobile)/chat/settings/features/AgentInfoDescription/index.tsx b/src/routes/(mobile)/chat/settings/features/AgentInfoDescription/index.tsx
deleted file mode 100644
index 76cf100f39d..00000000000
--- a/src/routes/(mobile)/chat/settings/features/AgentInfoDescription/index.tsx
+++ /dev/null
@@ -1,333 +0,0 @@
-'use client';
-
-import { ProDescriptions } from '@ant-design/pro-components';
-import { type AgentItemDetail } from '@lobehub/market-sdk';
-import { Flexbox, Tag } from '@lobehub/ui';
-import { memo } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import Tokens from '@/features/AgentSetting/AgentPrompt/TokenTag';
-import Image from '@/libs/next/Image';
-
-interface AgentConfig {
- params?: {
- max_tokens?: number;
- temperature?: number;
- top_p?: number;
- };
-}
-
-interface ChatConfig {
- enableHistoryCount?: boolean;
- historyCount?: number;
- searchMode?: string;
-}
-
-interface AgentInfoDescriptionProps {
- agentConfig?: AgentConfig;
- chatConfig?: ChatConfig;
- files?: Array<{
- enabled?: boolean;
- id: string;
- name: string;
- type: string;
- }>;
- isRemote?: boolean;
- knowledgeBases?: Array<{
- enabled?: boolean;
- id: string;
- name: string;
- }>;
- meta?: Partial<AgentItemDetail> & {
- description?: string;
- name?: string;
- title?: string;
- };
- model?: string;
- plugins?: string[];
- provider?: string;
- systemRole?: string;
-}
-
-const AgentInfoDescription = memo<AgentInfoDescriptionProps>(
- ({
- agentConfig,
- chatConfig,
- files = [],
- isRemote = false,
- knowledgeBases = [],
- meta,
- model,
- plugins = [],
- provider,
- systemRole,
- }) => {
- const { t } = useTranslation('setting');
- // Convert remote data format
- const getProcessedData = () => {
- if (!isRemote || !meta) {
- return {
- agentConfig,
- chatConfig,
- files,
- knowledgeBases,
- meta,
- model,
- plugins,
- provider,
- systemRole,
- };
- }
-
- // Remote data format conversion
- const remoteData = meta;
- const config = remoteData.config || {};
-
- return {
- agentConfig: {
- params: config.model?.parameters || {},
- },
- chatConfig: config.chatConfig || {},
- files: config.files || [],
- knowledgeBases: config.knowledgeBases || [],
- meta: {
- avatar: remoteData?.avatar,
- description: remoteData?.description,
- name: remoteData?.versionName,
- tags: remoteData?.tags ? [remoteData.tags] : undefined,
- title: remoteData?.name,
- },
- model: config.model?.model,
- plugins: config.plugins?.map((p: any) => (typeof p === 'string' ? p : p.identifier)) || [],
- provider: config.model?.provider,
- systemRole: config.systemRole,
- };
- };
-
- const {
- agentConfig: processedAgentConfig,
- chatConfig: processedChatConfig,
- meta: processedMeta,
- model: processedModel,
- plugins: processedPlugins,
- provider: processedProvider,
- systemRole: processedSystemRole,
- } = getProcessedData();
- const unsetText = t('agentInfoDescription.value.unset');
-
- const unnamedText = t('agentInfoDescription.value.untitled');
- const pluginEmptyText = t('agentInfoDescription.plugins.empty');
- const renderAvatar = (avatar: string | undefined) => {
- if (!avatar) return unsetText;
-
- // If it's an http or https link, display the image
- if (avatar.startsWith('http://') || avatar.startsWith('https://')) {
- return (
- <Image alt="avatar" height={40} src={avatar} style={{ borderRadius: '50%' }} width={40} />
- );
- }
-
- // Otherwise, display the character directly (emoji)
- return (
- <div
- style={{
- fontSize: '24px',
- height: 40,
- lineHeight: '40px',
- textAlign: 'center',
- width: 40,
- }}
- >
- {avatar}
- </div>
- );
- };
-
- return (
- <div style={{ height: '500px', overflow: 'auto' }}>
- <Flexbox gap={16}>
- {/* Basic information */}
- <ProDescriptions
- bordered
- column={2}
- size="small"
- title={t('agentInfoDescription.basic.title')}
- columns={[
- {
- dataIndex: 'title',
- key: 'title',
- title: t('agentInfoDescription.basic.name'),
- },
- {
- dataIndex: 'avatar',
- key: 'avatar',
- render: (_: any, record: any) => renderAvatar(record.avatar),
- title: t('agentInfoDescription.basic.avatar'),
- },
- {
- dataIndex: 'description',
- key: 'description',
- span: 2,
- title: t('agentInfoDescription.basic.description'),
- },
- {
- dataIndex: 'tags',
- key: 'tags',
- render: (_: any, record: any) => {
- const tags = record.tags;
- if (!tags || !tags.length) return unsetText;
- return tags.map((tag: string, index: number) => (
- <Tag color="blue" key={index}>
- {tag}
- </Tag>
- ));
- },
- span: 2,
- title: t('agentInfoDescription.basic.tags'),
- },
- ]}
- dataSource={{
- avatar: processedMeta?.avatar || unsetText,
- description: processedMeta?.description || unsetText,
- tags: processedMeta?.tags?.length ? processedMeta.tags : undefined,
- title: processedMeta?.title || processedMeta?.name || unnamedText,
- }}
- />
-
- {/* Role settings */}
- <ProDescriptions
- bordered
- column={1}
- size="small"
- columns={[
- {
- dataIndex: 'systemRole',
- key: 'systemRole',
- render: (_: any, record: any) => {
- const text = record.systemRole;
- if (text === unsetText) return text;
- return text;
- },
- title: t('agentInfoDescription.role.systemRole'),
- },
- ]}
- dataSource={{
- systemRole: processedSystemRole || unsetText,
- }}
- title={
- <Flexbox horizontal align={'center'} gap={8}>
- <span>{t('agentInfoDescription.role.title')}</span>
- <Tokens style={{ marginTop: 0 }} value={processedSystemRole || ''} />
- </Flexbox>
- }
- />
-
- {/* Model settings */}
- <ProDescriptions
- bordered
- column={2}
- size="small"
- title={t('agentInfoDescription.model.title')}
- columns={[
- {
- dataIndex: 'model',
- key: 'model',
- title: t('agentInfoDescription.model.model'),
- },
- {
- dataIndex: 'provider',
- key: 'provider',
- title: t('agentInfoDescription.model.provider'),
- },
- {
- dataIndex: 'temperature',
- key: 'temperature',
- title: t('agentInfoDescription.model.temperature'),
- },
- {
- dataIndex: 'topP',
- key: 'topP',
- title: 'Top P',
- },
- {
- dataIndex: 'maxTokens',
- key: 'maxTokens',
- span: 2,
- title: t('agentInfoDescription.model.maxTokens'),
- },
- ]}
- dataSource={{
- maxTokens: processedAgentConfig?.params?.max_tokens ?? unsetText,
- model: processedModel || unsetText,
- provider: processedProvider || unsetText,
- temperature: processedAgentConfig?.params?.temperature ?? unsetText,
- topP: processedAgentConfig?.params?.top_p ?? unsetText,
- }}
- />
-
- {/* Chat preferences */}
- <ProDescriptions
- bordered
- column={2}
- size="small"
- title={t('agentInfoDescription.chat.title')}
- columns={[
- {
- dataIndex: 'historyCount',
- key: 'historyCount',
- title: t('agentInfoDescription.chat.historyCount'),
- },
- {
- dataIndex: 'enableHistoryCount',
- key: 'enableHistoryCount',
- title: t('agentInfoDescription.chat.enableHistoryCount'),
- },
- {
- dataIndex: 'searchMode',
- key: 'searchMode',
- title: t('agentInfoDescription.chat.searchMode'),
- },
- ]}
- dataSource={{
- enableHistoryCount: processedChatConfig?.enableHistoryCount
- ? t('agentInfoDescription.chat.yes')
- : t('agentInfoDescription.chat.no'),
- historyCount: processedChatConfig?.historyCount ?? unsetText,
- searchMode: processedChatConfig?.searchMode || unsetText,
- }}
- />
-
- <ProDescriptions
- bordered
- column={1}
- size="small"
- columns={[
- {
- dataIndex: 'plugins',
- key: 'plugins',
- render: (_: any, record: any) => {
- const pluginList = record.plugins;
- if (!pluginList?.length) return pluginEmptyText;
- return pluginList.map((plugin: string, index: number) => (
- <Tag color="green" key={index}>
- {plugin}
- </Tag>
- ));
- },
- title: t('agentInfoDescription.plugins.title'),
- },
- ]}
- dataSource={{
- plugins: processedPlugins?.length ? processedPlugins : [],
- }}
- title={t('agentInfoDescription.plugins.count', {
- count: processedPlugins?.length || 0,
- })}
- />
- </Flexbox>
- </div>
- );
- },
-);
-
-export default AgentInfoDescription;
diff --git a/src/routes/(mobile)/chat/settings/features/SettingButton.tsx b/src/routes/(mobile)/chat/settings/features/SettingButton.tsx
deleted file mode 100644
index 922f0cef1ed..00000000000
--- a/src/routes/(mobile)/chat/settings/features/SettingButton.tsx
+++ /dev/null
@@ -1,45 +0,0 @@
-'use client';
-
-import { HotkeyEnum } from '@lobechat/const/hotkeys';
-import { ActionIcon } from '@lobehub/ui';
-import { AlignJustify } from 'lucide-react';
-import { memo } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import { DESKTOP_HEADER_ICON_SIZE, MOBILE_HEADER_ICON_SIZE } from '@/const/layoutTokens';
-import { useOpenChatSettings } from '@/hooks/useInterceptingRoutes';
-import dynamic from '@/libs/next/dynamic';
-import { useSessionStore } from '@/store/session';
-import { useUserStore } from '@/store/user';
-import { settingsSelectors } from '@/store/user/selectors';
-
-const AgentSettingsEditor = dynamic(() => import('@/routes/(main)/agent/profile'), {
- ssr: false,
-});
-
-const SettingButton = memo<{ mobile?: boolean }>(({ mobile }) => {
- const hotkey = useUserStore(settingsSelectors.getHotkeyById(HotkeyEnum.OpenChatSettings));
- const { t } = useTranslation('common');
- const id = useSessionStore((s) => s.activeId);
-
- const openChatSettings = useOpenChatSettings();
-
- return (
- <>
- <ActionIcon
- icon={AlignJustify}
- size={mobile ? MOBILE_HEADER_ICON_SIZE : DESKTOP_HEADER_ICON_SIZE}
- title={t('openChatSettings.title', { ns: 'hotkey' })}
- tooltipProps={{
- hotkey,
- placement: 'bottom',
- }}
- onClick={() => openChatSettings()}
- />
-
- <AgentSettingsEditor key={id} />
- </>
- );
-});
-
-export default SettingButton;
diff --git a/src/routes/onboarding/features/ModeSelectionStep.tsx b/src/routes/onboarding/features/ModeSelectionStep.tsx
deleted file mode 100644
index 80143d0b4e3..00000000000
--- a/src/routes/onboarding/features/ModeSelectionStep.tsx
+++ /dev/null
@@ -1,188 +0,0 @@
-'use client';
-
-import { Block, Flexbox, Text } from '@lobehub/ui';
-import { Button } from '@lobehub/ui/base-ui';
-import { createStaticStyles, cssVar, cx } from 'antd-style';
-import { Undo2Icon } from 'lucide-react';
-import React, { memo, useMemo } from 'react';
-import { useTranslation } from 'react-i18next';
-
-import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';
-import { useIsDark } from '@/hooks/useIsDark';
-import LobeMessage from '@/routes/onboarding/components/LobeMessage';
-import { useUserStore } from '@/store/user';
-import { isDev } from '@/utils/env';
-import { consumeOnboardingCallbackUrl } from '@/utils/onboardingRedirect';
-
-const styles = createStaticStyles(({ css, cssVar }) => ({
- base: css`
- position: relative;
- padding-inline-end: 160px;
- transition: all 0.25s ease-in-out;
-
- &::before {
- content: '';
-
- position: absolute;
- z-index: 0;
- inset: 0;
-
- width: 100%;
- height: 100%;
-
- opacity: 0.5;
- background-repeat: no-repeat;
- background-position: 100% 100%;
- background-size: auto 120px;
-
- transition: all 0.25s ease-in-out;
- }
-
- &:hover {
- border-inline-end-width: 3px;
-
- &::before {
- opacity: 1;
- }
- }
- `,
- disabled: css`
- transform: scale(1) !important;
- opacity: 1 !important;
- `,
- lite: css`
- &:hover {
- border-inline-end-color: ${cssVar.purple};
- }
-
- &::before {
- z-index: 0;
- background-image: var(--lite-img);
- }
- `,
- pro: css`
- &:hover {
- border-inline-end-color: ${cssVar.gold};
- }
-
- &::before {
- z-index: 0;
- background-image: var(--pro-img);
- }
- `,
-}));
-
-interface ModeSelectionStepProps {
- onBack: () => void;
- onNext: () => void;
-}
-
-const ModeSelectionStep = memo<ModeSelectionStepProps>(({ onBack, onNext }) => {
- const { t } = useTranslation('onboarding');
- const navigate = useWorkspaceAwareNavigate();
- const isDarkMode = useIsDark();
-
- const imageStyles = useMemo<React.CSSProperties>(
- () =>
- ({
- '--lite-img': `url('${isDarkMode ? '/images/mode_lite_dark.webp' : '/images/mode_lite_light.webp'}')`,
- '--pro-img': `url('${isDarkMode ? '/images/mode_pro_dark.webp' : '/images/mode_pro_light.webp'}')`,
- }) as React.CSSProperties,
- [isDarkMode],
- );
-
- const [updateGeneralConfig, finishOnboarding] = useUserStore((s) => [
- s.updateGeneralConfig,
- s.finishOnboarding,
- ]);
-
- const handleSelectLite = () => {
- updateGeneralConfig({ isLiteMode: true });
- finishOnboarding();
-
- if (!isDev) {
- navigate(consumeOnboardingCallbackUrl() || '/');
- }
- };
-
- const handleSelectPro = () => {
- updateGeneralConfig({ isLiteMode: false });
- onNext();
- };
-
- return (
- <Flexbox>
- <LobeMessage
- sentences={[t('modeSelection.title'), t('modeSelection.title2'), t('modeSelection.title3')]}
- />
- <Text type={'secondary'}>{t('modeSelection.hint')}</Text>
- <Flexbox gap={16} paddingBlock={24}>
- {/* Lite Mode Option */}
- <Block
- clickable
- className={cx(styles.base, styles.lite)}
- padding={16}
- style={imageStyles}
- variant={'outlined'}
- onClick={handleSelectLite}
- >
- <Flexbox
- gap={8}
- style={{
- zIndex: 10,
- }}
- >
- <Text strong as={'h2'} fontSize={18}>
- {t('modeSelection.lite.title')}
- </Text>
- <Text as={'p'}>{t('modeSelection.lite.subtitle')}</Text>
- <Text as={'p'} type={'secondary'}>
- {t('modeSelection.lite.desc')}
- </Text>
- </Flexbox>
- </Block>
-
- {/* Pro Mode Option */}
- <Block
- clickable
- className={cx(styles.base, styles.pro)}
- padding={16}
- style={imageStyles}
- variant={'outlined'}
- onClick={handleSelectPro}
- >
- <Flexbox
- gap={8}
- style={{
- zIndex: 10,
- }}
- >
- <Text strong as={'h2'} fontSize={18}>
- {t('modeSelection.pro.title')}
- </Text>
- <Text as={'p'}>{t('modeSelection.pro.subtitle')}</Text>
- <Text as={'p'} type={'secondary'}>
- {t('modeSelection.pro.desc')}
- </Text>
- </Flexbox>
- </Block>
- </Flexbox>
- <Flexbox horizontal align={'center'} justify={'space-between'}>
- <Button
- icon={Undo2Icon}
- type={'text'}
- style={{
- color: cssVar.colorTextDescription,
- }}
- onClick={onBack}
- >
- {t('back')}
- </Button>
- </Flexbox>
- </Flexbox>
- );
-});
-
-ModeSelectionStep.displayName = 'ModeSelectionStep';
-
-export default ModeSelectionStep;