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.

💄 style: update ui

canisminor19901693fc56662a
diff --git a/src/components/Analytics/MainInterfaceTracker.tsx b/src/components/Analytics/MainInterfaceTracker.tsx
index d53e775f9bd..800f172c32e 100644
--- a/src/components/Analytics/MainInterfaceTracker.tsx
+++ b/src/components/Analytics/MainInterfaceTracker.tsx
@@ -17,13 +17,13 @@ const MainInterfaceTracker = memo(() => {
const currentSession = sessionSelectors.currentSession(getSessionStoreState());
const activeSessionId = currentSession?.id;
const defaultSessions = sessionSelectors.defaultSessions(getSessionStoreState());
- const showChatSideBar = systemStatusSelectors.showChatSideBar(useGlobalStore.getState());
+ const showRightPanel = systemStatusSelectors.showRightPanel(useGlobalStore.getState());
const messages = displayMessageSelectors.activeDisplayMessages(getChatStoreState());
return {
active_assistant: activeSessionId === 'inbox' ? null : currentSession?.meta?.title || null,
has_chat_history: messages.length > 0,
session_id: activeSessionId ? activeSessionId : 'inbox',
- sidebar_state: showChatSideBar ? 'expanded' : 'collapsed',
+ sidebar_state: showRightPanel ? 'expanded' : 'collapsed',
visible_assistants_count: defaultSessions.length,
};
}, []);
diff --git a/src/components/Branding/ProductLogo/index.tsx b/src/components/Branding/ProductLogo/index.tsx
index 0d5b9411894..05a4c2c783d 100644
--- a/src/components/Branding/ProductLogo/index.tsx
+++ b/src/components/Branding/ProductLogo/index.tsx
@@ -1,3 +1,5 @@
+'use client';
+
import { LobeHub, LobeHubProps } from '@lobehub/ui/brand';
import { memo } from 'react';
diff --git a/src/components/ChangelogModal/ChangelogContent.tsx b/src/components/ChangelogModal/ChangelogContent.tsx
new file mode 100644
index 00000000000..9d2618c9af8
--- /dev/null
+++ b/src/components/ChangelogModal/ChangelogContent.tsx
@@ -0,0 +1,71 @@
+import { Typography } from '@lobehub/ui';
+import { Image } from '@lobehub/ui/mdx';
+import { Divider } from 'antd';
+import { Fragment, Suspense } from 'react';
+import { useTranslation } from 'react-i18next';
+import useSWR from 'swr';
+import urlJoin from 'url-join';
+
+import { CustomMDX } from '@/components/mdx';
+import { OFFICIAL_SITE } from '@/const/url';
+import type { Locales } from '@/locales/resources';
+import { ChangelogService } from '@/server/services/changelog';
+import type { ChangelogIndexItem } from '@/types/changelog';
+
+import VersionTag from './VersionTag';
+
+interface ChangelogContentProps {
+ data: ChangelogIndexItem[];
+}
+
+interface PostItemProps extends ChangelogIndexItem {
+ locale: Locales;
+ showDivider?: boolean;
+}
+
+const PostItem = ({ id, versionRange, locale, showDivider = true }: PostItemProps) => {
+ const { data } = useSWR([`changelog-post-${id}`, locale], async () => {
+ const changelogService = new ChangelogService();
+ return await changelogService.getPostById(id, { locale });
+ });
+
+ if (!data || !data.title) return null;
+
+ return (
+ <>
+ {showDivider && <Divider />}
+ <Typography headerMultiple={0.2}>
+ <a
+ href={urlJoin(OFFICIAL_SITE, '/changelog', id)}
+ rel="noopener noreferrer"
+ style={{ color: 'inherit' }}
+ target="_blank"
+ >
+ <h2 id={id}>{data.rawTitle || data.title}</h2>
+ </a>
+ {data.image && <Image alt={data.title} src={data.image} />}
+ <Suspense fallback={<div>Loading...</div>}>
+ <CustomMDX source={data.content} />
+ </Suspense>
+ <VersionTag range={versionRange} />
+ </Typography>
+ </>
+ );
+};
+
+const ChangelogContent = ({ data }: ChangelogContentProps) => {
+ const { i18n } = useTranslation();
+ const locale = i18n.language as Locales;
+
+ return (
+ <>
+ {data.map((item, index) => (
+ <Fragment key={item.id}>
+ <PostItem locale={locale} showDivider={index !== 0} {...item} />
+ </Fragment>
+ ))}
+ </>
+ );
+};
+
+export default ChangelogContent;
diff --git a/src/app/[variants]/(main)/changelog/features/VersionTag.tsx b/src/components/ChangelogModal/VersionTag.tsx
similarity index 100%
rename from src/app/[variants]/(main)/changelog/features/VersionTag.tsx
rename to src/components/ChangelogModal/VersionTag.tsx
diff --git a/src/components/ChangelogModal/index.tsx b/src/components/ChangelogModal/index.tsx
new file mode 100644
index 00000000000..90052d82956
--- /dev/null
+++ b/src/components/ChangelogModal/index.tsx
@@ -0,0 +1,81 @@
+'use client';
+
+import { Button, Modal } from '@lobehub/ui';
+import { ArrowUpRightIcon } from 'lucide-react';
+import { memo, useEffect, useState } from 'react';
+import { useTranslation } from 'react-i18next';
+import { Flexbox } from 'react-layout-kit';
+
+import { ChangelogService } from '@/server/services/changelog';
+
+import ChangelogContent from './ChangelogContent';
+
+interface ChangelogModalProps {
+ onClose: () => void;
+ open: boolean;
+ shouldLoad: boolean;
+}
+
+const ChangelogModal = memo<ChangelogModalProps>(({ open, onClose, shouldLoad }) => {
+ const { t } = useTranslation('common');
+ const [data, setData] = useState<any[]>([]);
+ const [isLoading, setIsLoading] = useState(false);
+
+ useEffect(() => {
+ if (shouldLoad && data.length === 0) {
+ setIsLoading(true);
+ const changelogService = new ChangelogService();
+ changelogService
+ .getChangelogIndex()
+ .then((result) => {
+ setData(result);
+ })
+ .catch((error) => {
+ console.error('Failed to load changelog:', error);
+ })
+ .finally(() => {
+ setIsLoading(false);
+ });
+ }
+ }, [shouldLoad, data.length]);
+
+ return open ? (
+ <Modal
+ footer={null}
+ maskClosable
+ onCancel={onClose}
+ open={true}
+ styles={{
+ body: {
+ maxHeight: '70vh',
+ overflowY: 'auto',
+ },
+ }}
+ title={
+ <Flexbox align={'center'} gap={8}>
+ <Button
+ icon={<ArrowUpRightIcon size={16} />}
+ iconPosition="end"
+ onClick={onClose}
+ type="text"
+ >
+ {t('changelog')}
+ </Button>
+ </Flexbox>
+ }
+ width={800}
+ >
+ <Flexbox gap={16} padding={16} style={{ width: '100%' }}>
+ {isLoading || data.length === 0 ? (
+ <div style={{ padding: '24px', textAlign: 'center' }}>{t('loading')}</div>
+ ) : (
+ <ChangelogContent data={data} />
+ )}
+ </Flexbox>
+ </Modal>
+ ) : null;
+});
+
+ChangelogModal.displayName = 'ChangelogModal';
+
+export default ChangelogModal;
diff --git a/src/components/ChatGroupWizard/ChatGroupWizard.tsx b/src/components/ChatGroupWizard/ChatGroupWizard.tsx
index 3dfbd87d0a0..d9ad0ecbab8 100644
--- a/src/components/ChatGroupWizard/ChatGroupWizard.tsx
+++ b/src/components/ChatGroupWizard/ChatGroupWizard.tsx
@@ -1,9 +1,19 @@
'use client';
-import { Avatar, Collapse, GroupAvatar, List, Modal, SearchBar, Text, Tooltip } from '@lobehub/ui';
-import { Button, Checkbox, Empty, Switch } from 'antd';
+import {
+ Avatar,
+ Collapse,
+ Empty,
+ GroupAvatar,
+ List,
+ Modal,
+ SearchBar,
+ Text,
+ Tooltip,
+} from '@lobehub/ui';
+import { Button, Checkbox, Switch } from 'antd';
import { createStyles, useTheme } from 'antd-style';
-import { omit } from 'lodash-es';
+import { omit } from 'es-toolkit/compat';
import { Users } from 'lucide-react';
import { ChangeEvent, memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
@@ -600,7 +610,9 @@ const ChatGroupWizard = memo<ChatGroupWizardProps>(
? t('groupWizard.noMatchingTemplates')
: t('groupWizard.noTemplates')
}
- image={Empty.PRESENTED_IMAGE_SIMPLE}
+ descriptionProps={{ fontSize: 14 }}
+ icon={Users}
+ style={{ maxWidth: 400 }}
/>
) : (
<Flexbox gap={4}>
@@ -628,7 +640,9 @@ const ChatGroupWizard = memo<ChatGroupWizardProps>(
? t('noMatchingAgents', { ns: 'chat' })
: t('noAvailableAgents', { ns: 'chat' })
}
- image={Empty.PRESENTED_IMAGE_SIMPLE}
+ descriptionProps={{ fontSize: 14 }}
+ icon={Users}
+ style={{ maxWidth: 400 }}
/>
) : (
<Flexbox gap={4}>
@@ -745,7 +759,9 @@ const ChatGroupWizard = memo<ChatGroupWizardProps>(
) : (
<Empty
description={t('groupWizard.noTemplateMembers')}
- image={Empty.PRESENTED_IMAGE_SIMPLE}
+ descriptionProps={{ fontSize: 14 }}
+ icon={Users}
+ style={{ maxWidth: 400 }}
/>
)
) : selectedAgentListItems.length > 0 ? (
@@ -753,7 +769,9 @@ const ChatGroupWizard = memo<ChatGroupWizardProps>(
) : (
<Empty
description={t('memberSelection.noSelectedAgents')}
- image={Empty.PRESENTED_IMAGE_SIMPLE}
+ descriptionProps={{ fontSize: 14 }}
+ icon={Users}
+ style={{ maxWidth: 400 }}
/>
)}
</Flexbox>
diff --git a/src/components/DragUpload/useDragUpload.test.tsx b/src/components/DragUpload/useDragUpload.test.tsx
index ff7ca601b72..bbffa191c05 100644
--- a/src/components/DragUpload/useDragUpload.test.tsx
+++ b/src/components/DragUpload/useDragUpload.test.tsx
@@ -4,7 +4,7 @@ import { Mock, afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import { useModelSupportVision } from '@/hooks/useModelSupportVision';
import { useAgentStore } from '@/store/agent';
-import { agentSelectors } from '@/store/agent/slices/chat';
+import { agentSelectors } from '@/store/agent/selectors';
import { getContainer, useDragUpload } from './useDragUpload';
diff --git a/src/components/EmojiPicker/index.tsx b/src/components/EmojiPicker/index.tsx
new file mode 100644
index 00000000000..210b740e49b
--- /dev/null
+++ b/src/components/EmojiPicker/index.tsx
@@ -0,0 +1,30 @@
+import { EmojiPickerProps, EmojiPicker as LobeEmojiPicker } from '@lobehub/ui';
+import { memo } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import { useGlobalStore } from '@/store/global';
+import { globalGeneralSelectors } from '@/store/global/selectors';
+
+export const EmojiPicker = memo<EmojiPickerProps>(({ shape = 'square', ...rest }) => {
+ const locale = useGlobalStore(globalGeneralSelectors.currentLanguage);
+ const { t } = useTranslation('components');
+
+ return (
+ <LobeEmojiPicker
+ shape={shape}
+ {...rest}
+ defaultAvatar={null as any}
+ locale={locale}
+ texts={{
+ delete: t('EmojiPicker.delete'),
+ draggerDesc: t('EmojiPicker.draggerDesc'),
+ emoji: t('EmojiPicker.emoji'),
+ fileTypeError: t('EmojiPicker.fileTypeError'),
+ upload: t('EmojiPicker.upload'),
+ uploadBtn: t('EmojiPicker.uploadBtn'),
+ }}
+ />
+ );
+});
+
+export default EmojiPicker;
diff --git a/src/components/Error/Description.tsx b/src/components/Error/Description.tsx
index e0433afc7bb..c81a59cafe7 100644
--- a/src/components/Error/Description.tsx
+++ b/src/components/Error/Description.tsx
@@ -1,7 +1,6 @@
'use client';
-import { Icon } from '@lobehub/ui';
-import { Skeleton } from 'antd';
+import { Icon , Skeleton } from '@lobehub/ui';
import { css, cx } from 'antd-style';
import { ChevronDown, ChevronUp } from 'lucide-react';
import dynamic from 'next/dynamic';
diff --git a/src/components/InvalidAPIKey/APIKeyForm/index.tsx b/src/components/InvalidAPIKey/APIKeyForm/index.tsx
deleted file mode 100644
index 68e6e593155..00000000000
--- a/src/components/InvalidAPIKey/APIKeyForm/index.tsx
+++ /dev/null
@@ -1,117 +0,0 @@
-import { ProviderIcon } from '@lobehub/icons';
-import { Button } from '@lobehub/ui';
-import { ModelProvider } from 'model-bank';
-import { memo, useMemo, useState } from 'react';
-import { useTranslation } from 'react-i18next';
-import { Center, Flexbox } from 'react-layout-kit';
-
-import { 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
- apiKeyPlaceholder={apiKeyPlaceholder}
- avatar={<ProviderIcon provider={provider} size={80} type={'avatar'} />}
- description={description}
- provider={provider as GlobalLLMProviderKey}
- showEndpoint
- />
- )}
- <Flexbox gap={12} width={'100%'}>
- <Button
- block
- disabled={loading}
- onClick={() => {
- onRecreate();
- }}
- style={{ marginTop: 8 }}
- type={'primary'}
- >
- {t('unlock.confirm')}
- </Button>
- <Button
- onClick={() => {
- onClose();
- }}
- >
- {t('unlock.closeMessage')}
- </Button>
- </Flexbox>
- </Center>
- </LoadingContext>
- );
- },
-);
-
-export default APIKeyForm;
diff --git a/src/components/InvalidAPIKey/APIKeyForm/Bedrock.tsx b/src/components/InvalidAPIKey/Bedrock.tsx
similarity index 97%
rename from src/components/InvalidAPIKey/APIKeyForm/Bedrock.tsx
rename to src/components/InvalidAPIKey/Bedrock.tsx
index 2ae042f75a2..d242fd9d5a8 100644
--- a/src/components/InvalidAPIKey/APIKeyForm/Bedrock.tsx
+++ b/src/components/InvalidAPIKey/Bedrock.tsx
@@ -6,7 +6,7 @@ import { ModelProvider } from 'model-bank';
import { memo, useState } from 'react';
import { useTranslation } from 'react-i18next';
-import { FormAction } from '@/features/ChatList/Error/style';
+import { FormAction } from '@/features/Conversation/Error/style';
import { aiProviderSelectors, useAiInfraStore } from '@/store/aiInfra';
const BedrockForm = memo<{ description: string }>(({ description }) => {
diff --git a/src/components/InvalidAPIKey/APIKeyForm/ComfyUIForm.tsx b/src/components/InvalidAPIKey/ComfyUIForm.tsx
similarity index 99%
rename from src/components/InvalidAPIKey/APIKeyForm/ComfyUIForm.tsx
rename to src/components/InvalidAPIKey/ComfyUIForm.tsx
index 6c498c454f2..c79697395a0 100644
--- a/src/components/InvalidAPIKey/APIKeyForm/ComfyUIForm.tsx
+++ b/src/components/InvalidAPIKey/ComfyUIForm.tsx
@@ -10,7 +10,7 @@ import { Center, Flexbox } from 'react-layout-kit';
import { FormInput, FormPassword } from '@/components/FormInput';
import KeyValueEditor from '@/components/KeyValueEditor';
-import { FormAction } from '@/features/ChatList/Error/style';
+import { FormAction } from '@/features/Conversation/Error/style';
import { useAiInfraStore } from '@/store/aiInfra';
import { ComfyUIKeyVault } from '@/types/user/settings';
diff --git a/src/components/InvalidAPIKey/APIKeyForm/LoadingContext.ts b/src/components/InvalidAPIKey/LoadingContext.ts
similarity index 100%
rename from src/components/InvalidAPIKey/APIKeyForm/LoadingContext.ts
rename to src/components/InvalidAPIKey/LoadingContext.ts
diff --git a/src/components/InvalidAPIKey/APIKeyForm/ProviderApiKeyForm.tsx b/src/components/InvalidAPIKey/ProviderApiKeyForm.tsx
similarity index 97%
rename from src/components/InvalidAPIKey/APIKeyForm/ProviderApiKeyForm.tsx
rename to src/components/InvalidAPIKey/ProviderApiKeyForm.tsx
index c47e931b05b..224c2f28427 100644
--- a/src/components/InvalidAPIKey/APIKeyForm/ProviderApiKeyForm.tsx
+++ b/src/components/InvalidAPIKey/ProviderApiKeyForm.tsx
@@ -4,7 +4,7 @@ import { ReactNode, memo, useContext, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { FormInput, FormPassword } from '@/components/FormInput';
-import { FormAction } from '@/features/ChatList/Error/style';
+import { FormAction } from '@/features/Conversation/Error/style';
import { useProviderName } from '@/hooks/useProviderName';
import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfig';
import { GlobalLLMProviderKey } from '@/types/user/settings';
diff --git a/src/components/InvalidAPIKey/APIKeyForm/__tests__/ComfyUIForm.test.tsx b/src/components/InvalidAPIKey/__tests__/ComfyUIForm.test.tsx
similarity index 100%
rename from src/components/InvalidAPIKey/APIKeyForm/__tests__/ComfyUIForm.test.tsx
rename to src/components/InvalidAPIKey/__tests__/ComfyUIForm.test.tsx
diff --git a/src/components/InvalidAPIKey/index.tsx b/src/components/InvalidAPIKey/index.tsx
index acbf0148e60..68e6e593155 100644
--- a/src/components/InvalidAPIKey/index.tsx
+++ b/src/components/InvalidAPIKey/index.tsx
@@ -1,10 +1,18 @@
-import { memo } from 'react';
+import { ProviderIcon } from '@lobehub/icons';
+import { Button } from '@lobehub/ui';
+import { ModelProvider } from 'model-bank';
+import { memo, useMemo, useState } from 'react';
+import { useTranslation } from 'react-i18next';
+import { Center, Flexbox } from 'react-layout-kit';
-import { ErrorActionContainer } from '@/features/ChatList/Error/style';
+import { GlobalLLMProviderKey } from '@/types/user/settings';
-import APIKeyForm from './APIKeyForm';
+import BedrockForm from './Bedrock';
+import ComfyUIForm from './ComfyUIForm';
+import { LoadingContext } from './LoadingContext';
+import ProviderApiKeyForm from './ProviderApiKeyForm';
-interface InvalidAPIKeyProps {
+interface APIKeyFormProps {
bedrockDescription: string;
description: string;
id: string;
@@ -12,19 +20,98 @@ interface InvalidAPIKeyProps {
onRecreate: () => void;
provider?: string;
}
-const InvalidAPIKey = memo<InvalidAPIKeyProps>(
- ({ id, provider, description, bedrockDescription, onRecreate, onClose }) => (
- <ErrorActionContainer>
- <APIKeyForm
- bedrockDescription={bedrockDescription}
- description={description}
- id={id}
- onClose={onClose}
- onRecreate={onRecreate}
- provider={provider}
- />
- </ErrorActionContainer>
- ),
+
+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
+ apiKeyPlaceholder={apiKeyPlaceholder}
+ avatar={<ProviderIcon provider={provider} size={80} type={'avatar'} />}
+ description={description}
+ provider={provider as GlobalLLMProviderKey}
+ showEndpoint
+ />
+ )}
+ <Flexbox gap={12} width={'100%'}>
+ <Button
+ block
+ disabled={loading}
+ onClick={() => {
+ onRecreate();
+ }}
+ style={{ marginTop: 8 }}
+ type={'primary'}
+ >
+ {t('unlock.confirm')}
+ </Button>
+ <Button
+ onClick={() => {
+ onClose();
+ }}
+ >
+ {t('unlock.closeMessage')}
+ </Button>
+ </Flexbox>
+ </Center>
+ </LoadingContext>
+ );
+ },
);
-export default InvalidAPIKey;
+export default APIKeyForm;
diff --git a/src/components/InvalidAPIKey/APIKeyForm/useApiKey.ts b/src/components/InvalidAPIKey/useApiKey.ts
similarity index 100%
rename from src/components/InvalidAPIKey/APIKeyForm/useApiKey.ts
rename to src/components/InvalidAPIKey/useApiKey.ts
diff --git a/src/app/[variants]/(main)/labs/components/Hero.tsx b/src/components/LabsModal/Hero.tsx
similarity index 100%
rename from src/app/[variants]/(main)/labs/components/Hero.tsx
rename to src/components/LabsModal/Hero.tsx
diff --git a/src/app/[variants]/(main)/labs/components/LabCard.tsx b/src/components/LabsModal/LabCard.tsx
similarity index 100%
rename from src/app/[variants]/(main)/labs/components/LabCard.tsx
rename to src/components/LabsModal/LabCard.tsx
diff --git a/src/components/LabsModal/index.tsx b/src/components/LabsModal/index.tsx
new file mode 100644
index 00000000000..94d82165ba3
--- /dev/null
+++ b/src/components/LabsModal/index.tsx
@@ -0,0 +1,66 @@
+'use client';
+
+import { Modal } from '@lobehub/ui';
+import { memo } from 'react';
+import { useTranslation } from 'react-i18next';
+import { Flexbox } from 'react-layout-kit';
+
+import { useUserStore } from '@/store/user';
+import { labPreferSelectors, preferenceSelectors } from '@/store/user/selectors';
+
+import LabCard from './LabCard';
+
+interface LabItem {
+ checked: boolean;
+ cover?: string;
+ desc: string;
+ key: string;
+ title: string;
+}
+
+interface LabsModalProps {
+ onClose: () => void;
+ open: boolean;
+}
+
+const LabsModal = memo<LabsModalProps>(({ open, onClose }) => {
+ const { t } = useTranslation('labs');
+
+ const [isPreferenceInit, enableInputMarkdown, updateLab] = useUserStore((s) => [
+ preferenceSelectors.isPreferenceInit(s),
+ labPreferSelectors.enableInputMarkdown(s),
+ s.updateLab,
+ ]);
+
+ const labItems: LabItem[] = [
+ {
+ checked: enableInputMarkdown,
+ cover: 'https://github.com/user-attachments/assets/0527a966-3d95-46b4-b880-c0f3fca18f02',
+ desc: t('features.inputMarkdown.desc'),
+ key: 'enableInputMarkdown',
+ title: t('features.inputMarkdown.title'),
+ },
+ ];
+
+ return (
+ <Modal footer={null} onCancel={onClose} open={open} title={t('title')} width={700}>
+ <Flexbox gap={16} padding={16} style={{ alignItems: 'center', width: '100%' }}>
+ {labItems.map((item) => (
+ <LabCard
+ checked={item.checked}
+ cover={item.cover}
+ desc={item.desc}
+ key={item.key}
+ loading={!isPreferenceInit}
+ onChange={(checked: boolean) => updateLab({ [item.key]: checked })}
+ title={item.title}
+ />
+ ))}
+ </Flexbox>
+ </Modal>
+ );
+});
+
+LabsModal.displayName = 'LabsModal';
+
+export default LabsModal;
diff --git a/src/components/RepoIcon/index.tsx b/src/components/LibIcon/index.tsx
similarity index 54%
rename from src/components/RepoIcon/index.tsx
rename to src/components/LibIcon/index.tsx
index a0421e33708..4da423da9e3 100644
--- a/src/components/RepoIcon/index.tsx
+++ b/src/components/LibIcon/index.tsx
@@ -1,15 +1,15 @@
import { Icon } from '@lobehub/ui';
import { useTheme } from 'antd-style';
-import { BookTextIcon } from 'lucide-react';
+import { FolderIcon } from 'lucide-react';
import { memo } from 'react';
-interface RepoIconProps {
+interface LibIconProps {
size?: number;
}
-const RepoIcon = memo<RepoIconProps>(({ size = 20 }) => {
+const LibIcon = memo<LibIconProps>(({ size = 20 }) => {
const theme = useTheme();
- return <Icon color={theme.geekblue} fill={theme.geekblue3} icon={BookTextIcon} size={size} />;
+ return <Icon color={theme.geekblue} fill={theme.geekblue3} icon={FolderIcon} size={size} />;
});
-export default RepoIcon;
+export default LibIcon;
diff --git a/src/components/Loading/BrandTextLoading/index.tsx b/src/components/Loading/BrandTextLoading/index.tsx
index e460f0c7117..f0abf2546a1 100644
--- a/src/components/Loading/BrandTextLoading/index.tsx
+++ b/src/components/Loading/BrandTextLoading/index.tsx
@@ -1,3 +1,4 @@
+import { Tag, Text } from '@lobehub/ui';
import { BrandLoading, LobeHubText } from '@lobehub/ui/brand';
import { Center } from 'react-layout-kit';
@@ -5,12 +6,31 @@ import { isCustomBranding } from '@/const/version';
import CircleLoading from '../CircleLoading';
-export default () => {
+interface BrandTextLoadingProps {
+ debugId: string;
+}
+
+const BrandTextLoading = ({ debugId }: BrandTextLoadingProps) => {
if (isCustomBranding) return <CircleLoading />;
return (
<Center height={'100%'} width={'100%'}>
<BrandLoading size={40} style={{ opacity: 0.6 }} text={LobeHubText} />
+ {process.env.NODE_ENV === 'development' && debugId && (
+ <Center gap={4} padding={16}>
+ <Text code style={{ alignItems: 'center', display: 'flex' }}>
+ Debug ID:{' '}
+ <Tag size={'large'}>
+ <Text code>{debugId}</Text>
+ </Tag>
+ </Text>
+ <Text fontSize={12} type={'secondary'}>
+ only visible in development
+ </Text>
+ </Center>
+ )}
</Center>
);
};
+
+export default BrandTextLoading;
diff --git a/src/components/Loading/SkeletonLoading/index.tsx b/src/components/Loading/SkeletonLoading/index.tsx
index 4e821ffcb6f..72acd2a5611 100644
--- a/src/components/Loading/SkeletonLoading/index.tsx
+++ b/src/components/Loading/SkeletonLoading/index.tsx
@@ -1,6 +1,7 @@
'use client';
-import { Skeleton, SkeletonProps } from 'antd';
+import { Skeleton } from '@lobehub/ui';
+import { SkeletonProps } from 'antd';
import { createStyles } from 'antd-style';
import { memo } from 'react';
diff --git a/src/components/MemberSelectionModal/MemberSelectionModal.tsx b/src/components/MemberSelectionModal/MemberSelectionModal.tsx
index 6dcb14ccfb3..d8e268d3622 100644
--- a/src/components/MemberSelectionModal/MemberSelectionModal.tsx
+++ b/src/components/MemberSelectionModal/MemberSelectionModal.tsx
@@ -2,7 +2,7 @@
import { ActionIcon, Avatar, List, Modal, SearchBar, Text, Tooltip } from '@lobehub/ui';
import { useHover } from 'ahooks';
-import { List as AntdList, Button, Checkbox, Empty, Switch, Typography } from 'antd';
+import { List as AntdList, Button, Checkbox, Switch, Typography } from 'antd';
import { createStyles } from 'antd-style';
import { X } from 'lucide-react';
import { type ChangeEvent, memo, useCallback, useMemo, useRef, useState } from 'react';
@@ -10,6 +10,7 @@ import { useTranslation } from 'react-i18next';
import { Flexbox } from 'react-layout-kit';
import { DEFAULT_AVATAR } from '@/const/meta';
+import AgentSelectionEmpty from '@/features/AgentSelectionEmpty';
import ModelSelect from '@/features/ModelSelect';
import { useEnabledChatModels } from '@/hooks/useEnabledChatModels';
import { useSessionStore } from '@/store/session';
@@ -402,13 +403,9 @@ const MemberSelectionModal = memo<MemberSelectionModalProps>(
<Flexbox flex={1} style={{ overflowY: 'auto' }}>
{filteredAvailableAgents.length === 0 ? (
- <Empty
- description={
- searchTerm
- ? t('noMatchingAgents', { ns: 'chat' })
- : t('noAvailableAgents', { ns: 'chat' })
- }
- image={Empty.PRESENTED_IMAGE_SIMPLE}
+ <AgentSelectionEmpty
+ search={Boolean(searchTerm)}
+ variant={searchTerm ? 'empty' : 'noAvailable'}
/>
) : (
<AntdList
@@ -482,16 +479,7 @@ const MemberSelectionModal = memo<MemberSelectionModalProps>(
{/* Selected Agents List */}
<Flexbox flex={1}>
{selectedAgentListItems.length === 0 ? (
- <Flexbox align="center" flex={1} justify="center">
- <Empty
- description={
- mode === 'create'
- ? t('memberSelection.noSelectedAgents')
- : t('memberSelection.noSelectedAgents')
- }
- image={Empty.PRESENTED_IMAGE_SIMPLE}
- />
- </Flexbox>
+ <AgentSelectionEmpty variant="noSelected" />
) : (
<List items={selectedAgentListItems} />
)}
diff --git a/src/components/ModelSelect/NewModelBadge.tsx b/src/components/ModelSelect/NewModelBadge.tsx
index a1e71124333..e1f0ac9961c 100644
--- a/src/components/ModelSelect/NewModelBadge.tsx
+++ b/src/components/ModelSelect/NewModelBadge.tsx
@@ -5,19 +5,37 @@ import { useTranslation } from 'react-i18next';
import { isNewReleaseDate } from '@/utils/time';
interface NewModelBadgeProps {
+ label: string;
releasedAt?: string;
}
-const NewModelBadge = memo<NewModelBadgeProps>(({ releasedAt }) => {
- const { t } = useTranslation('common');
-
+/**
+ * A pure badge component without i18n hooks.
+ * Useful in large lists (e.g. dropdown menus) to avoid calling `useTranslation` for each row.
+ */
+export const NewModelBadge = memo<NewModelBadgeProps>(({ releasedAt, label }) => {
if (!releasedAt || !isNewReleaseDate(releasedAt)) return null;
return (
<Tag color="blue" size="small">
- {t('new')}
+ {label}
</Tag>
);
});
-export default NewModelBadge;
+interface NewModelBadgeI18nProps {
+ releasedAt?: string;
+}
+
+const NewModelBadgeI18n = memo<NewModelBadgeI18nProps>(({ releasedAt }) => {
+ const { t } = useTranslation('common');
+
+ return <NewModelBadge label={t('new')} releasedAt={releasedAt} />;
+});
+
+/**
+ * Keep default export behavior for existing usages:
+ * - Handles i18n via `useTranslation('common')`
+ * - Renders nothing when the model is not a new release
+ */
+export default NewModelBadgeI18n;
diff --git a/src/components/ModelSelect/index.tsx b/src/components/ModelSelect/index.tsx
index 23919107f35..2485e704b74 100644
--- a/src/components/ModelSelect/index.tsx
+++ b/src/components/ModelSelect/index.tsx
@@ -14,14 +14,14 @@ import {
} from 'lucide-react';
import { ModelAbilities } from 'model-bank';
import numeral from 'numeral';
-import { FC, memo } from 'react';
+import { type ComponentProps, FC, memo, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { Flexbox } from 'react-layout-kit';
import { AiProviderSourceType } from '@/types/aiProvider';
import { formatTokenNumber } from '@/utils/format';
-import NewModelBadge from './NewModelBadge';
+import NewModelBadgeI18n, { NewModelBadge as NewModelBadgeCore } from './NewModelBadge';
export const TAG_CLASSNAME = 'lobe-model-info-tags';
@@ -55,132 +55,163 @@ interface ModelInfoTagsProps extends ModelAbilities {
directionReverse?: boolean;
isCustom?: boolean;
placement?: 'top' | 'right';
+ /**
+ * Whether to render tooltip overlays for each tag.
+ * Disable this when rendering a large list (e.g. dropdown menus) to avoid mounting hundreds of Tooltip instances.
+ *
+ * When `false`, tags are rendered without any tooltip/title fallback by design.
+ */
+ withTooltip?: boolean;
}
export const ModelInfoTags = memo<ModelInfoTagsProps>(
- ({ directionReverse, placement = 'right', ...model }) => {
+ ({ directionReverse, placement = 'top', withTooltip = true, ...model }) => {
const { t } = useTranslation('components');
const { styles } = useStyles();
+ const renderTag = (
+ enabled: boolean | undefined,
+ getTitle: () => string,
+ color: Parameters<typeof Tag>[0]['color'],
+ icon: Parameters<typeof Icon>[0]['icon'],
+ className = styles.tag,
+ tooltipStyles?: ComponentProps<typeof Tooltip>['styles'],
+ ) => {
+ if (!enabled) return null;
+
+ const tag = (
+ <Tag className={className} color={color} size={'small'}>
+ <Icon icon={icon} />
+ </Tag>
+ );
+
+ if (!withTooltip) return tag;
+
+ const title = getTitle();
+ return (
+ <Tooltip
+ placement={placement}
+ styles={tooltipStyles ?? { root: { pointerEvents: 'none' } }}
+ title={title}
+ >
+ {tag}
+ </Tooltip>
+ );
+ };
+
return (
<Flexbox
className={TAG_CLASSNAME}
direction={directionReverse ? 'horizontal-reverse' : 'horizontal'}
gap={4}
+ style={{ marginLeft: 'auto' }}
width={'fit-content'}
>
- {model.files && (
- <Tooltip
- placement={placement}
- styles={{ root: { pointerEvents: 'none' } }}
- title={t('ModelSelect.featureTag.file')}
- >
- <Tag className={styles.tag} color={'success'} size={'small'}>
- <Icon icon={LucidePaperclip} />
- </Tag>
- </Tooltip>
- )}
- {model.imageOutput && (
- <Tooltip
- placement={placement}
- styles={{ root: { pointerEvents: 'none' } }}
- title={t('ModelSelect.featureTag.imageOutput')}
- >
- <Tag className={styles.tag} color={'success'} size={'small'}>
- <Icon icon={LucideImage} />
- </Tag>
- </Tooltip>
- )}
- {model.vision && (
- <Tooltip
- placement={placement}
- styles={{ root: { pointerEvents: 'none' } }}
- title={t('ModelSelect.featureTag.vision')}
- >
- <Tag className={styles.tag} color={'success'} size={'small'}>
- <Icon icon={LucideEye} />
- </Tag>
- </Tooltip>
- )}
- {model.video && (
- <Tooltip
- placement={placement}
- styles={{ root: { pointerEvents: 'none' } }}
- title={t('ModelSelect.featureTag.video')}
- >
- <Tag className={styles.tag} color={'magenta'} size={'small'}>
- <Icon icon={Video} />
- </Tag>
- </Tooltip>
- )}
- {model.functionCall && (
- <Tooltip
- placement={placement}
- styles={{
- root: { maxWidth: 'unset', pointerEvents: 'none' },
- }}
- title={t('ModelSelect.featureTag.functionCall')}
- >
- <Tag className={styles.tag} color={'info'} size={'small'}>
- <Icon icon={ToyBrick} />
- </Tag>
- </Tooltip>
+ {renderTag(model.files, () => t('ModelSelect.featureTag.file'), 'success', LucidePaperclip)}
+ {renderTag(
+ model.imageOutput,
+ () => t('ModelSelect.featureTag.imageOutput'),
+ 'success',
+ LucideImage,
)}
- {model.reasoning && (
- <Tooltip
- placement={placement}
- styles={{ root: { pointerEvents: 'none' } }}
- title={t('ModelSelect.featureTag.reasoning')}
- >
- <Tag className={styles.tag} color={'purple'} size={'small'}>
- <Icon icon={AtomIcon} />
- </Tag>
- </Tooltip>
+ {renderTag(model.vision, () => t('ModelSelect.featureTag.vision'), 'success', LucideEye)}
+ {renderTag(model.video, () => t('ModelSelect.featureTag.video'), 'magenta', Video)}
+ {renderTag(
+ model.functionCall,
+ () => t('ModelSelect.featureTag.functionCall'),
+ 'info',
+ ToyBrick,
+ styles.tag,
+ {
+ root: { maxWidth: 'unset', pointerEvents: 'none' },
+ },
)}
- {model.search && (
- <Tooltip
- placement={placement}
- styles={{ root: { pointerEvents: 'none' } }}
- title={t('ModelSelect.featureTag.search')}
- >
- <Tag className={styles.tag} color={'cyan'} size={'small'}>
- <Icon icon={LucideGlobe} />
- </Tag>
- </Tooltip>
- )}
- {typeof model.contextWindowTokens === 'number' && (
- <Tooltip
- placement={placement}
- styles={{
- root: { maxWidth: 'unset', pointerEvents: 'none' },
- }}
- title={t('ModelSelect.featureTag.tokens', {
- tokens:
- model.contextWindowTokens === 0
- ? '∞'
- : numeral(model.contextWindowTokens).format('0,0'),
- })}
- >
- <Tag className={styles.token} size={'small'}>
- {model.contextWindowTokens === 0 ? (
- <Infinity size={17} strokeWidth={1.6} />
- ) : (
- formatTokenNumber(model.contextWindowTokens as number)
- )}
- </Tag>
- </Tooltip>
+ {renderTag(
+ model.reasoning,
+ () => t('ModelSelect.featureTag.reasoning'),
+ 'purple',
+ AtomIcon,
)}
+ {renderTag(model.search, () => t('ModelSelect.featureTag.search'), 'cyan', LucideGlobe)}
+ {typeof model.contextWindowTokens === 'number' &&
+ (() => {
+ const tokensText =
+ model.contextWindowTokens === 0 ? '∞' : formatTokenNumber(model.contextWindowTokens);
+
+ const tag = (
+ <Tag className={styles.token} size={'small'}>
+ {model.contextWindowTokens === 0 ? (
+ <Infinity size={17} strokeWidth={1.6} />
+ ) : (
+ tokensText
+ )}
+ </Tag>
+ );
+
+ if (!withTooltip) return tag;
+
+ return (
+ <Tooltip
+ placement={placement}
+ styles={{
+ root: { maxWidth: 'unset', pointerEvents: 'none' },
+ }}
+ title={t('ModelSelect.featureTag.tokens', {
+ tokens:
+ model.contextWindowTokens === 0
+ ? '∞'
+ : numeral(model.contextWindowTokens).format('0,0'),
+ })}
+ >
+ {tag}
+ </Tooltip>
+ );
+ })()}
</Flexbox>
);
},
);
interface ModelItemRenderProps extends ChatModelCard {
+ abilities?: ModelAbilities;
+ infoTagTooltip?: boolean;
+ /**
+ * Only mounts Tooltip components while hovering the item, to reduce initial render cost in large dropdown lists.
+ *
+ * Note: hover is not available on mobile, so this will be ignored on mobile.
+ * Also note: since tooltips are mounted lazily, the very first hover may require a tiny pointer movement
+ * before the tooltip system detects the hover target (depends on the underlying tooltip implementation).
+ */
+ infoTagTooltipOnHover?: boolean;
+ newBadgeLabel?: string;
showInfoTag?: boolean;
}
export const ModelItemRender = memo<ModelItemRenderProps>(({ showInfoTag = true, ...model }) => {
const { mobile } = useResponsive();
+ const [hovered, setHovered] = useState(false);
+ const {
+ abilities,
+ infoTagTooltip = true,
+ infoTagTooltipOnHover = false,
+ contextWindowTokens,
+ files,
+ functionCall,
+ imageOutput,
+ newBadgeLabel,
+ reasoning,
+ search,
+ video,
+ vision,
+ } = model;
+
+ const shouldLazyMountTooltip = infoTagTooltipOnHover && !mobile;
+ /**
+ * When `infoTagTooltipOnHover` is enabled, we don't mount Tooltip components until the row is hovered.
+ * This avoids creating many overlays on dropdown open, while keeping the tooltip UX on demand.
+ */
+ const withTooltip = infoTagTooltip && (!shouldLazyMountTooltip || hovered);
+ const displayName = model.displayName || model.id;
return (
<Flexbox
@@ -188,11 +219,12 @@ export const ModelItemRender = memo<ModelItemRenderProps>(({ showInfoTag = true,
gap={32}
horizontal
justify={'space-between'}
+ onMouseEnter={shouldLazyMountTooltip ? () => setHovered(true) : undefined}
+ onMouseLeave={shouldLazyMountTooltip ? () => setHovered(false) : undefined}
style={{
- minWidth: mobile ? '100%' : undefined,
overflow: 'hidden',
position: 'relative',
- width: mobile ? '80vw' : 'auto',
+ width: '100%',
}}
>
<Flexbox
@@ -202,12 +234,37 @@ export const ModelItemRender = memo<ModelItemRenderProps>(({ showInfoTag = true,
style={{ flexShrink: 1, minWidth: 0, overflow: 'hidden' }}
>
<ModelIcon model={model.id} size={20} />
- <Text style={mobile ? { maxWidth: '60vw', overflowX: 'auto', whiteSpace: 'nowrap' } : {}}>
- {model.displayName || model.id}
+ <Text
+ ellipsis={
+ withTooltip
+ ? {
+ tooltip: displayName,
+ }
+ : true
+ }
+ style={mobile ? { maxWidth: '60vw' } : { minWidth: 0, overflow: 'hidden' }}
+ >
+ {displayName}
</Text>
- <NewModelBadge releasedAt={model.releasedAt} />
+ {newBadgeLabel ? (
+ <NewModelBadgeCore label={newBadgeLabel} releasedAt={model.releasedAt} />
+ ) : (
+ <NewModelBadgeI18n releasedAt={model.releasedAt} />
+ )}
</Flexbox>
- {showInfoTag && <ModelInfoTags {...model} />}
+ {showInfoTag && (
+ <ModelInfoTags
+ contextWindowTokens={contextWindowTokens}
+ files={files ?? abilities?.files}
+ functionCall={functionCall ?? abilities?.functionCall}
+ imageOutput={imageOutput ?? abilities?.imageOutput}
+ reasoning={reasoning ?? abilities?.reasoning}
+ search={search ?? abilities?.search}
+ video={video ?? abilities?.video}
+ vision={vision ?? abilities?.vision}
+ withTooltip={withTooltip}
+ />
+ )}
</Flexbox>
);
});
diff --git a/src/components/NextAuth/AuthIcons.tsx b/src/components/NextAuth/AuthIcons.tsx
index a13bf2f1354..e392f7c97a1 100644
--- a/src/components/NextAuth/AuthIcons.tsx
+++ b/src/components/NextAuth/AuthIcons.tsx
@@ -1,5 +1,4 @@
-import { SiApple } from '@icons-pack/react-simple-icons';
-import { Aws, Google, Microsoft } from '@lobehub/icons';
+import { Apple, Aws, Google, Microsoft } from '@lobehub/icons';
import {
Auth0,
Authelia,
@@ -14,8 +13,9 @@ import {
} from '@lobehub/ui/icons';
import React from 'react';
-const iconComponents: { [key: string]: React.ElementType } = {
- 'apple': SiApple,
+// TODO: check this
+const iconComponents: { [key: string]: any } = {
+ 'apple': Apple,
'auth0': Auth0,
'authelia': Authelia.Color,
'authentik': Authentik.Color,
diff --git a/src/components/OllamaSetupGuide/index.tsx b/src/components/OllamaSetupGuide/index.tsx
index 665b1c00b16..37ef9c5fc42 100644
--- a/src/components/OllamaSetupGuide/index.tsx
+++ b/src/components/OllamaSetupGuide/index.tsx
@@ -1,3 +1,4 @@
+import { ProviderCombine } from '@lobehub/icons';
import { Highlighter, Snippet, Tabs } from '@lobehub/ui';
import { Steps } from 'antd';
import { createStyles } from 'antd-style';
@@ -30,187 +31,194 @@ const SetupGuide = memo(() => {
const { styles } = useStyles();
const { t } = useTranslation('components');
return (
- <Tabs
- items={[
- {
- children: (
- <Steps
- className={styles.steps}
- direction={'vertical'}
- items={[
- {
- description: (
- <Trans i18nKey={'OllamaSetupGuide.install.description'} ns={'components'}>
- 请确认你已经开启 Ollama ,如果没有安装 Ollama ,请前往官网
- <Link href={'https://ollama.com/download'}>下载</Link>
- </Trans>
- ),
- status: 'process',
- title: t('OllamaSetupGuide.install.title'),
- },
- {
- description: (
- <Flexbox gap={8}>
- {t('OllamaSetupGuide.cors.description')}
+ <>
+ <ProviderCombine provider={'ollama'} size={30} style={{ marginBottom: -8, marginLeft: 4 }} />
+ <Tabs
+ compact
+ items={[
+ {
+ children: (
+ <Steps
+ className={styles.steps}
+ direction={'vertical'}
+ items={[
+ {
+ description: (
+ <Trans i18nKey={'OllamaSetupGuide.install.description'} ns={'components'}>
+ 请确认你已经开启 Ollama ,如果没有安装 Ollama ,请前往官网
+ <Link href={'https://ollama.com/download'}>下载</Link>
+ </Trans>
+ ),
+ status: 'process',
+ title: t('OllamaSetupGuide.install.title'),
+ },
+ {
+ description: (
+ <Flexbox gap={8}>
+ {t('OllamaSetupGuide.cors.description')}
+ <Flexbox gap={8}>
+ {t('OllamaSetupGuide.cors.macos')}
+ <Snippet language={'bash'}>
+ {/* eslint-disable-next-line react/no-unescaped-entities */}
+ launchctl setenv OLLAMA_ORIGINS "*"
+ </Snippet>
+ {t('OllamaSetupGuide.cors.reboot')}
+ </Flexbox>
+ </Flexbox>
+ ),
+ status: 'process',
+ title: t('OllamaSetupGuide.cors.title'),
+ },
+ ]}
+ size={'small'}
+ />
+ ),
+ key: 'macos',
+ label: 'macOS',
+ },
+ {
+ children: (
+ <Steps
+ className={styles.steps}
+ direction={'vertical'}
+ items={[
+ {
+ description: (
+ <Trans i18nKey={'OllamaSetupGuide.install.description'} ns={'components'}>
+ 请确认你已经开启 Ollama ,如果没有安装 Ollama ,请前往官网
+ <Link href={'https://ollama.com/download'}>下载</Link>
+ </Trans>
+ ),
+ status: 'process',
+ title: t('OllamaSetupGuide.install.title'),
+ },
+ {
+ description: (
+ <Flexbox gap={8}>
+ {t('OllamaSetupGuide.cors.description')}
+ <div>{t('OllamaSetupGuide.cors.windows')}</div>
+ <div>{t('OllamaSetupGuide.cors.reboot')}</div>
+ </Flexbox>
+ ),
+ status: 'process',
+ title: t('OllamaSetupGuide.cors.title'),
+ },
+ ]}
+ size={'small'}
+ />
+ ),
+ key: 'windows',
+ label: t('OllamaSetupGuide.install.windowsTab'),
+ },
+ {
+ children: (
+ <Steps
+ className={styles.steps}
+ direction={'vertical'}
+ items={[
+ {
+ description: (
<Flexbox gap={8}>
- {t('OllamaSetupGuide.cors.macos')}
+ {t('OllamaSetupGuide.install.linux.command')}
<Snippet language={'bash'}>
- {/* eslint-disable-next-line react/no-unescaped-entities */}
- launchctl setenv OLLAMA_ORIGINS "*"
+ curl -fsSL https://ollama.com/install.sh | sh
</Snippet>
- {t('OllamaSetupGuide.cors.reboot')}
+ <div>
+ <Trans
+ i18nKey={'OllamaSetupGuide.install.linux.manual'}
+ ns={'components'}
+ >
+ 或者,你也可以参考
+ <Link href={'https://github.com/ollama/ollama/blob/main/docs/linux.md'}>
+ Linux 手动安装指南
+ </Link>
+ 。
+ </Trans>
+ </div>
</Flexbox>
- </Flexbox>
- ),
- status: 'process',
- title: t('OllamaSetupGuide.cors.title'),
- },
- ]}
- size={'small'}
- />
- ),
- key: 'macos',
- label: 'macOS',
- },
- {
- children: (
- <Steps
- className={styles.steps}
- direction={'vertical'}
- items={[
- {
- description: (
- <Trans i18nKey={'OllamaSetupGuide.install.description'} ns={'components'}>
- 请确认你已经开启 Ollama ,如果没有安装 Ollama ,请前往官网
- <Link href={'https://ollama.com/download'}>下载</Link>
- </Trans>
- ),
- status: 'process',
- title: t('OllamaSetupGuide.install.title'),
- },
- {
- description: (
- <Flexbox gap={8}>
- {t('OllamaSetupGuide.cors.description')}
- <div>{t('OllamaSetupGuide.cors.windows')}</div>
- <div>{t('OllamaSetupGuide.cors.reboot')}</div>
- </Flexbox>
- ),
- status: 'process',
- title: t('OllamaSetupGuide.cors.title'),
- },
- ]}
- size={'small'}
- />
- ),
- key: 'windows',
- label: t('OllamaSetupGuide.install.windowsTab'),
- },
- {
- children: (
- <Steps
- className={styles.steps}
- direction={'vertical'}
- items={[
- {
- description: (
- <Flexbox gap={8}>
- {t('OllamaSetupGuide.install.linux.command')}
- <Snippet language={'bash'}>
- curl -fsSL https://ollama.com/install.sh | sh
- </Snippet>
- <div>
- <Trans i18nKey={'OllamaSetupGuide.install.linux.manual'} ns={'components'}>
- 或者,你也可以参考
- <Link href={'https://github.com/ollama/ollama/blob/main/docs/linux.md'}>
- Linux 手动安装指南
- </Link>
- 。
- </Trans>
- </div>
- </Flexbox>
- ),
- status: 'process',
- title: t('OllamaSetupGuide.install.title'),
- },
- {
- description: (
- <Flexbox gap={8}>
- <div>{t('OllamaSetupGuide.cors.description')}</div>
+ ),
+ status: 'process',
+ title: t('OllamaSetupGuide.install.title'),
+ },
+ {
+ description: (
+ <Flexbox gap={8}>
+ <div>{t('OllamaSetupGuide.cors.description')}</div>
- <div>{t('OllamaSetupGuide.cors.linux.systemd')}</div>
- {/* eslint-disable-next-line react/no-unescaped-entities */}
- <Snippet language={'bash'}> sudo systemctl edit ollama.service</Snippet>
- {t('OllamaSetupGuide.cors.linux.env')}
- <Highlighter
- // eslint-disable-next-line react/no-children-prop
- children={`[Service]
+ <div>{t('OllamaSetupGuide.cors.linux.systemd')}</div>
+ {/* eslint-disable-next-line react/no-unescaped-entities */}
+ <Snippet language={'bash'}> sudo systemctl edit ollama.service</Snippet>
+ {t('OllamaSetupGuide.cors.linux.env')}
+ <Highlighter
+ // eslint-disable-next-line react/no-children-prop
+ children={`[Service]
Environment="OLLAMA_ORIGINS=*"`}
- fileName={'ollama.service'}
- fullFeatured
- language={'bash'}
- showLanguage
- />
- {t('OllamaSetupGuide.cors.linux.reboot')}
- </Flexbox>
- ),
- status: 'process',
- title: t('OllamaSetupGuide.cors.title'),
- },
- ]}
- size={'small'}
- />
- ),
- key: 'linux',
- label: 'Linux',
- },
- {
- children: (
- <Steps
- className={styles.steps}
- direction={'vertical'}
- items={[
- {
- description: (
- <Flexbox gap={8}>
- {t('OllamaSetupGuide.install.description')}
- <div>{t('OllamaSetupGuide.install.docker')}</div>
- <Snippet language={'bash'}>docker pull ollama/ollama</Snippet>
- </Flexbox>
- ),
- status: 'process',
- title: t('OllamaSetupGuide.install.title'),
- },
- {
- description: (
- <Flexbox gap={8}>
- {t('OllamaSetupGuide.cors.description')}
- <Highlighter
- fileName={'ollama.service'}
- fullFeatured
- language={'bash'}
- showLanguage
- >
- {/* eslint-disable-next-line react/no-unescaped-entities */}
- docker run -d --gpus=all -v ollama:/root/.ollama -e OLLAMA_ORIGINS="*" -p
- 11434:11434 --name ollama ollama/ollama
- </Highlighter>
- </Flexbox>
- ),
- status: 'process',
- title: t('OllamaSetupGuide.cors.title'),
- },
- ]}
- size={'small'}
- />
- ),
- key: 'docker',
- label: 'Docker',
- },
- ]}
- />
+ fileName={'ollama.service'}
+ fullFeatured
+ language={'bash'}
+ showLanguage
+ />
+ {t('OllamaSetupGuide.cors.linux.reboot')}
+ </Flexbox>
+ ),
+ status: 'process',
+ title: t('OllamaSetupGuide.cors.title'),
+ },
+ ]}
+ size={'small'}
+ />
+ ),
+ key: 'linux',
+ label: 'Linux',
+ },
+ {
+ children: (
+ <Steps
+ className={styles.steps}
+ direction={'vertical'}
+ items={[
+ {
+ description: (
+ <Flexbox gap={8}>
+ {t('OllamaSetupGuide.install.description')}
+ <div>{t('OllamaSetupGuide.install.docker')}</div>
+ <Snippet language={'bash'}>docker pull ollama/ollama</Snippet>
+ </Flexbox>
+ ),
+ status: 'process',
+ title: t('OllamaSetupGuide.install.title'),
+ },
+ {
+ description: (
+ <Flexbox gap={8}>
+ {t('OllamaSetupGuide.cors.description')}
+ <Highlighter
+ fileName={'ollama.service'}
+ fullFeatured
+ language={'bash'}
+ showLanguage
+ >
+ {/* eslint-disable-next-line react/no-unescaped-entities */}
+ docker run -d --gpus=all -v ollama:/root/.ollama -e OLLAMA_ORIGINS="*" -p
+ 11434:11434 --name ollama ollama/ollama
+ </Highlighter>
+ </Flexbox>
+ ),
+ status: 'process',
+ title: t('OllamaSetupGuide.cors.title'),
+ },
+ ]}
+ size={'small'}
+ />
+ ),
+ key: 'docker',
+ label: 'Docker',
+ },
+ ]}
+ />
+ </>
);
});
diff --git a/src/components/Plugins/PluginAvatar.tsx b/src/components/Plugins/PluginAvatar.tsx
index 13e1a66ef7c..42c5501cff4 100644
--- a/src/components/Plugins/PluginAvatar.tsx
+++ b/src/components/Plugins/PluginAvatar.tsx
@@ -15,6 +15,7 @@ const PluginAvatar = memo<PluginAvatarProps>(({ avatar, style, size = 40, alt })
return avatar === 'MCP_AVATAR' ? (
<MCP.Avatar
className={`${theme.prefixCls}-avatar`}
+ shape={'square'}
size={size}
style={{ flex: 'none', overflow: 'hidden', ...style }}
/>
@@ -22,6 +23,7 @@ const PluginAvatar = memo<PluginAvatarProps>(({ avatar, style, size = 40, alt })
<Avatar
alt={alt}
avatar={avatar}
+ shape={'square'}
size={size}
style={{ flex: 'none', overflow: 'hidden', ...style }}
/>
diff --git a/src/components/SidebarHeader/index.tsx b/src/components/SidebarHeader/index.tsx
index e0ebabdbf64..ccc1c7ccef6 100644
--- a/src/components/SidebarHeader/index.tsx
+++ b/src/components/SidebarHeader/index.tsx
@@ -22,10 +22,10 @@ const SidebarHeader = memo<SidebarHeaderProps>(({ title, style, actions, onClick
align={'center'}
className={styles.header}
distribution={'space-between'}
+ flex={'none'}
horizontal
onClick={onClick}
- paddingBlock={14}
- paddingInline={16}
+ padding={8}
style={style}
{...rest}
>
diff --git a/src/components/Skeleton/SkeletonInput.tsx b/src/components/Skeleton/SkeletonInput.tsx
index edfaf9807f7..a726278a0a9 100644
--- a/src/components/Skeleton/SkeletonInput.tsx
+++ b/src/components/Skeleton/SkeletonInput.tsx
@@ -1,5 +1,5 @@
'use client';
-import { Skeleton } from 'antd';
+import { Skeleton } from '@lobehub/ui';
-export const SkeletonInput = () => <Skeleton.Input active block />;
+export const SkeletonInput = () => <Skeleton.Button active block />;
diff --git a/src/components/Skeleton/SkeletonSwitch.tsx b/src/components/Skeleton/SkeletonSwitch.tsx
index 5c940339e46..c9211505958 100644
--- a/src/components/Skeleton/SkeletonSwitch.tsx
+++ b/src/components/Skeleton/SkeletonSwitch.tsx
@@ -1,4 +1,4 @@
-import { Skeleton } from 'antd';
+import { Skeleton } from '@lobehub/ui';
import { css, cx } from 'antd-style';
const switchLoading = cx(css`
diff --git a/src/components/Thinking/index.tsx b/src/components/Thinking/index.tsx
index efcd5d2b462..25805061f33 100644
--- a/src/components/Thinking/index.tsx
+++ b/src/components/Thinking/index.tsx
@@ -1,8 +1,8 @@
import { ChatCitationItem } from '@lobechat/types';
import { CopyButton, Icon, Markdown, ScrollShadow } from '@lobehub/ui';
import { createStyles } from 'antd-style';
-import { AnimatePresence, motion } from 'framer-motion';
import { AtomIcon } from 'lucide-react';
+import { AnimatePresence, m as motion } from 'motion/react';
import { rgba } from 'polished';
import { CSSProperties, ReactNode, RefObject, memo, useEffect, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';