🤯 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.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
:lipstick: style: setting style
canisminor1990e8c755f5325d
diff --git a/package.json b/package.jsonindex 292a2ca6e50..4bfa0645f80 100644--- a/package.json+++ b/package.json@@ -206,7 +206,7 @@"@lobehub/icons": "^4.0.2","@lobehub/market-sdk": "^0.25.1","@lobehub/tts": "^4.0.2",- "@lobehub/ui": "^4.5.0",+ "@lobehub/ui": "^4.6.2","@modelcontextprotocol/sdk": "^1.25.1","@neondatabase/serverless": "^1.0.2","@next/third-parties": "^16.1.1",diff --git a/src/app/[variants]/(main)/settings/about/features/About.tsx b/src/app/[variants]/(main)/settings/about/features/About.tsxnew file mode 100644index 00000000000..d3c772212f3--- /dev/null+++ b/src/app/[variants]/(main)/settings/about/features/About.tsx@@ -0,0 +1,123 @@+'use client';++import { SiDiscord, SiGithub, SiRss, SiX, SiYoutube } from '@icons-pack/react-simple-icons';+import { BRANDING_EMAIL, BRANDING_NAME, SOCIAL_URL } from '@lobechat/business-const';+import { Flexbox, Form } from '@lobehub/ui';+import { Divider } from 'antd';+import { createStaticStyles } from 'antd-style';+import { memo } from 'react';+import { useTranslation } from 'react-i18next';++import { BLOG, OFFICIAL_SITE, PRIVACY_URL, TERMS_URL, mailTo } from '@/const/url';++import AboutList from './AboutList';+import ItemCard from './ItemCard';+import ItemLink from './ItemLink';+import Version from './Version';++const styles = createStaticStyles(({ css, cssVar }) => ({+ title: css`+ font-size: 14px;+ font-weight: bold;+ color: ${cssVar.colorTextSecondary};+ `,+}));++const About = memo<{ mobile?: boolean }>(({ mobile }) => {+ const { t } = useTranslation('common');++ return (+ <Form.Group+ collapsible={false}+ gap={16}+ style={{ maxWidth: '1024px', width: '100%' }}+ title={`${t('about')} ${BRANDING_NAME}`}+ variant={'filled'}+ >+ <Flexbox gap={20} paddingBlock={20} width={'100%'}>+ <div className={styles.title}>{t('version')}</div>+ <Version mobile={mobile} />+ <Divider style={{ marginBlock: 0 }} />+ <div className={styles.title}>{t('contact')}</div>+ <AboutList+ ItemRender={ItemLink}+ items={[+ {+ href: OFFICIAL_SITE,+ label: t('officialSite'),+ value: 'officialSite',+ },+ {+ href: mailTo(BRANDING_EMAIL.support),+ label: t('mail.support'),+ value: 'support',+ },+ {+ href: mailTo(BRANDING_EMAIL.business),+ label: t('mail.business'),+ value: 'business',+ },+ ]}+ />+ <Divider style={{ marginBlock: 0 }} />+ <div className={styles.title}>{t('information')}</div>+ <AboutList+ ItemRender={ItemCard}+ grid+ items={[+ {+ href: BLOG,+ icon: SiRss,+ label: t('blog'),+ value: 'blog',+ },+ {+ href: SOCIAL_URL.github,+ icon: SiGithub,+ label: 'GitHub',+ value: 'feedback',+ },+ {+ href: SOCIAL_URL.discord,+ icon: SiDiscord,+ label: 'Discord',+ value: 'discord',+ },+ {+ href: SOCIAL_URL.x,+ icon: SiX as any,+ label: 'X / Twitter',+ value: 'x',+ },++ {+ href: SOCIAL_URL.youtube,+ icon: SiYoutube,+ label: 'YouTube',+ value: 'youtube',+ },+ ]}+ />+ <Divider style={{ marginBlock: 0 }} />+ <div className={styles.title}>{t('legal')}</div>+ <AboutList+ ItemRender={ItemLink}+ items={[+ {+ href: TERMS_URL,+ label: t('terms'),+ value: 'terms',+ },+ {+ href: PRIVACY_URL,+ label: t('privacy'),+ value: 'privacy',+ },+ ]}+ />+ </Flexbox>+ </Form.Group>+ );+});++export default About;diff --git a/src/app/[variants]/(main)/settings/about/features/Analytics.tsx b/src/app/[variants]/(main)/settings/about/features/Analytics.tsxindex 075aadb6721..804f4950ade 100644--- a/src/app/[variants]/(main)/settings/about/features/Analytics.tsx+++ b/src/app/[variants]/(main)/settings/about/features/Analytics.tsx@@ -35,7 +35,15 @@ const Analytics = memo(() => {title: t('analytics.title'),};- return <Form items={[items]} itemsType={'group'} variant={'borderless'} {...FORM_STYLE} />;+ return (+ <Form+ collapsible={false}+ items={[items]}+ itemsType={'group'}+ variant={'filled'}+ {...FORM_STYLE}+ />+ );});export default Analytics;diff --git a/src/app/[variants]/(main)/settings/about/index.tsx b/src/app/[variants]/(main)/settings/about/index.tsxindex 5d03ceb3d60..486441db933 100644--- a/src/app/[variants]/(main)/settings/about/index.tsx+++ b/src/app/[variants]/(main)/settings/about/index.tsx@@ -1,126 +1,20 @@-'use client';--import { SiDiscord, SiGithub, SiRss, SiX, SiYoutube } from '@icons-pack/react-simple-icons';-import { BRANDING_EMAIL, BRANDING_NAME, SOCIAL_URL } from '@lobechat/business-const';-import { Flexbox, Form } from '@lobehub/ui';-import { Divider } from 'antd';-import { createStaticStyles } from 'antd-style';-import { memo } from 'react';import { useTranslation } from 'react-i18next';-import { BLOG, OFFICIAL_SITE, PRIVACY_URL, TERMS_URL, mailTo } from '@/const/url';+import SettingHeader from '@/app/[variants]/(main)/settings/features/SettingHeader';-import AboutList from './features/AboutList';+import About from './features/About';import Analytics from './features/Analytics';-import ItemCard from './features/ItemCard';-import ItemLink from './features/ItemLink';-import Version from './features/Version';--const styles = createStaticStyles(({ css, cssVar }) => ({- title: css`- font-size: 14px;- font-weight: bold;- color: ${cssVar.colorTextSecondary};- `,-}));--const Page = memo<{ mobile?: boolean }>(({ mobile }) => {- const { t } = useTranslation('common');+const Page = ({ mobile }: { mobile?: boolean }) => {+ const { t } = useTranslation('setting');return (<>- <Form.Group- style={{ maxWidth: '1024px', width: '100%' }}- title={`${t('about')} ${BRANDING_NAME}`}- variant={'borderless'}- >- <Flexbox gap={20} paddingBlock={20} width={'100%'}>- <div className={styles.title}>{t('version')}</div>- <Version mobile={mobile} />- <Divider style={{ marginBlock: 0 }} />- <div className={styles.title}>{t('contact')}</div>- <AboutList- ItemRender={ItemLink}- items={[- {- href: OFFICIAL_SITE,- label: t('officialSite'),- value: 'officialSite',- },- {- href: mailTo(BRANDING_EMAIL.support),- label: t('mail.support'),- value: 'support',- },- {- href: mailTo(BRANDING_EMAIL.business),- label: t('mail.business'),- value: 'business',- },- ]}- />- <Divider style={{ marginBlock: 0 }} />- <div className={styles.title}>{t('information')}</div>- <AboutList- ItemRender={ItemCard}- grid- items={[- {- href: BLOG,- icon: SiRss,- label: t('blog'),- value: 'blog',- },- {- href: SOCIAL_URL.github,- icon: SiGithub,- label: 'GitHub',- value: 'feedback',- },- {- href: SOCIAL_URL.discord,- icon: SiDiscord,- label: 'Discord',- value: 'discord',- },- {- href: SOCIAL_URL.x,- icon: SiX as any,- label: 'X / Twitter',- value: 'x',- },-- {- href: SOCIAL_URL.youtube,- icon: SiYoutube,- label: 'YouTube',- value: 'youtube',- },- ]}- />- <Divider style={{ marginBlock: 0 }} />- <div className={styles.title}>{t('legal')}</div>- <AboutList- ItemRender={ItemLink}- items={[- {- href: TERMS_URL,- label: t('terms'),- value: 'terms',- },- {- href: PRIVACY_URL,- label: t('privacy'),- value: 'privacy',- },- ]}- />- </Flexbox>- </Form.Group>+ <SettingHeader title={t('tab.about')} />+ <About mobile={mobile} /><Analytics /></>);-});+};Page.displayName = 'AboutSetting';diff --git a/src/app/[variants]/(main)/settings/agent/features/DefaultAgentForm.tsx b/src/app/[variants]/(main)/settings/agent/features/DefaultAgentForm.tsxindex 1cddc7273f0..485c3f29a64 100644--- a/src/app/[variants]/(main)/settings/agent/features/DefaultAgentForm.tsx+++ b/src/app/[variants]/(main)/settings/agent/features/DefaultAgentForm.tsx@@ -51,9 +51,12 @@ const DefaultAgentForm = memo(() => {return (<Form+ collapsible={false}form={form}initialValues={{ defaultAgentConfig }}items={[defaultAgentSettings]}+ itemsType={'group'}+ variant={'filled'}{...FORM_STYLE}/>);diff --git a/src/app/[variants]/(main)/settings/agent/features/SystemAgentForm.tsx b/src/app/[variants]/(main)/settings/agent/features/SystemAgentForm.tsxindex 81c7445fc0e..8ffd2d0f426 100644--- a/src/app/[variants]/(main)/settings/agent/features/SystemAgentForm.tsx+++ b/src/app/[variants]/(main)/settings/agent/features/SystemAgentForm.tsx@@ -112,7 +112,15 @@ const SystemAgentForm = memo(};return (- <Form form={form} initialValues={settings} items={[systemAgentSettings]} {...FORM_STYLE} />+ <Form+ collapsible={false}+ form={form}+ initialValues={settings}+ items={[systemAgentSettings]}+ itemsType={'group'}+ variant={'filled'}+ {...FORM_STYLE}+ />);},);diff --git a/src/app/[variants]/(main)/settings/agent/index.tsx b/src/app/[variants]/(main)/settings/agent/index.tsxindex 1148e2538dd..58db42da157 100644--- a/src/app/[variants]/(main)/settings/agent/index.tsx+++ b/src/app/[variants]/(main)/settings/agent/index.tsx@@ -1,16 +1,20 @@'use client';import { DEFAULT_REWRITE_QUERY } from '@lobechat/prompts';+import { useTranslation } from 'react-i18next';+import SettingHeader from '@/app/[variants]/(main)/settings/features/SettingHeader';import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfig';import DefaultAgentForm from './features/DefaultAgentForm';import SystemAgentForm from './features/SystemAgentForm';const Page = () => {+ const { t } = useTranslation('setting');const { enableKnowledgeBase } = useServerConfigStore(featureFlagsSelectors);return (<>+ <SettingHeader title={t('tab.agent')} /><DefaultAgentForm /><SystemAgentForm systemAgentKey="topic" /><SystemAgentForm systemAgentKey="generationTopic" />diff --git a/src/app/[variants]/(main)/settings/apikey/Client.tsx b/src/app/[variants]/(main)/settings/apikey/features/ApiKey.tsxsimilarity index 97%rename from src/app/[variants]/(main)/settings/apikey/Client.tsxrename to src/app/[variants]/(main)/settings/apikey/features/ApiKey.tsxindex 97d99397dab..25325b85763 100644--- a/src/app/[variants]/(main)/settings/apikey/Client.tsx+++ b/src/app/[variants]/(main)/settings/apikey/features/ApiKey.tsx@@ -12,7 +12,7 @@ import { useTranslation } from 'react-i18next';import { lambdaClient } from '@/libs/trpc/client';import { type ApiKeyItem, type CreateApiKeyParams, type UpdateApiKeyParams } from '@/types/apiKey';-import { ApiKeyDisplay, ApiKeyModal, EditableCell } from './features';+import { ApiKeyDisplay, ApiKeyModal, EditableCell } from './index';const styles = createStaticStyles(({ css, cssVar }) => ({container: css`@@ -35,7 +35,7 @@ const styles = createStaticStyles(({ css, cssVar }) => ({`,}));-const Client: FC = () => {+const ApiKey: FC = () => {const { t } = useTranslation('auth');const [modalOpen, setModalOpen] = useState(false);@@ -205,4 +205,4 @@ const Client: FC = () => {);};-export default Client;+export default ApiKey;diff --git a/src/app/[variants]/(main)/settings/apikey/index.tsx b/src/app/[variants]/(main)/settings/apikey/index.tsxindex a1a631c4f39..8b7a79823eb 100644--- a/src/app/[variants]/(main)/settings/apikey/index.tsx+++ b/src/app/[variants]/(main)/settings/apikey/index.tsx@@ -1,11 +1,19 @@-'use client';+import { useTranslation } from 'react-i18next';-import { memo } from 'react';+import SettingHeader from '@/app/[variants]/(main)/settings/features/SettingHeader';-import Client from './Client';+import ApiKey from './features/ApiKey';-const ApiKeySettings = memo(() => {- return <Client />;-});+const Page = () => {+ const { t } = useTranslation('setting');+ return (+ <>+ <SettingHeader title={t('tab.apikey')} />+ <ApiKey />+ </>+ );+};-export default ApiKeySettings;+Page.displayName = 'ApiKeySetting';++export default Page;diff --git a/src/app/[variants]/(main)/settings/chat-appearance/features/ChatAppearance/ChatPreview.tsx b/src/app/[variants]/(main)/settings/chat-appearance/features/ChatAppearance/ChatPreview.tsxnew file mode 100644index 00000000000..04e47b600f4--- /dev/null+++ b/src/app/[variants]/(main)/settings/chat-appearance/features/ChatAppearance/ChatPreview.tsx@@ -0,0 +1,18 @@+import { BRANDING_NAME } from '@lobechat/business-const';+import { Center, Markdown, type MarkdownProps } from '@lobehub/ui';+import { useTranslation } from 'react-i18next';++const ChatPreview = ({ fontSize }: Pick<MarkdownProps, 'fontSize'>) => {+ const { t } = useTranslation('welcome');+ return (+ <Center>+ <Markdown fontSize={fontSize} variant={'chat'}>+ {t('guide.defaultMessageWithoutCreate', {+ appName: BRANDING_NAME,+ })}+ </Markdown>+ </Center>+ );+};++export default ChatPreview;diff --git a/src/app/[variants]/(main)/settings/common/features/ChatAppearance/ChatTransitionPreview.tsx b/src/app/[variants]/(main)/settings/chat-appearance/features/ChatAppearance/ChatTransitionPreview.tsxsimilarity index 61%rename from src/app/[variants]/(main)/settings/common/features/ChatAppearance/ChatTransitionPreview.tsxrename to src/app/[variants]/(main)/settings/chat-appearance/features/ChatAppearance/ChatTransitionPreview.tsxindex 31311cfd7d2..3d2993b68b9 100644--- a/src/app/[variants]/(main)/settings/common/features/ChatAppearance/ChatTransitionPreview.tsx+++ b/src/app/[variants]/(main)/settings/chat-appearance/features/ChatAppearance/ChatTransitionPreview.tsx@@ -1,11 +1,6 @@-import { ActionIconGroup, Block } from '@lobehub/ui';-import { ChatItem } from '@lobehub/ui/chat';-import { useTheme } from 'antd-style';-import { RotateCwIcon } from 'lucide-react';+import { Flexbox, Markdown } from '@lobehub/ui';import { memo, useEffect, useMemo, useState } from 'react';-import { useTranslation } from 'react-i18next';-import { DEFAULT_INBOX_AVATAR } from '@/const/meta';import { type UserGeneralConfig } from '@/types/user/settings';const data = `@@ -43,8 +38,6 @@ const ChatTransitionPreview = memo<ChatTransitionPreviewProps>(({ mode }) => {}, [mode]);const [isStreaming, setIsStreaming] = useState(true);- const { t } = useTranslation('common');- const token = useTheme();useEffect(() => {if (!isStreaming) return;@@ -70,42 +63,12 @@ const ChatTransitionPreview = memo<ChatTransitionPreviewProps>(({ mode }) => {return () => clearInterval(intervalId);}, [isStreaming, streamedContent.length, chunkStep]);- const handleReset = () => {- setStreamedContent('');- setIsStreaming(true);- };-return (- <Block- style={{- background: token.colorBgContainerSecondary,- marginBlock: 16,- minHeight: 280,- paddingBottom: 16,- }}- variant={'outlined'}- >- <ChatItem- actions={- <ActionIconGroup- items={[- {- icon: RotateCwIcon,- key: 'reset',- onClick: handleReset,- title: t('retry'),- },- ]}- size="small"- />- }- avatar={{ avatar: DEFAULT_INBOX_AVATAR }}- markdownProps={{ animated: mode === 'fadeIn' }}- message={streamedContent}- variant="bubble"- width={'100%'}- />- </Block>+ <Flexbox height={180}>+ <Markdown animated={mode === 'fadeIn'} enableStream variant={'chat'}>+ {streamedContent}+ </Markdown>+ </Flexbox>);});diff --git a/src/app/[variants]/(main)/settings/chat-appearance/features/ChatAppearance/HighlighterPreview.tsx b/src/app/[variants]/(main)/settings/chat-appearance/features/ChatAppearance/HighlighterPreview.tsxnew file mode 100644index 00000000000..3e9a0a3af2c--- /dev/null+++ b/src/app/[variants]/(main)/settings/chat-appearance/features/ChatAppearance/HighlighterPreview.tsx@@ -0,0 +1,20 @@+import { Highlighter, type HighlighterProps } from '@lobehub/ui';++const code = `+const person = { name: "Alice", age: 30 };+type PersonType = typeof person; // { name: string; age: number }++// 'satisfies' to ensure a type matches but allows more specific types+type Animal = { name: string };+const dog = { name: "Buddy", breed: "Golden Retriever" } satisfies Animal;+`;++const HighlighterPreview = ({ theme }: { theme?: HighlighterProps['theme'] }) => {+ return (+ <Highlighter copyable={false} language={'ts'} showLanguage={false} theme={theme}>+ {code}+ </Highlighter>+ );+};++export default HighlighterPreview;diff --git a/src/app/[variants]/(main)/settings/chat-appearance/features/ChatAppearance/MermaidPreview.tsx b/src/app/[variants]/(main)/settings/chat-appearance/features/ChatAppearance/MermaidPreview.tsxnew file mode 100644index 00000000000..42f64e1f12d--- /dev/null+++ b/src/app/[variants]/(main)/settings/chat-appearance/features/ChatAppearance/MermaidPreview.tsx@@ -0,0 +1,20 @@+import { Center, Flexbox, type MermaidProps } from '@lobehub/ui';+import { Mermaid } from '@lobehub/ui';++const code = `sequenceDiagram+ Alice->>John: Hello John, how are you?+ John-->>Alice: Great!+ Alice-)John: See you later!+`;++const MermaidPreview = ({ theme }: { theme?: MermaidProps['theme'] }) => {+ return (+ <Center height={280}>+ <Flexbox width={480}>+ <Mermaid theme={theme}>{code}</Mermaid>+ </Flexbox>+ </Center>+ );+};++export default MermaidPreview;diff --git a/src/app/[variants]/(main)/settings/chat-appearance/features/ChatAppearance/index.tsx b/src/app/[variants]/(main)/settings/chat-appearance/features/ChatAppearance/index.tsxnew file mode 100644index 00000000000..9486d91a67a--- /dev/null+++ b/src/app/[variants]/(main)/settings/chat-appearance/features/ChatAppearance/index.tsx@@ -0,0 +1,185 @@+'use client';++import {+ Flexbox,+ FormGroup,+ Icon,+ Segmented,+ Select,+ Skeleton,+ SliderWithInput,+ highlighterThemes,+ mermaidThemes,+} from '@lobehub/ui';+import isEqual from 'fast-deep-equal';+import { Loader2Icon } from 'lucide-react';+import { memo, useState } from 'react';+import { useTranslation } from 'react-i18next';++import { useUserStore } from '@/store/user';+import { settingsSelectors } from '@/store/user/selectors';++import ChatPreview from './ChatPreview';+import ChatTransitionPreview from './ChatTransitionPreview';+import HighlighterPreview from './HighlighterPreview';+import MermaidPreview from './MermaidPreview';++const ChatAppearance = memo(() => {+ const { t } = useTranslation('setting');+ const { general } = useUserStore(settingsSelectors.currentSettings, isEqual);+ const [setSettings, isUserStateInit] = useUserStore((s) => [s.setSettings, s.isUserStateInit]);+ const [loadingStates, setLoadingStates] = useState<Record<string, boolean>>({});++ if (!isUserStateInit) return <Skeleton active paragraph={{ rows: 5 }} title={false} />;++ const handleChange = async (key: string, value: any) => {+ setLoadingStates((prev) => ({ ...prev, [key]: true }));+ await setSettings({ general: { [key]: value } });+ setLoadingStates((prev) => ({ ...prev, [key]: false }));+ };++ return (+ <>+ <FormGroup+ collapsible={false}+ desc={t('settingChatAppearance.transitionMode.desc')}+ extra={+ <Flexbox align={'center'} gap={8} horizontal>+ {loadingStates.transitionMode && (+ <Icon icon={Loader2Icon} size={16} spin style={{ opacity: 0.5 }} />+ )}+ <Segmented+ onChange={(value) => handleChange('transitionMode', value)}+ options={[+ {+ label: t('settingChatAppearance.transitionMode.options.none.value'),+ value: 'none',+ },+ {+ label: t('settingChatAppearance.transitionMode.options.fadeIn'),+ value: 'fadeIn',+ },+ {+ label: t('settingChatAppearance.transitionMode.options.smooth'),+ value: 'smooth',+ },+ ]}+ value={general.transitionMode}+ variant={'outlined'}+ />+ </Flexbox>+ }+ gap={16}+ title={t('settingChatAppearance.transitionMode.title')}+ variant={'filled'}+ >+ <ChatTransitionPreview key={general.transitionMode} mode={general.transitionMode} />+ </FormGroup>++ <FormGroup+ collapsible={false}+ desc={t('settingChatAppearance.fontSize.desc')}+ extra={+ <Flexbox align={'center'} gap={8} horizontal>+ {loadingStates.fontSize && (+ <Icon icon={Loader2Icon} size={16} spin style={{ opacity: 0.5 }} />+ )}+ <SliderWithInput+ marks={{+ 12: {+ label: 'A',+ style: {+ fontSize: 12,+ marginTop: 4,+ },+ },+ 14: {+ label: t('settingChatAppearance.fontSize.marks.normal'),+ style: {+ fontSize: 14,+ marginTop: 4,+ },+ },+ 18: {+ label: 'A',+ style: {+ fontSize: 18,+ marginTop: 4,+ },+ },+ }}+ max={18}+ min={12}+ onChange={(value) => handleChange('fontSize', value)}+ step={1}+ style={{+ width: 240,+ }}+ value={general.fontSize}+ />+ </Flexbox>+ }+ gap={16}+ title={t('settingChatAppearance.fontSize.title')}+ variant={'filled'}+ >+ <ChatPreview fontSize={general.fontSize} />+ </FormGroup>++ <FormGroup+ collapsible={false}+ extra={+ <Flexbox align={'center'} gap={8} horizontal>+ {loadingStates.highlighterTheme && (+ <Icon icon={Loader2Icon} size={16} spin style={{ opacity: 0.5 }} />+ )}+ <Select+ onChange={(value) => handleChange('highlighterTheme', value)}+ options={highlighterThemes.map((item) => ({+ label: item.displayName,+ value: item.id,+ }))}+ style={{+ width: 240,+ }}+ value={general.highlighterTheme}+ />+ </Flexbox>+ }+ gap={16}+ title={t('settingChatAppearance.highlighterTheme.title')}+ variant={'filled'}+ >+ <HighlighterPreview theme={general.highlighterTheme} />+ </FormGroup>++ <FormGroup+ extra={+ <Flexbox align={'center'} gap={8} horizontal>+ {loadingStates.mermaidTheme && (+ <Icon icon={Loader2Icon} size={16} spin style={{ opacity: 0.5 }} />+ )}+ <Select+ onChange={(value) => handleChange('mermaidTheme', value)}+ options={mermaidThemes.map((item) => ({+ label: item.displayName,+ value: item.id,+ }))}+ style={{+ width: 240,+ }}+ value={general.mermaidTheme}+ />+ </Flexbox>+ }+ gap={16}+ title={t('settingChatAppearance.mermaidTheme.title')}+ variant={'filled'}+ >+ <MermaidPreview theme={general.mermaidTheme} />+ </FormGroup>+ </>+ );+});++export default ChatAppearance;diff --git a/src/app/[variants]/(main)/settings/chat-appearance/index.tsx b/src/app/[variants]/(main)/settings/chat-appearance/index.tsxindex c32dbbbf9bb..1c5d5e1a085 100644--- a/src/app/[variants]/(main)/settings/chat-appearance/index.tsx+++ b/src/app/[variants]/(main)/settings/chat-appearance/index.tsx@@ -1,7 +1,18 @@-import ChatAppearance from '../common/features/ChatAppearance';+import { useTranslation } from 'react-i18next';++import SettingHeader from '@/app/[variants]/(main)/settings/features/SettingHeader';++import ChatAppearance from './features/ChatAppearance';const Page = () => {- return <ChatAppearance />;+ const { t } = useTranslation('setting');++ return (+ <>+ <SettingHeader title={t('tab.chatAppearance')} />+ <ChatAppearance />+ </>+ );};Page.displayName = 'ChatAppearanceSetting';diff --git a/src/app/[variants]/(main)/settings/common/features/Appearance/index.tsx b/src/app/[variants]/(main)/settings/common/features/Appearance/index.tsxindex 9572ad1b72c..3511337e812 100644--- a/src/app/[variants]/(main)/settings/common/features/Appearance/index.tsx+++ b/src/app/[variants]/(main)/settings/common/features/Appearance/index.tsx@@ -50,6 +50,7 @@ const Appearance = memo(() => {return (<Form+ collapsible={false}initialValues={general}items={[theme]}itemsType={'group'}@@ -58,7 +59,7 @@ const Appearance = memo(() => {await setSettings({ general: value });setLoading(false);}}- variant={'borderless'}+ variant={'filled'}{...FORM_STYLE}/>);diff --git a/src/app/[variants]/(main)/settings/common/features/ChatAppearance/ChatPreview.tsx b/src/app/[variants]/(main)/settings/common/features/ChatAppearance/ChatPreview.tsxdeleted file mode 100644index e4ce8abca03..00000000000--- a/src/app/[variants]/(main)/settings/common/features/ChatAppearance/ChatPreview.tsx+++ /dev/null@@ -1,35 +0,0 @@-import { BRANDING_NAME } from '@lobechat/business-const';-import { Block, type MarkdownProps } from '@lobehub/ui';-import { ChatItem } from '@lobehub/ui/chat';-import { useTheme } from 'antd-style';-import { memo } from 'react';-import { useTranslation } from 'react-i18next';--import { DEFAULT_INBOX_AVATAR } from '@/const/meta';--const ChatPreview = memo<Pick<MarkdownProps, 'fontSize'>>(({ fontSize }) => {- const theme = useTheme();- const { t } = useTranslation('welcome');- return (- <Block- style={{- background: theme.colorBgContainerSecondary,- marginBlock: 16,- minHeight: 110,- }}- variant={'outlined'}- >- <ChatItem- avatar={{- avatar: DEFAULT_INBOX_AVATAR,- }}- fontSize={fontSize}- message={t('guide.defaultMessageWithoutCreate', {- appName: BRANDING_NAME,- })}- />- </Block>- );-});--export default ChatPreview;diff --git a/src/app/[variants]/(main)/settings/common/features/ChatAppearance/HighlighterPreview.tsx b/src/app/[variants]/(main)/settings/common/features/ChatAppearance/HighlighterPreview.tsxdeleted file mode 100644index 8ba33d5178f..00000000000--- a/src/app/[variants]/(main)/settings/common/features/ChatAppearance/HighlighterPreview.tsx+++ /dev/null@@ -1,55 +0,0 @@-import { Block, type HighlighterProps } from '@lobehub/ui';-import { ChatItem } from '@lobehub/ui/chat';-import { useTheme } from 'antd-style';-import { memo } from 'react';--import { DEFAULT_INBOX_AVATAR } from '@/const/meta';--const code = `-\`\`\`ts-const person = { name: "Alice", age: 30 };-type PersonType = typeof person; // { name: string; age: number }--// 'satisfies' to ensure a type matches but allows more specific types-type Animal = { name: string };-const dog = { name: "Buddy", breed: "Golden Retriever" } satisfies Animal;-\`\`\`-`;--const HighlighterPreview = memo<{ theme?: HighlighterProps['theme'] }>(- ({ theme }) => {- const token = useTheme();-- return (- <Block- style={{- background: token.colorBgContainerSecondary,- marginBlock: 16,- minHeight: 260,- paddingBottom: 16,- }}- variant={'outlined'}- >- <ChatItem- avatar={{- avatar: DEFAULT_INBOX_AVATAR,- }}- markdownProps={{- componentProps: {- highlight: {- fullFeatured: false,- theme,- },- },- }}- message={code}- />- </Block>- );- },- (prevProps, nextProps) => {- return prevProps.theme === nextProps.theme;- },-);--export default HighlighterPreview;diff --git a/src/app/[variants]/(main)/settings/common/features/ChatAppearance/MermaidPreview.tsx b/src/app/[variants]/(main)/settings/common/features/ChatAppearance/MermaidPreview.tsxdeleted file mode 100644index 8386dcfc166..00000000000--- a/src/app/[variants]/(main)/settings/common/features/ChatAppearance/MermaidPreview.tsx+++ /dev/null@@ -1,51 +0,0 @@-import { Block, type MermaidProps } from '@lobehub/ui';-import { ChatItem } from '@lobehub/ui/chat';-import { useTheme } from 'antd-style';-import { memo } from 'react';--import { DEFAULT_INBOX_AVATAR } from '@/const/meta';--const code = `\`\`\`mermaid-sequenceDiagram- Alice->>John: Hello John, how are you?- John-->>Alice: Great!- Alice-)John: See you later!-\`\`\`-`;--const MermaidPreview = memo<{ theme?: MermaidProps['theme'] }>(- ({ theme }) => {- const token = useTheme();- return (- <Block- style={{- background: token.colorBgContainerSecondary,- marginBlock: 16,- minHeight: 320,- paddingBottom: 16,- }}- variant={'outlined'}- >- <ChatItem- avatar={{- avatar: DEFAULT_INBOX_AVATAR,- }}- markdownProps={{- componentProps: {- mermaid: {- fullFeatured: false,- theme,- },- },- }}- message={code}- />- </Block>- );- },- (prevProps, nextProps) => {- return prevProps.theme === nextProps.theme;- },-);--export default MermaidPreview;diff --git a/src/app/[variants]/(main)/settings/common/features/ChatAppearance/index.tsx b/src/app/[variants]/(main)/settings/common/features/ChatAppearance/index.tsxdeleted file mode 100644index 7dc4b403735..00000000000--- a/src/app/[variants]/(main)/settings/common/features/ChatAppearance/index.tsx+++ /dev/null@@ -1,174 +0,0 @@-'use client';--import {- Form,- type FormGroupItemType,- Icon,- Segmented,- Select,- SliderWithInput,- highlighterThemes,- mermaidThemes,-} from '@lobehub/ui';-import { Skeleton } from '@lobehub/ui';-import { cssVar } from 'antd-style';-import isEqual from 'fast-deep-equal';-import { Loader2Icon, TriangleAlert } from 'lucide-react';-import { memo, useState } from 'react';-import { useTranslation } from 'react-i18next';--import { FORM_STYLE } from '@/const/layoutTokens';-import { useUserStore } from '@/store/user';-import { settingsSelectors } from '@/store/user/selectors';--import ChatPreview from './ChatPreview';-import ChatTransitionPreview from './ChatTransitionPreview';-import HighlighterPreview from './HighlighterPreview';-import MermaidPreview from './MermaidPreview';--const ChatAppearance = memo(() => {- const { t } = useTranslation('setting');- const { general } = useUserStore(settingsSelectors.currentSettings, isEqual);- const [setSettings, isUserStateInit] = useUserStore((s) => [s.setSettings, s.isUserStateInit]);- const [loading, setLoading] = useState(false);-- if (!isUserStateInit) return <Skeleton active paragraph={{ rows: 5 }} title={false} />;-- const themeItems: FormGroupItemType = {- children: [- {- children: (- <ChatTransitionPreview key={general.transitionMode} mode={general.transitionMode} />- ),- noStyle: true,- },- {- children: (- <Segmented- block- options={[- {- label: t('settingChatAppearance.transitionMode.options.none.value'),- value: 'none',- },- {- label: t('settingChatAppearance.transitionMode.options.fadeIn'),- value: 'fadeIn',- },- {- label: t('settingChatAppearance.transitionMode.options.smooth'),- value: 'smooth',- },- ]}- />- ),- desc: t('settingChatAppearance.transitionMode.desc'),- label: t('settingChatAppearance.transitionMode.title'),- name: 'transitionMode',- tooltip:- general.transitionMode === 'none'- ? {- icon: (- <TriangleAlert- color={cssVar.colorWarning}- size={14}- style={{ alignSelf: 'flex-end', marginBlockEnd: 2, marginInlineStart: 8 }}- />- ),- title: t('settingChatAppearance.transitionMode.options.none.desc'),- }- : undefined,- },- {- children: <ChatPreview fontSize={general.fontSize} />,- noStyle: true,- },- {- children: (- <SliderWithInput- marks={{- 12: {- label: 'A',- style: {- fontSize: 12,- marginTop: 4,- },- },- 14: {- label: t('settingChatAppearance.fontSize.marks.normal'),- style: {- fontSize: 14,- marginTop: 4,- },- },- 18: {- label: 'A',- style: {- fontSize: 18,- marginTop: 4,- },- },- }}- max={18}- min={12}- step={1}- />- ),- desc: t('settingChatAppearance.fontSize.desc'),- label: t('settingChatAppearance.fontSize.title'),- name: 'fontSize',- },- {- children: <HighlighterPreview theme={general.highlighterTheme} />,- noStyle: true,- },- {- children: (- <Select- options={highlighterThemes.map((item) => ({- label: item.displayName,- value: item.id,- }))}- />- ),- label: t('settingChatAppearance.highlighterTheme.title'),- name: 'highlighterTheme',- },- {- children: <MermaidPreview theme={general.mermaidTheme} />,- noStyle: true,- },- {- children: (- <Select- options={mermaidThemes.map((item) => ({- label: item.displayName,- value: item.id,- }))}- />- ),- label: t('settingChatAppearance.mermaidTheme.title'),- name: 'mermaidTheme',- },- ],- extra: loading && <Icon icon={Loader2Icon} size={16} spin style={{ opacity: 0.5 }} />,- title: t('settingChatAppearance.title'),- };-- return (- <Form- initialValues={general}- items={[themeItems]}- itemsType={'group'}- onValuesChange={async (value) => {- setLoading(true);- await setSettings({ general: value });- setLoading(false);- }}- variant={'borderless'}- {...FORM_STYLE}- />- );-});--export default ChatAppearance;diff --git a/src/app/[variants]/(main)/settings/common/features/Common/Common.tsx b/src/app/[variants]/(main)/settings/common/features/Common/Common.tsxindex 6100fbe3ef9..95d3c860658 100644--- a/src/app/[variants]/(main)/settings/common/features/Common/Common.tsx+++ b/src/app/[variants]/(main)/settings/common/features/Common/Common.tsx@@ -186,6 +186,7 @@ const Common = memo(() => {return (<Form+ collapsible={false}initialValues={general}items={[theme]}itemsType={'group'}@@ -194,7 +195,7 @@ const Common = memo(() => {await setSettings({ general: v });setLoading(false);}}- variant={'borderless'}+ variant={'filled'}{...FORM_STYLE}/>);diff --git a/src/app/[variants]/(main)/settings/common/index.tsx b/src/app/[variants]/(main)/settings/common/index.tsxindex 4e69a293118..dfc2abaade0 100644--- a/src/app/[variants]/(main)/settings/common/index.tsx+++ b/src/app/[variants]/(main)/settings/common/index.tsx@@ -1,9 +1,15 @@+import { useTranslation } from 'react-i18next';++import SettingHeader from '@/app/[variants]/(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 /></>diff --git a/src/app/[variants]/(main)/settings/features/SettingHeader.tsx b/src/app/[variants]/(main)/settings/features/SettingHeader.tsxnew file mode 100644index 00000000000..1135892d7e8--- /dev/null+++ b/src/app/[variants]/(main)/settings/features/SettingHeader.tsx@@ -0,0 +1,20 @@+import { Flexbox, Text } from '@lobehub/ui';+import { Divider } from 'antd';+import { FC, ReactNode } from 'react';++interface SettingHeaderProps {+ title: ReactNode;+}++const SettingHeader: FC<SettingHeaderProps> = ({ title }) => {+ return (+ <Flexbox gap={24} style={{ paddingTop: 12 }}>+ <Text fontSize={24} strong>+ {title}+ </Text>+ <Divider style={{ margin: 0 }} />+ </Flexbox>+ );+};++export default SettingHeader;diff --git a/src/app/[variants]/(main)/settings/features/SettingsContent.tsx b/src/app/[variants]/(main)/settings/features/SettingsContent.tsxindex 7373fca170a..0b9e1cd7fc4 100644--- a/src/app/[variants]/(main)/settings/features/SettingsContent.tsx+++ b/src/app/[variants]/(main)/settings/features/SettingsContent.tsx@@ -3,7 +3,6 @@import { ENABLE_BUSINESS_FEATURES } from '@lobechat/business-const';import dynamic from 'next/dynamic';import { Fragment } from 'react';-import { useLocation } from 'react-router-dom';import Loading from '@/components/Loading/BrandTextLoading';import NavHeader from '@/features/NavHeader';@@ -98,21 +97,7 @@ interface SettingsContentProps {mobile?: boolean;}-const secondaryBackgroundTabs = new Set([- SettingsTabs.Stats,- SettingsTabs.Plans,- SettingsTabs.Funds,- SettingsTabs.Usage,- SettingsTabs.Billing,- SettingsTabs.Referral,-]);-const SettingsContent = ({ mobile, activeTab }: SettingsContentProps) => {- const location = useLocation();- const isSecondaryBackgroundTabs = secondaryBackgroundTabs.has(- location.pathname?.split('/settings/').find(Boolean) as SettingsTabs,- );-const renderComponent = (tab: string) => {const Component = componentMap[tab as keyof typeof componentMap] || componentMap.common;if (!Component) return null;@@ -157,11 +142,7 @@ const SettingsContent = ({ mobile, activeTab }: SettingsContentProps) => {return (<Fragment key={tabKey}><NavHeader />- <SettingContainer- maxWidth={1024}- padding={24}- variant={isSecondaryBackgroundTabs ? 'secondary' : undefined}- >+ <SettingContainer maxWidth={1024} paddingBlock={'24px 128px'} paddingInline={24}>{content}</SettingContainer></Fragment>diff --git a/src/app/[variants]/(main)/settings/hotkey/features/Conversation.tsx b/src/app/[variants]/(main)/settings/hotkey/features/Conversation.tsxindex c5d00f8355e..f378f061dc4 100644--- a/src/app/[variants]/(main)/settings/hotkey/features/Conversation.tsx+++ b/src/app/[variants]/(main)/settings/hotkey/features/Conversation.tsx@@ -39,7 +39,7 @@ const HotkeySetting = memo(() => {hotkeyConflicts={hotkeyConflicts}placeholder={t('hotkey.record')}resetValue={item.keys}-/>+ />),desc: hotkeyMeta[`${item.id}.desc`] ? t(`${item.id}.desc`, { ns: 'hotkey' }) : undefined,label: t(`${item.id}.title`, { ns: 'hotkey' }),@@ -57,6 +57,7 @@ const HotkeySetting = memo(() => {return (<Form+ collapsible={false}form={form}initialValues={hotkey}items={[conversation]}@@ -66,7 +67,7 @@ const HotkeySetting = memo(() => {await setSettings({ hotkey: values });setLoading(false);}}- variant={'borderless'}+ variant={'filled'}{...FORM_STYLE}/>);diff --git a/src/app/[variants]/(main)/settings/hotkey/features/Desktop.tsx b/src/app/[variants]/(main)/settings/hotkey/features/Desktop.tsxindex 6121c1e5281..ac73250a433 100644--- a/src/app/[variants]/(main)/settings/hotkey/features/Desktop.tsx+++ b/src/app/[variants]/(main)/settings/hotkey/features/Desktop.tsx@@ -57,7 +57,7 @@ const HotkeySetting = memo(() => {}}placeholder={t('hotkey.record')}resetValue={item.keys}-value={hotkeys[item.id]}+ value={hotkeys[item.id]}/>),@@ -76,11 +76,12 @@ value={hotkeys[item.id]}return (<Form+ collapsible={false}form={form}initialValues={hotkeys}items={[desktop]}itemsType={'group'}- variant={'borderless'}+ variant={'filled'}{...FORM_STYLE}/>);diff --git a/src/app/[variants]/(main)/settings/hotkey/features/Essential.tsx b/src/app/[variants]/(main)/settings/hotkey/features/Essential.tsxindex a7b89e5aba6..2b3c259fc8b 100644--- a/src/app/[variants]/(main)/settings/hotkey/features/Essential.tsx+++ b/src/app/[variants]/(main)/settings/hotkey/features/Essential.tsx@@ -39,7 +39,7 @@ const HotkeySetting = memo(() => {hotkeyConflicts={hotkeyConflicts}placeholder={t('hotkey.record')}resetValue={item.keys}-/>+ />),desc: hotkeyMeta[`${item.id}.desc`] ? t(`${item.id}.desc`, { ns: 'hotkey' }) : undefined,label: t(`${item.id}.title`, { ns: 'hotkey' }),@@ -57,6 +57,7 @@ const HotkeySetting = memo(() => {return (<Form+ collapsible={false}form={form}initialValues={hotkey}items={[essential]}@@ -66,7 +67,7 @@ const HotkeySetting = memo(() => {await setSettings({ hotkey: values });setLoading(false);}}- variant={'borderless'}+ variant={'filled'}{...FORM_STYLE}/>);diff --git a/src/app/[variants]/(main)/settings/hotkey/index.tsx b/src/app/[variants]/(main)/settings/hotkey/index.tsxindex a1dfea2a10f..fc7d775418e 100644--- a/src/app/[variants]/(main)/settings/hotkey/index.tsx+++ b/src/app/[variants]/(main)/settings/hotkey/index.tsx@@ -1,3 +1,6 @@+import { useTranslation } from 'react-i18next';++import SettingHeader from '@/app/[variants]/(main)/settings/features/SettingHeader';import { isDesktop } from '@/const/version';import Conversation from './features/Conversation';@@ -5,8 +8,10 @@ import Desktop from './features/Desktop';import Essential from './features/Essential';const Page = () => {+ const { t } = useTranslation('setting');return (<>+ <SettingHeader title={t('tab.hotkey')} />{isDesktop && <Desktop />}<Essential /><Conversation />diff --git a/src/app/[variants]/(main)/settings/image/features/Image.tsx b/src/app/[variants]/(main)/settings/image/features/Image.tsxnew file mode 100644index 00000000000..9746980c09c--- /dev/null+++ b/src/app/[variants]/(main)/settings/image/features/Image.tsx@@ -0,0 +1,74 @@+'use client';++import { type UserImageConfig } from '@lobechat/types';+import { Form, type FormGroupItemType, Icon, Skeleton } from '@lobehub/ui';+import { Loader2Icon } from 'lucide-react';+import { memo, useState } from 'react';+import { useTranslation } from 'react-i18next';++import { FormSliderWithInput } from '@/components/FormInput';+import { FORM_STYLE } from '@/const/layoutTokens';+import { MAX_DEFAULT_IMAGE_NUM, MIN_DEFAULT_IMAGE_NUM } from '@/const/settings';+import { useUserStore } from '@/store/user';+import { settingsSelectors } from '@/store/user/slices/settings/selectors';++const ImageSettings = memo(() => {+ const { t } = useTranslation('setting');+ const [form] = Form.useForm<UserImageConfig>();+ const [isUpdating, setIsUpdating] = useState(false);++ const imageSettings = useUserStore(settingsSelectors.currentImageSettings);+ const [setSettings, isUserStateInit] = useUserStore((s) => [s.setSettings, s.isUserStateInit]);++ if (!isUserStateInit) {+ return <Skeleton active paragraph={{ rows: 1 }} title={false} />;+ }++ const items: FormGroupItemType[] = [+ {+ children: [+ {+ children: (+ <FormSliderWithInput+ disabled={isUpdating}+ max={MAX_DEFAULT_IMAGE_NUM}+ min={MIN_DEFAULT_IMAGE_NUM}+ step={1}+ />+ ),+ desc: t('settingImage.defaultCount.desc'),+ label: t('settingImage.defaultCount.label'),+ name: 'defaultImageNum',+ },+ ],+ extra: isUpdating ? (+ <Icon icon={Loader2Icon} size={16} spin style={{ opacity: 0.6 }} />+ ) : undefined,+ title: t('settingImage.defaultCount.title'),+ },+ ];++ return (+ <Form+ collapsible={false}+ form={form}+ initialValues={imageSettings}+ items={items}+ itemsType={'group'}+ onValuesChange={async (values) => {+ setIsUpdating(true);+ try {+ await setSettings({ image: values });+ } finally {+ setIsUpdating(false);+ }+ }}+ variant={'filled'}+ {...FORM_STYLE}+ />+ );+});++ImageSettings.displayName = 'ImageSettings';++export default ImageSettings;diff --git a/src/app/[variants]/(main)/settings/image/index.tsx b/src/app/[variants]/(main)/settings/image/index.tsxindex ccb6085dcdf..812f2fedd21 100644--- a/src/app/[variants]/(main)/settings/image/index.tsx+++ b/src/app/[variants]/(main)/settings/image/index.tsx@@ -1,74 +1,19 @@-'use client';--import { type UserImageConfig } from '@lobechat/types';-import { Form, type FormGroupItemType, Icon } from '@lobehub/ui';-import { Skeleton } from '@lobehub/ui';-import { Loader2Icon } from 'lucide-react';-import { memo, useState } from 'react';import { useTranslation } from 'react-i18next';-import { FormSliderWithInput } from '@/components/FormInput';-import { FORM_STYLE } from '@/const/layoutTokens';-import { MAX_DEFAULT_IMAGE_NUM, MIN_DEFAULT_IMAGE_NUM } from '@/const/settings';-import { useUserStore } from '@/store/user';-import { settingsSelectors } from '@/store/user/slices/settings/selectors';--const ImageSettings = memo(() => {- const { t } = useTranslation('setting');- const [form] = Form.useForm<UserImageConfig>();- const [isUpdating, setIsUpdating] = useState(false);-- const imageSettings = useUserStore(settingsSelectors.currentImageSettings);- const [setSettings, isUserStateInit] = useUserStore((s) => [s.setSettings, s.isUserStateInit]);-- if (!isUserStateInit) {- return <Skeleton active paragraph={{ rows: 1 }} title={false} />;- }+import SettingHeader from '@/app/[variants]/(main)/settings/features/SettingHeader';- const items: FormGroupItemType[] = [- {- children: [- {- children: (- <FormSliderWithInput- disabled={isUpdating}- max={MAX_DEFAULT_IMAGE_NUM}- min={MIN_DEFAULT_IMAGE_NUM}- step={1}- />- ),- desc: t('settingImage.defaultCount.desc'),- label: t('settingImage.defaultCount.label'),- name: 'defaultImageNum',- },- ],- extra: isUpdating ? (- <Icon icon={Loader2Icon} size={16} spin style={{ opacity: 0.6 }} />- ) : undefined,- title: t('settingImage.defaultCount.title'),- },- ];+import Image from './features/Image';+const Page = () => {+ const { t } = useTranslation('setting');return (- <Form- form={form}- initialValues={imageSettings}- items={items}- itemsType={'group'}- onValuesChange={async (values) => {- setIsUpdating(true);- try {- await setSettings({ image: values });- } finally {- setIsUpdating(false);- }- }}- variant={'borderless'}- {...FORM_STYLE}- />+ <>+ <SettingHeader title={t('tab.image')} />+ <Image />+ </>);-});+};-ImageSettings.displayName = 'ImageSettings';+Page.displayName = 'ImageSetting';-export default ImageSettings;+export default Page;diff --git a/src/app/[variants]/(main)/settings/memory/features/Memory.tsx b/src/app/[variants]/(main)/settings/memory/features/Memory.tsxnew file mode 100644index 00000000000..d93406ee0f6--- /dev/null+++ b/src/app/[variants]/(main)/settings/memory/features/Memory.tsx@@ -0,0 +1,57 @@+'use client';++import { Form, type FormGroupItemType, Icon, Skeleton } from '@lobehub/ui';+import { Switch } from 'antd';+import isEqual from 'fast-deep-equal';+import { Loader2Icon } from 'lucide-react';+import { memo, useState } from 'react';+import { useTranslation } from 'react-i18next';++import { FORM_STYLE } from '@/const/layoutTokens';+import { useUserStore } from '@/store/user';+import { settingsSelectors } from '@/store/user/selectors';++const MemorySetting = memo(() => {+ const { t } = useTranslation('setting');+ const [form] = Form.useForm();+ const { memory } = useUserStore(settingsSelectors.currentSettings, isEqual);+ const [setSettings, isUserStateInit] = useUserStore((s) => [s.setSettings, s.isUserStateInit]);+ const [loading, setLoading] = useState(false);++ if (!isUserStateInit) return <Skeleton active paragraph={{ rows: 3 }} title={false} />;++ const memorySettings: FormGroupItemType = {+ children: [+ {+ children: <Switch />,+ desc: t('memory.enabled.desc'),+ label: t('memory.enabled.title'),+ layout: 'horizontal',+ minWidth: undefined,+ name: 'enabled',+ valuePropName: 'checked',+ },+ ],+ extra: loading && <Icon icon={Loader2Icon} size={16} spin style={{ opacity: 0.5 }} />,+ title: t('memory.title'),+ };++ return (+ <Form+ collapsible={false}+ form={form}+ initialValues={memory}+ items={[memorySettings]}+ itemsType={'group'}+ onValuesChange={async (values) => {+ setLoading(true);+ await setSettings({ memory: values });+ setLoading(false);+ }}+ variant={'filled'}+ {...FORM_STYLE}+ />+ );+});++export default MemorySetting;diff --git a/src/app/[variants]/(main)/settings/memory/index.tsx b/src/app/[variants]/(main)/settings/memory/index.tsxindex 23aaf96207a..a550d0d081c 100644--- a/src/app/[variants]/(main)/settings/memory/index.tsx+++ b/src/app/[variants]/(main)/settings/memory/index.tsx@@ -1,57 +1,18 @@-'use client';--import { Form, type FormGroupItemType, Icon, Skeleton } from '@lobehub/ui';-import { Switch } from 'antd';-import isEqual from 'fast-deep-equal';-import { Loader2Icon } from 'lucide-react';-import { memo, useState } from 'react';import { useTranslation } from 'react-i18next';-import { FORM_STYLE } from '@/const/layoutTokens';-import { useUserStore } from '@/store/user';-import { settingsSelectors } from '@/store/user/selectors';--const Page = memo(() => {- const { t } = useTranslation('setting');- const [form] = Form.useForm();- const { memory } = useUserStore(settingsSelectors.currentSettings, isEqual);- const [setSettings, isUserStateInit] = useUserStore((s) => [s.setSettings, s.isUserStateInit]);- const [loading, setLoading] = useState(false);+import SettingHeader from '@/app/[variants]/(main)/settings/features/SettingHeader';- if (!isUserStateInit) return <Skeleton active paragraph={{ rows: 3 }} title={false} />;-- const memorySettings: FormGroupItemType = {- children: [- {- children: <Switch />,- desc: t('memory.enabled.desc'),- label: t('memory.enabled.title'),- layout: 'horizontal',- minWidth: undefined,- name: 'enabled',- valuePropName: 'checked',- },- ],- extra: loading && <Icon icon={Loader2Icon} size={16} spin style={{ opacity: 0.5 }} />,- title: t('memory.title'),- };+import Memory from './features/Memory';+const Page = () => {+ const { t } = useTranslation('setting');return (- <Form- form={form}- initialValues={memory}- items={[memorySettings]}- itemsType={'group'}- onValuesChange={async (values) => {- setLoading(true);- await setSettings({ memory: values });- setLoading(false);- }}- variant={'borderless'}- {...FORM_STYLE}- />+ <>+ <SettingHeader title={t('tab.memory')} />+ <Memory />+ </>);-});+};Page.displayName = 'MemorySetting';diff --git a/src/app/[variants]/(main)/settings/profile/Client.tsx b/src/app/[variants]/(main)/settings/profile/Client.tsxdeleted file mode 100644index c5e42a231d7..00000000000--- a/src/app/[variants]/(main)/settings/profile/Client.tsx+++ /dev/null@@ -1,808 +0,0 @@-'use client';--import { LoadingOutlined } from '@ant-design/icons';-import { isDesktop } from '@lobechat/const';-import { Block, Button, Flexbox, Icon, Input, Skeleton, Tag, Text } from '@lobehub/ui';-import { Divider, Spin, Upload } from 'antd';-import { cssVar } from 'antd-style';-import { BriefcaseIcon } from 'lucide-react';-import { AnimatePresence, m as motion } from 'motion/react';-import {- type CSSProperties,- type ChangeEvent,- type ReactNode,- memo,- useCallback,- useEffect,- useMemo,- useState,-} from 'react';-import { useTranslation } from 'react-i18next';--import { INTEREST_AREAS } from '@/app/[variants]/onboarding/config';-import { notification } from '@/components/AntdStaticMethods';-import { fetchErrorNotification } from '@/components/Error/fetchErrorNotification';-import { enableAuth } from '@/const/auth';-import UserAvatar from '@/features/User/UserAvatar';-import { useServerConfigStore } from '@/store/serverConfig';-import { serverConfigSelectors } from '@/store/serverConfig/selectors';-import { useUserStore } from '@/store/user';-import { authSelectors, userProfileSelectors } from '@/store/user/selectors';-import { imageToBase64 } from '@/utils/imageToBase64';-import { createUploadImageHandler } from '@/utils/uploadFIle';--import KlavisAuthorizationList from './features/KlavisAuthorizationList';-import SSOProvidersList from './features/SSOProvidersList';--interface ProfileRowProps {- action?: ReactNode;- children: ReactNode;- label: string;- mobile?: boolean;-}--const rowStyle: CSSProperties = {- minHeight: 48,- padding: '16px 0',-};--const labelStyle: CSSProperties = {- flexShrink: 0,- width: 160,-};--const ProfileRow = memo<ProfileRowProps>(({ label, children, action, mobile }) => {- if (mobile) {- return (- <Flexbox gap={12} style={rowStyle}>- <Flexbox align="center" horizontal justify="space-between">- <Text strong>{label}</Text>- {action}- </Flexbox>- <Flexbox>{children}</Flexbox>- </Flexbox>- );- }-- return (- <Flexbox align="center" gap={24} horizontal justify="space-between" style={rowStyle}>- <Flexbox align="center" gap={24} horizontal style={{ flex: 1 }}>- <Text style={labelStyle}>{label}</Text>- <Flexbox style={{ flex: 1 }}>{children}</Flexbox>- </Flexbox>- {action && <Flexbox>{action}</Flexbox>}- </Flexbox>- );-});--const AvatarRow = memo<{ mobile?: boolean }>(({ mobile }) => {- const { t } = useTranslation('auth');- const isLogin = useUserStore(authSelectors.isLogin);- const updateAvatar = useUserStore((s) => s.updateAvatar);- const [uploading, setUploading] = useState(false);-- const handleUploadAvatar = useCallback(- createUploadImageHandler(async (avatar) => {- try {- setUploading(true);- const img = new Image();- img.src = avatar;-- await new Promise((resolve, reject) => {- img.addEventListener('load', resolve);- img.addEventListener('error', reject);- });-- const webpBase64 = imageToBase64({ img, size: 256 });- 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,- });- }- }),- [updateAvatar],- );-- const canUpload = !enableAuth || isLogin;-- const avatarContent = canUpload ? (- <Spin indicator={<LoadingOutlined spin />} spinning={uploading}>- <Upload beforeUpload={handleUploadAvatar} itemRender={() => void 0} maxCount={1}>- <UserAvatar clickable size={40} />- </Upload>- </Spin>- ) : (- <UserAvatar size={40} />- );-- const updateAction = canUpload ? (- <Upload beforeUpload={handleUploadAvatar} itemRender={() => void 0} maxCount={1}>- <Text fontSize={13} style={{ cursor: 'pointer' }}>- {t('profile.updateAvatar')}- </Text>- </Upload>- ) : null;-- if (mobile) {- return (- <Flexbox gap={12} style={rowStyle}>- <Flexbox align="center" horizontal justify="space-between">- <Text strong>{t('profile.avatar')}</Text>- {updateAction}- </Flexbox>- <Flexbox>{avatarContent}</Flexbox>- </Flexbox>- );- }-- return (- <Flexbox align="center" gap={24} horizontal justify="space-between" style={rowStyle}>- <Flexbox align="center" gap={24} horizontal style={{ flex: 1 }}>- <Text style={labelStyle}>{t('profile.avatar')}</Text>- <Flexbox style={{ flex: 1 }}>{avatarContent}</Flexbox>- </Flexbox>- {updateAction}- </Flexbox>- );-});--const FullNameRow = memo<{ mobile?: boolean }>(({ mobile }) => {- const { t } = useTranslation('auth');- const fullName = useUserStore(userProfileSelectors.fullName);- const updateFullName = useUserStore((s) => s.updateFullName);- const [isEditing, setIsEditing] = useState(false);- const [editValue, setEditValue] = useState('');- const [saving, setSaving] = useState(false);-- const handleStartEdit = () => {- setEditValue(fullName || '');- setIsEditing(true);- };-- const handleCancel = () => {- setIsEditing(false);- setEditValue('');- };-- const handleSave = useCallback(async () => {- if (!editValue.trim()) return;-- try {- setSaving(true);- await updateFullName(editValue.trim());- setIsEditing(false);- } catch (error) {- console.error('Failed to update fullName:', error);- fetchErrorNotification.error({- errorMessage: error instanceof Error ? error.message : String(error),- status: 500,- });- } finally {- setSaving(false);- }- }, [editValue, updateFullName]);-- const editingContent = (- <motion.div- animate={{ opacity: 1, y: 0 }}- exit={{ opacity: 0, y: -10 }}- initial={{ opacity: 0, y: -10 }}- key="editing"- transition={{ duration: 0.2 }}- >- <Flexbox gap={12}>- {!mobile && <Text strong>{t('profile.fullNameInputHint')}</Text>}- <Input- autoFocus- onChange={(e) => setEditValue(e.target.value)}- onPressEnter={handleSave}- placeholder={t('profile.fullName')}- value={editValue}- />- <Flexbox gap={8} horizontal justify="flex-end">- <Button disabled={saving} onClick={handleCancel} size="small">- {t('profile.cancel')}- </Button>- <Button loading={saving} onClick={handleSave} size="small" type="primary">- {t('profile.save')}- </Button>- </Flexbox>- </Flexbox>- </motion.div>- );-- const displayContent = (- <motion.div- animate={{ opacity: 1 }}- exit={{ opacity: 0 }}- initial={{ opacity: 0 }}- key="display"- transition={{ duration: 0.2 }}- >- {mobile ? (- <Text>{fullName || '--'}</Text>- ) : (- <Flexbox align="center" horizontal justify="space-between">- <Text>{fullName || '--'}</Text>- <Text onClick={handleStartEdit} style={{ cursor: 'pointer', fontSize: 13 }}>- {t('profile.updateFullName')}- </Text>- </Flexbox>- )}- </motion.div>- );-- if (mobile) {- return (- <Flexbox gap={12} style={rowStyle}>- <Flexbox align="center" horizontal justify="space-between">- <Text strong>{t('profile.fullName')}</Text>- {!isEditing && (- <Text onClick={handleStartEdit} style={{ cursor: 'pointer', fontSize: 13 }}>- {t('profile.updateFullName')}- </Text>- )}- </Flexbox>- <AnimatePresence mode="wait">{isEditing ? editingContent : displayContent}</AnimatePresence>- </Flexbox>- );- }-- return (- <Flexbox gap={24} horizontal style={rowStyle}>- <Text style={labelStyle}>{t('profile.fullName')}</Text>- <Flexbox style={{ flex: 1 }}>- <AnimatePresence mode="wait">{isEditing ? editingContent : displayContent}</AnimatePresence>- </Flexbox>- </Flexbox>- );-});--const InterestsRow = memo<{ mobile?: boolean }>(({ mobile }) => {- const { t } = useTranslation('auth');- const { t: tOnboarding } = useTranslation('onboarding');- const interests = useUserStore(userProfileSelectors.interests);- const updateInterests = useUserStore((s) => s.updateInterests);- const [isEditing, setIsEditing] = useState(false);- const [selectedInterests, setSelectedInterests] = useState<string[]>([]);- const [customInput, setCustomInput] = useState('');- const [showCustomInput, setShowCustomInput] = useState(false);- const [saving, setSaving] = useState(false);-- const areas = useMemo(- () =>- INTEREST_AREAS.map((area) => ({- ...area,- label: tOnboarding(`interests.area.${area.key}`),- })),- [tOnboarding],- );-- const handleStartEdit = () => {- setSelectedInterests([...interests]);- setIsEditing(true);- };-- const handleCancel = () => {- setIsEditing(false);- setSelectedInterests([]);- setCustomInput('');- setShowCustomInput(false);- };-- const toggleInterest = useCallback((label: string) => {- setSelectedInterests((prev) =>- prev.includes(label) ? prev.filter((i) => i !== label) : [...prev, label],- );- }, []);-- const handleAddCustom = useCallback(() => {- const trimmed = customInput.trim();- if (trimmed && !selectedInterests.includes(trimmed)) {- setSelectedInterests((prev) => [...prev, trimmed]);- setCustomInput('');- }- }, [customInput, selectedInterests]);-- const handleSave = useCallback(async () => {- // Include custom input if has content- const finalInterests = [...selectedInterests];- const trimmedCustom = customInput.trim();- if (showCustomInput && trimmedCustom && !finalInterests.includes(trimmedCustom)) {- finalInterests.push(trimmedCustom);- }-- // Deduplicate- const uniqueInterests = [...new Set(finalInterests)];-- try {- setSaving(true);- await updateInterests(uniqueInterests);- setIsEditing(false);- setSelectedInterests([]);- setCustomInput('');- setShowCustomInput(false);- } catch (error) {- console.error('Failed to update interests:', error);- fetchErrorNotification.error({- errorMessage: error instanceof Error ? error.message : String(error),- status: 500,- });- } finally {- setSaving(false);- }- }, [selectedInterests, customInput, showCustomInput, updateInterests]);-- const editingContent = (- <motion.div- animate={{ opacity: 1, y: 0 }}- exit={{ opacity: 0, y: -10 }}- initial={{ opacity: 0, y: -10 }}- key="editing"- transition={{ duration: 0.2 }}- >- <Flexbox gap={12}>- <Flexbox align="center" gap={8} horizontal wrap="wrap">- {areas.map((item) => {- const isSelected = selectedInterests.includes(item.label);- return (- <Block- clickable- gap={8}- horizontal- key={item.key}- onClick={() => toggleInterest(item.label)}- padding={8}- style={- isSelected- ? {- background: cssVar.colorFillSecondary,- borderColor: cssVar.colorFillSecondary,- }- : {}- }- variant="outlined"- >- <Icon color={cssVar.colorTextSecondary} icon={item.icon} size={14} />- <Text fontSize={13} weight={500}>- {item.label}- </Text>- </Block>- );- })}- {/* Render custom interests with same Block style but no icon */}- {selectedInterests- .filter((i) => !areas.some((a) => a.label === i))- .map((interest) => (- <Block- clickable- key={interest}- onClick={() => toggleInterest(interest)}- padding={8}- style={{- background: cssVar.colorFillSecondary,- borderColor: cssVar.colorFillSecondary,- }}- variant="outlined"- >- <Text fontSize={13} weight={500}>- {interest}- </Text>- </Block>- ))}- <Block- clickable- gap={8}- horizontal- onClick={() => setShowCustomInput(!showCustomInput)}- padding={8}- style={- showCustomInput- ? { background: cssVar.colorFillSecondary, borderColor: cssVar.colorFillSecondary }- : {}- }- variant="outlined"- >- <Icon color={cssVar.colorTextSecondary} icon={BriefcaseIcon} size={14} />- <Text fontSize={13} weight={500}>- {tOnboarding('interests.area.other')}- </Text>- </Block>- </Flexbox>- {showCustomInput && (- <Input- onChange={(e) => setCustomInput(e.target.value)}- onPressEnter={handleAddCustom}- placeholder={tOnboarding('interests.placeholder')}- size="small"- style={{ width: 200 }}- value={customInput}- />- )}- <Flexbox gap={8} horizontal justify="flex-end">- <Button disabled={saving} onClick={handleCancel} size="small">- {t('profile.cancel')}- </Button>- <Button loading={saving} onClick={handleSave} size="small" type="primary">- {t('profile.save')}- </Button>- </Flexbox>- </Flexbox>- </motion.div>- );-- const displayContent = (- <motion.div- animate={{ opacity: 1 }}- exit={{ opacity: 0 }}- initial={{ opacity: 0 }}- key="display"- transition={{ duration: 0.2 }}- >- {mobile ? (- interests.length > 0 ? (- <Flexbox gap={8} horizontal style={{ flexWrap: 'wrap' }}>- {interests.map((interest) => (- <Tag key={interest}>{interest}</Tag>- ))}- </Flexbox>- ) : (- <Text>--</Text>- )- ) : (- <Flexbox align="center" horizontal justify="space-between">- {interests.length > 0 ? (- <Flexbox gap={8} horizontal style={{ flexWrap: 'wrap' }}>- {interests.map((interest) => (- <Tag key={interest}>{interest}</Tag>- ))}- </Flexbox>- ) : (- <Text>--</Text>- )}- <Text onClick={handleStartEdit} style={{ cursor: 'pointer', fontSize: 13 }}>- {t('profile.updateInterests')}- </Text>- </Flexbox>- )}- </motion.div>- );-- if (mobile) {- return (- <Flexbox gap={12} style={rowStyle}>- <Flexbox align="center" horizontal justify="space-between">- <Text strong>{t('profile.interests')}</Text>- {!isEditing && (- <Text onClick={handleStartEdit} style={{ cursor: 'pointer', fontSize: 13 }}>- {t('profile.updateInterests')}- </Text>- )}- </Flexbox>- <AnimatePresence mode="wait">{isEditing ? editingContent : displayContent}</AnimatePresence>- </Flexbox>- );- }-- return (- <Flexbox gap={24} horizontal style={rowStyle}>- <Text style={labelStyle}>{t('profile.interests')}</Text>- <Flexbox style={{ flex: 1 }}>- <AnimatePresence mode="wait">{isEditing ? editingContent : displayContent}</AnimatePresence>- </Flexbox>- </Flexbox>- );-});--const UsernameRow = memo<{ mobile?: boolean }>(({ mobile }) => {- const { t } = useTranslation('auth');- const username = useUserStore(userProfileSelectors.username);- const updateUsername = useUserStore((s) => s.updateUsername);- const [isEditing, setIsEditing] = useState(false);- const [editValue, setEditValue] = useState('');- const [saving, setSaving] = useState(false);- const [error, setError] = useState('');-- const usernameRegex = /^\w+$/;-- const handleStartEdit = () => {- setEditValue(username || '');- setError('');- setIsEditing(true);- };-- const handleCancel = () => {- setIsEditing(false);- setEditValue('');- setError('');- };-- const validateUsername = (value: string): string => {- const trimmed = value.trim();- if (!trimmed) return t('profile.usernameRequired');- if (!usernameRegex.test(trimmed)) return t('profile.usernameRule');- return '';- };-- const handleSave = useCallback(async () => {- const validationError = validateUsername(editValue);- if (validationError) {- setError(validationError);- return;- }-- try {- setSaving(true);- setError('');- await updateUsername(editValue.trim());- setIsEditing(false);- } catch (err: any) {- console.error('Failed to update username:', err);- // Handle duplicate username error- if (err?.data?.code === 'CONFLICT' || err?.message === 'USERNAME_TAKEN') {- setError(t('profile.usernameDuplicate'));- } else {- setError(t('profile.usernameUpdateFailed'));- }- } finally {- setSaving(false);- }- }, [editValue, updateUsername, t]);-- const handleInputChange = (e: ChangeEvent<HTMLInputElement>) => {- const value = e.target.value;- setEditValue(value);-- if (!value.trim()) {- setError('');- return;- }-- if (!usernameRegex.test(value)) {- setError(t('profile.usernameRule'));- return;- }-- setError('');- };-- const editingContent = (- <motion.div- animate={{ opacity: 1, y: 0 }}- exit={{ opacity: 0, y: -10 }}- initial={{ opacity: 0, y: -10 }}- key="editing"- transition={{ duration: 0.2 }}- >- <Flexbox gap={12}>- {!mobile && <Text strong>{t('profile.usernameInputHint')}</Text>}- <Input- autoFocus- onChange={handleInputChange}- onPressEnter={handleSave}- placeholder={t('profile.usernamePlaceholder')}- status={error ? 'error' : undefined}- value={editValue}- />- {error && (- <Text style={{ fontSize: 12 }} type="danger">- {error}- </Text>- )}- <Flexbox gap={8} horizontal justify="flex-end">- <Button disabled={saving} onClick={handleCancel} size="small">- {t('profile.cancel')}- </Button>- <Button loading={saving} onClick={handleSave} size="small" type="primary">- {t('profile.save')}- </Button>- </Flexbox>- </Flexbox>- </motion.div>- );-- const displayContent = (- <motion.div- animate={{ opacity: 1 }}- exit={{ opacity: 0 }}- initial={{ opacity: 0 }}- key="display"- transition={{ duration: 0.2 }}- >- {mobile ? (- <Text>{username || '--'}</Text>- ) : (- <Flexbox align="center" horizontal justify="space-between">- <Text>{username || '--'}</Text>- <Text onClick={handleStartEdit} style={{ cursor: 'pointer', fontSize: 13 }}>- {t('profile.updateUsername')}- </Text>- </Flexbox>- )}- </motion.div>- );-- if (mobile) {- return (- <Flexbox gap={12} style={rowStyle}>- <Flexbox align="center" horizontal justify="space-between">- <Text strong>{t('profile.username')}</Text>- {!isEditing && (- <Text onClick={handleStartEdit} style={{ cursor: 'pointer', fontSize: 13 }}>- {t('profile.updateUsername')}- </Text>- )}- </Flexbox>- <AnimatePresence mode="wait">{isEditing ? editingContent : displayContent}</AnimatePresence>- </Flexbox>- );- }-- return (- <Flexbox gap={24} horizontal style={rowStyle}>- <Text style={labelStyle}>{t('profile.username')}</Text>- <Flexbox style={{ flex: 1 }}>- <AnimatePresence mode="wait">{isEditing ? editingContent : displayContent}</AnimatePresence>- </Flexbox>- </Flexbox>- );-});--const PasswordRow = memo<{ mobile?: boolean }>(({ mobile }) => {- const { t } = useTranslation('auth');- const userProfile = useUserStore(userProfileSelectors.userProfile);- const hasPasswordAccount = useUserStore(authSelectors.hasPasswordAccount);- const [sending, setSending] = useState(false);-- const handleChangePassword = useCallback(async () => {- if (!userProfile?.email) return;-- try {- setSending(true);- const { requestPasswordReset } = await import('@/libs/better-auth/auth-client');- await requestPasswordReset({- email: userProfile.email,- redirectTo: `/reset-password?email=${encodeURIComponent(userProfile.email)}`,- });- notification.success({- message: t('profile.resetPasswordSent'),- });- } catch (error) {- console.error('Failed to send reset password email:', error);- notification.error({- message: t('profile.resetPasswordError'),- });- } finally {- setSending(false);- }- }, [userProfile?.email, t]);-- return (- <ProfileRow- action={- <Text- onClick={sending ? undefined : handleChangePassword}- style={{- cursor: sending ? 'default' : 'pointer',- fontSize: 13,- opacity: sending ? 0.5 : 1,- }}- >- {hasPasswordAccount ? t('profile.changePassword') : t('profile.setPassword')}- </Text>- }- label={t('profile.password')}- mobile={mobile}- >- <Text>{hasPasswordAccount ? '••••••' : '--'}</Text>- </ProfileRow>- );-});--const Client = memo<{ mobile?: boolean }>(({ mobile }) => {- const [isLoginWithNextAuth, isLoginWithBetterAuth] = useUserStore((s) => [- authSelectors.isLoginWithNextAuth(s),- authSelectors.isLoginWithBetterAuth(s),- ]);- const [userProfile, isUserLoaded] = useUserStore((s) => [- userProfileSelectors.userProfile(s),- s.isLoaded,- ]);- const isLoadedAuthProviders = useUserStore(authSelectors.isLoadedAuthProviders);- const fetchAuthProviders = useUserStore((s) => s.fetchAuthProviders);- const enableKlavis = useServerConfigStore(serverConfigSelectors.enableKlavis);-- const isLoginWithAuth = isLoginWithNextAuth || isLoginWithBetterAuth;- const isLoading = !isUserLoaded || (isLoginWithAuth && !isLoadedAuthProviders);-- useEffect(() => {- if (isLoginWithAuth) {- fetchAuthProviders();- }- }, [isLoginWithAuth, fetchAuthProviders]);-- const { t } = useTranslation('auth');-- if (isLoading)- return (- <Skeleton- active- paragraph={{ rows: 6 }}- style={{ padding: mobile ? 16 : undefined }}- title={false}- />- );-- return (- <Flexbox gap={0} paddingInline={mobile ? 16 : 0} width={'100%'}>- <Text fontSize={16} strong style={{ marginBottom: 32 }}>- {t('profile.title')}- </Text>-- <Divider style={{ marginBlock: 0 }} />-- {/* Avatar Row - Editable */}- <AvatarRow mobile={mobile} />-- <Divider style={{ margin: 0 }} />-- {/* Full Name Row - Editable */}- <FullNameRow mobile={mobile} />-- <Divider style={{ margin: 0 }} />-- {/* Username Row - Editable */}- <UsernameRow mobile={mobile} />-- <Divider style={{ margin: 0 }} />-- {/* Interests Row - Editable */}- <InterestsRow mobile={mobile} />-- <Divider style={{ margin: 0 }} />-- {/* Password Row - For Better Auth users to change or set password */}- {!isDesktop && isLoginWithBetterAuth && (- <>- <PasswordRow mobile={mobile} />- <Divider style={{ margin: 0 }} />- </>- )}-- {/* Email Row - Read Only */}- {isLoginWithAuth && userProfile?.email && (- <>- <ProfileRow label={t('profile.email')} mobile={mobile}>- <Text>{userProfile.email}</Text>- </ProfileRow>- <Divider style={{ margin: 0 }} />- </>- )}-- {/* SSO Providers Row */}- {isLoginWithAuth && (- <>- <ProfileRow label={t('profile.sso.providers')} mobile={mobile}>- <SSOProvidersList />- </ProfileRow>- <Divider style={{ margin: 0 }} />- </>- )}-- {/* Klavis Authorizations Row */}- {enableKlavis && (- <ProfileRow label={t('profile.authorizations.title')} mobile={mobile}>- <KlavisAuthorizationList />- </ProfileRow>- )}- </Flexbox>- );-});--export default Client;diff --git a/src/app/[variants]/(main)/settings/profile/features/AvatarRow.tsx b/src/app/[variants]/(main)/settings/profile/features/AvatarRow.tsxnew file mode 100644index 00000000000..27490980bc5--- /dev/null+++ b/src/app/[variants]/(main)/settings/profile/features/AvatarRow.tsx@@ -0,0 +1,100 @@+'use client';++import { LoadingOutlined } from '@ant-design/icons';+import { Flexbox, Text } from '@lobehub/ui';+import { Spin, Upload } from 'antd';+import { useCallback, useState } from 'react';+import { useTranslation } from 'react-i18next';++import { fetchErrorNotification } from '@/components/Error/fetchErrorNotification';+import { enableAuth } from '@/const/auth';+import UserAvatar from '@/features/User/UserAvatar';+import { useUserStore } from '@/store/user';+import { authSelectors } from '@/store/user/selectors';+import { imageToBase64 } from '@/utils/imageToBase64';+import { createUploadImageHandler } from '@/utils/uploadFIle';++import { labelStyle, rowStyle } from './ProfileRow';++interface AvatarRowProps {+ mobile?: boolean;+}++const AvatarRow = ({ mobile }: AvatarRowProps) => {+ const { t } = useTranslation('auth');+ const isLogin = useUserStore(authSelectors.isLogin);+ const updateAvatar = useUserStore((s) => s.updateAvatar);+ const [uploading, setUploading] = useState(false);++ const handleUploadAvatar = useCallback(+ createUploadImageHandler(async (avatar) => {+ try {+ setUploading(true);+ const img = new Image();+ img.src = avatar;++ await new Promise((resolve, reject) => {+ img.addEventListener('load', resolve);+ img.addEventListener('error', reject);+ });++ const webpBase64 = imageToBase64({ img, size: 256 });+ 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,+ });+ }+ }),+ [updateAvatar],+ );++ const canUpload = !enableAuth || isLogin;++ const avatarContent = canUpload ? (+ <Spin indicator={<LoadingOutlined spin />} spinning={uploading}>+ <Upload beforeUpload={handleUploadAvatar} itemRender={() => void 0} maxCount={1}>+ <UserAvatar clickable size={40} />+ </Upload>+ </Spin>+ ) : (+ <UserAvatar size={40} />+ );++ const updateAction = canUpload ? (+ <Upload beforeUpload={handleUploadAvatar} itemRender={() => void 0} maxCount={1}>+ <Text fontSize={13} style={{ cursor: 'pointer' }}>+ {t('profile.updateAvatar')}+ </Text>+ </Upload>+ ) : null;++ if (mobile) {+ return (+ <Flexbox gap={12} style={rowStyle}>+ <Flexbox align="center" horizontal justify="space-between">+ <Text strong>{t('profile.avatar')}</Text>+ {updateAction}+ </Flexbox>+ <Flexbox>{avatarContent}</Flexbox>+ </Flexbox>+ );+ }++ return (+ <Flexbox align="center" gap={24} horizontal justify="space-between" style={rowStyle}>+ <Flexbox align="center" gap={24} horizontal style={{ flex: 1 }}>+ <Text style={labelStyle}>{t('profile.avatar')}</Text>+ <Flexbox style={{ flex: 1 }}>{avatarContent}</Flexbox>+ </Flexbox>+ {updateAction}+ </Flexbox>+ );+};++export default AvatarRow;diff --git a/src/app/[variants]/(main)/settings/profile/features/FullNameRow.tsx b/src/app/[variants]/(main)/settings/profile/features/FullNameRow.tsxnew file mode 100644index 00000000000..9da7af03310--- /dev/null+++ b/src/app/[variants]/(main)/settings/profile/features/FullNameRow.tsx@@ -0,0 +1,130 @@+'use client';++import { Button, Flexbox, Input, Text } from '@lobehub/ui';+import { AnimatePresence, m as motion } from 'motion/react';+import { useCallback, useState } from 'react';+import { useTranslation } from 'react-i18next';++import { fetchErrorNotification } from '@/components/Error/fetchErrorNotification';+import { useUserStore } from '@/store/user';+import { userProfileSelectors } from '@/store/user/selectors';++import { labelStyle, rowStyle } from './ProfileRow';++interface FullNameRowProps {+ mobile?: boolean;+}++const FullNameRow = ({ mobile }: FullNameRowProps) => {+ const { t } = useTranslation('auth');+ const fullName = useUserStore(userProfileSelectors.fullName);+ const updateFullName = useUserStore((s) => s.updateFullName);+ const [isEditing, setIsEditing] = useState(false);+ const [editValue, setEditValue] = useState('');+ const [saving, setSaving] = useState(false);++ const handleStartEdit = () => {+ setEditValue(fullName || '');+ setIsEditing(true);+ };++ const handleCancel = () => {+ setIsEditing(false);+ setEditValue('');+ };++ const handleSave = useCallback(async () => {+ if (!editValue.trim()) return;++ try {+ setSaving(true);+ await updateFullName(editValue.trim());+ setIsEditing(false);+ } catch (error) {+ console.error('Failed to update fullName:', error);+ fetchErrorNotification.error({+ errorMessage: error instanceof Error ? error.message : String(error),+ status: 500,+ });+ } finally {+ setSaving(false);+ }+ }, [editValue, updateFullName]);++ const editingContent = (+ <motion.div+ animate={{ opacity: 1, y: 0 }}+ exit={{ opacity: 0, y: -10 }}+ initial={{ opacity: 0, y: -10 }}+ key="editing"+ transition={{ duration: 0.2 }}+ >+ <Flexbox gap={12}>+ {!mobile && <Text strong>{t('profile.fullNameInputHint')}</Text>}+ <Input+ autoFocus+ onChange={(e) => setEditValue(e.target.value)}+ onPressEnter={handleSave}+ placeholder={t('profile.fullName')}+ value={editValue}+ />+ <Flexbox gap={8} horizontal justify="flex-end">+ <Button disabled={saving} onClick={handleCancel} size="small">+ {t('profile.cancel')}+ </Button>+ <Button loading={saving} onClick={handleSave} size="small" type="primary">+ {t('profile.save')}+ </Button>+ </Flexbox>+ </Flexbox>+ </motion.div>+ );++ const displayContent = (+ <motion.div+ animate={{ opacity: 1 }}+ exit={{ opacity: 0 }}+ initial={{ opacity: 0 }}+ key="display"+ transition={{ duration: 0.2 }}+ >+ {mobile ? (+ <Text>{fullName || '--'}</Text>+ ) : (+ <Flexbox align="center" horizontal justify="space-between">+ <Text>{fullName || '--'}</Text>+ <Text onClick={handleStartEdit} style={{ cursor: 'pointer', fontSize: 13 }}>+ {t('profile.updateFullName')}+ </Text>+ </Flexbox>+ )}+ </motion.div>+ );++ if (mobile) {+ return (+ <Flexbox gap={12} style={rowStyle}>+ <Flexbox align="center" horizontal justify="space-between">+ <Text strong>{t('profile.fullName')}</Text>+ {!isEditing && (+ <Text onClick={handleStartEdit} style={{ cursor: 'pointer', fontSize: 13 }}>+ {t('profile.updateFullName')}+ </Text>+ )}+ </Flexbox>+ <AnimatePresence mode="wait">{isEditing ? editingContent : displayContent}</AnimatePresence>+ </Flexbox>+ );+ }++ return (+ <Flexbox gap={24} horizontal style={rowStyle}>+ <Text style={labelStyle}>{t('profile.fullName')}</Text>+ <Flexbox style={{ flex: 1 }}>+ <AnimatePresence mode="wait">{isEditing ? editingContent : displayContent}</AnimatePresence>+ </Flexbox>+ </Flexbox>+ );+};++export default FullNameRow;diff --git a/src/app/[variants]/(main)/settings/profile/features/InterestsRow.tsx b/src/app/[variants]/(main)/settings/profile/features/InterestsRow.tsxnew file mode 100644index 00000000000..75127087446--- /dev/null+++ b/src/app/[variants]/(main)/settings/profile/features/InterestsRow.tsx@@ -0,0 +1,257 @@+'use client';++import { Block, Button, Flexbox, Icon, Input, Tag, Text } from '@lobehub/ui';+import { cssVar } from 'antd-style';+import { BriefcaseIcon } from 'lucide-react';+import { AnimatePresence, m as motion } from 'motion/react';+import { useCallback, useMemo, useState } from 'react';+import { useTranslation } from 'react-i18next';++import { INTEREST_AREAS } from '@/app/[variants]/onboarding/config';+import { fetchErrorNotification } from '@/components/Error/fetchErrorNotification';+import { useUserStore } from '@/store/user';+import { userProfileSelectors } from '@/store/user/selectors';++import { labelStyle, rowStyle } from './ProfileRow';++interface InterestsRowProps {+ mobile?: boolean;+}++const InterestsRow = ({ mobile }: InterestsRowProps) => {+ const { t } = useTranslation('auth');+ const { t: tOnboarding } = useTranslation('onboarding');+ const interests = useUserStore(userProfileSelectors.interests);+ const updateInterests = useUserStore((s) => s.updateInterests);+ const [isEditing, setIsEditing] = useState(false);+ const [selectedInterests, setSelectedInterests] = useState<string[]>([]);+ const [customInput, setCustomInput] = useState('');+ const [showCustomInput, setShowCustomInput] = useState(false);+ const [saving, setSaving] = useState(false);++ const areas = useMemo(+ () =>+ INTEREST_AREAS.map((area) => ({+ ...area,+ label: tOnboarding(`interests.area.${area.key}`),+ })),+ [tOnboarding],+ );++ const handleStartEdit = () => {+ setSelectedInterests([...interests]);+ setIsEditing(true);+ };++ const handleCancel = () => {+ setIsEditing(false);+ setSelectedInterests([]);+ setCustomInput('');+ setShowCustomInput(false);+ };++ const toggleInterest = useCallback((label: string) => {+ setSelectedInterests((prev) =>+ prev.includes(label) ? prev.filter((i) => i !== label) : [...prev, label],+ );+ }, []);++ const handleAddCustom = useCallback(() => {+ const trimmed = customInput.trim();+ if (trimmed && !selectedInterests.includes(trimmed)) {+ setSelectedInterests((prev) => [...prev, trimmed]);+ setCustomInput('');+ }+ }, [customInput, selectedInterests]);++ const handleSave = useCallback(async () => {+ // Include custom input if has content+ const finalInterests = [...selectedInterests];+ const trimmedCustom = customInput.trim();+ if (showCustomInput && trimmedCustom && !finalInterests.includes(trimmedCustom)) {+ finalInterests.push(trimmedCustom);+ }++ // Deduplicate+ const uniqueInterests = [...new Set(finalInterests)];++ try {+ setSaving(true);+ await updateInterests(uniqueInterests);+ setIsEditing(false);+ setSelectedInterests([]);+ setCustomInput('');+ setShowCustomInput(false);+ } catch (error) {+ console.error('Failed to update interests:', error);+ fetchErrorNotification.error({+ errorMessage: error instanceof Error ? error.message : String(error),+ status: 500,+ });+ } finally {+ setSaving(false);+ }+ }, [selectedInterests, customInput, showCustomInput, updateInterests]);++ const editingContent = (+ <motion.div+ animate={{ opacity: 1, y: 0 }}+ exit={{ opacity: 0, y: -10 }}+ initial={{ opacity: 0, y: -10 }}+ key="editing"+ transition={{ duration: 0.2 }}+ >+ <Flexbox gap={12}>+ <Flexbox align="center" gap={8} horizontal wrap="wrap">+ {areas.map((item) => {+ const isSelected = selectedInterests.includes(item.label);+ return (+ <Block+ clickable+ gap={8}+ horizontal+ key={item.key}+ onClick={() => toggleInterest(item.label)}+ padding={8}+ style={+ isSelected+ ? {+ background: cssVar.colorFillSecondary,+ borderColor: cssVar.colorFillSecondary,+ }+ : {}+ }+ variant="outlined"+ >+ <Icon color={cssVar.colorTextSecondary} icon={item.icon} size={14} />+ <Text fontSize={13} weight={500}>+ {item.label}+ </Text>+ </Block>+ );+ })}+ {/* Render custom interests with same Block style but no icon */}+ {selectedInterests+ .filter((i) => !areas.some((a) => a.label === i))+ .map((interest) => (+ <Block+ clickable+ key={interest}+ onClick={() => toggleInterest(interest)}+ padding={8}+ style={{+ background: cssVar.colorFillSecondary,+ borderColor: cssVar.colorFillSecondary,+ }}+ variant="outlined"+ >+ <Text fontSize={13} weight={500}>+ {interest}+ </Text>+ </Block>+ ))}+ <Block+ clickable+ gap={8}+ horizontal+ onClick={() => setShowCustomInput(!showCustomInput)}+ padding={8}+ style={+ showCustomInput+ ? { background: cssVar.colorFillSecondary, borderColor: cssVar.colorFillSecondary }+ : {}+ }+ variant="outlined"+ >+ <Icon color={cssVar.colorTextSecondary} icon={BriefcaseIcon} size={14} />+ <Text fontSize={13} weight={500}>+ {tOnboarding('interests.area.other')}+ </Text>+ </Block>+ </Flexbox>+ {showCustomInput && (+ <Input+ onChange={(e) => setCustomInput(e.target.value)}+ onPressEnter={handleAddCustom}+ placeholder={tOnboarding('interests.placeholder')}+ size="small"+ style={{ width: 200 }}+ value={customInput}+ />+ )}+ <Flexbox gap={8} horizontal justify="flex-end">+ <Button disabled={saving} onClick={handleCancel} size="small">+ {t('profile.cancel')}+ </Button>+ <Button loading={saving} onClick={handleSave} size="small" type="primary">+ {t('profile.save')}+ </Button>+ </Flexbox>+ </Flexbox>+ </motion.div>+ );++ const displayContent = (+ <motion.div+ animate={{ opacity: 1 }}+ exit={{ opacity: 0 }}+ initial={{ opacity: 0 }}+ key="display"+ transition={{ duration: 0.2 }}+ >+ {mobile ? (+ interests.length > 0 ? (+ <Flexbox gap={8} horizontal style={{ flexWrap: 'wrap' }}>+ {interests.map((interest) => (+ <Tag key={interest}>{interest}</Tag>+ ))}+ </Flexbox>+ ) : (+ <Text>--</Text>+ )+ ) : (+ <Flexbox align="center" horizontal justify="space-between">+ {interests.length > 0 ? (+ <Flexbox gap={8} horizontal style={{ flexWrap: 'wrap' }}>+ {interests.map((interest) => (+ <Tag key={interest}>{interest}</Tag>+ ))}+ </Flexbox>+ ) : (+ <Text>--</Text>+ )}+ <Text onClick={handleStartEdit} style={{ cursor: 'pointer', fontSize: 13 }}>+ {t('profile.updateInterests')}+ </Text>+ </Flexbox>+ )}+ </motion.div>+ );++ if (mobile) {+ return (+ <Flexbox gap={12} style={rowStyle}>+ <Flexbox align="center" horizontal justify="space-between">+ <Text strong>{t('profile.interests')}</Text>+ {!isEditing && (+ <Text onClick={handleStartEdit} style={{ cursor: 'pointer', fontSize: 13 }}>+ {t('profile.updateInterests')}+ </Text>+ )}+ </Flexbox>+ <AnimatePresence mode="wait">{isEditing ? editingContent : displayContent}</AnimatePresence>+ </Flexbox>+ );+ }++ return (+ <Flexbox gap={24} horizontal style={rowStyle}>+ <Text style={labelStyle}>{t('profile.interests')}</Text>+ <Flexbox style={{ flex: 1 }}>+ <AnimatePresence mode="wait">{isEditing ? editingContent : displayContent}</AnimatePresence>+ </Flexbox>+ </Flexbox>+ );+};++export default InterestsRow;diff --git a/src/app/[variants]/(main)/settings/profile/features/PasswordRow.tsx b/src/app/[variants]/(main)/settings/profile/features/PasswordRow.tsxnew file mode 100644index 00000000000..6fb7957c8e8--- /dev/null+++ b/src/app/[variants]/(main)/settings/profile/features/PasswordRow.tsx@@ -0,0 +1,68 @@+'use client';++import { Text } from '@lobehub/ui';+import { useCallback, useState } from 'react';+import { useTranslation } from 'react-i18next';++import { notification } from '@/components/AntdStaticMethods';+import { useUserStore } from '@/store/user';+import { authSelectors, userProfileSelectors } from '@/store/user/selectors';++import ProfileRow from './ProfileRow';++interface PasswordRowProps {+ mobile?: boolean;+}++const PasswordRow = ({ mobile }: PasswordRowProps) => {+ const { t } = useTranslation('auth');+ const userProfile = useUserStore(userProfileSelectors.userProfile);+ const hasPasswordAccount = useUserStore(authSelectors.hasPasswordAccount);+ const [sending, setSending] = useState(false);++ const handleChangePassword = useCallback(async () => {+ if (!userProfile?.email) return;++ try {+ setSending(true);+ const { requestPasswordReset } = await import('@/libs/better-auth/auth-client');+ await requestPasswordReset({+ email: userProfile.email,+ redirectTo: `/reset-password?email=${encodeURIComponent(userProfile.email)}`,+ });+ notification.success({+ message: t('profile.resetPasswordSent'),+ });+ } catch (error) {+ console.error('Failed to send reset password email:', error);+ notification.error({+ message: t('profile.resetPasswordError'),+ });+ } finally {+ setSending(false);+ }+ }, [userProfile?.email, t]);++ return (+ <ProfileRow+ action={+ <Text+ onClick={sending ? undefined : handleChangePassword}+ style={{+ cursor: sending ? 'default' : 'pointer',+ fontSize: 13,+ opacity: sending ? 0.5 : 1,+ }}+ >+ {hasPasswordAccount ? t('profile.changePassword') : t('profile.setPassword')}+ </Text>+ }+ label={t('profile.password')}+ mobile={mobile}+ >+ <Text>{hasPasswordAccount ? '••••••' : '--'}</Text>+ </ProfileRow>+ );+};++export default PasswordRow;diff --git a/src/app/[variants]/(main)/settings/profile/features/ProfileRow.tsx b/src/app/[variants]/(main)/settings/profile/features/ProfileRow.tsxnew file mode 100644index 00000000000..01d50799d3e--- /dev/null+++ b/src/app/[variants]/(main)/settings/profile/features/ProfileRow.tsx@@ -0,0 +1,47 @@+'use client';++import { Flexbox, Text } from '@lobehub/ui';+import type { CSSProperties, ReactNode } from 'react';++interface ProfileRowProps {+ action?: ReactNode;+ children: ReactNode;+ label: string;+ mobile?: boolean;+}++export const rowStyle: CSSProperties = {+ minHeight: 48,+ padding: '16px 0',+};++export const labelStyle: CSSProperties = {+ flexShrink: 0,+ width: 160,+};++const ProfileRow = ({ label, children, action, mobile }: ProfileRowProps) => {+ if (mobile) {+ return (+ <Flexbox gap={12} style={rowStyle}>+ <Flexbox align="center" horizontal justify="space-between">+ <Text strong>{label}</Text>+ {action}+ </Flexbox>+ <Flexbox>{children}</Flexbox>+ </Flexbox>+ );+ }++ return (+ <Flexbox align="center" gap={24} horizontal justify="space-between" style={rowStyle}>+ <Flexbox align="center" gap={24} horizontal style={{ flex: 1 }}>+ <Text style={labelStyle}>{label}</Text>+ <Flexbox style={{ flex: 1 }}>{children}</Flexbox>+ </Flexbox>+ {action && <Flexbox>{action}</Flexbox>}+ </Flexbox>+ );+};++export default ProfileRow;diff --git a/src/app/[variants]/(main)/settings/profile/features/UsernameRow.tsx b/src/app/[variants]/(main)/settings/profile/features/UsernameRow.tsxnew file mode 100644index 00000000000..2d5dbe14380--- /dev/null+++ b/src/app/[variants]/(main)/settings/profile/features/UsernameRow.tsx@@ -0,0 +1,172 @@+'use client';++import { Button, Flexbox, Input, Text } from '@lobehub/ui';+import { AnimatePresence, m as motion } from 'motion/react';+import type { ChangeEvent } from 'react';+import { useCallback, useState } from 'react';+import { useTranslation } from 'react-i18next';++import { useUserStore } from '@/store/user';+import { userProfileSelectors } from '@/store/user/selectors';++import { labelStyle, rowStyle } from './ProfileRow';++interface UsernameRowProps {+ mobile?: boolean;+}++const UsernameRow = ({ mobile }: UsernameRowProps) => {+ const { t } = useTranslation('auth');+ const username = useUserStore(userProfileSelectors.username);+ const updateUsername = useUserStore((s) => s.updateUsername);+ const [isEditing, setIsEditing] = useState(false);+ const [editValue, setEditValue] = useState('');+ const [saving, setSaving] = useState(false);+ const [error, setError] = useState('');++ const usernameRegex = /^\w+$/;++ const handleStartEdit = () => {+ setEditValue(username || '');+ setError('');+ setIsEditing(true);+ };++ const handleCancel = () => {+ setIsEditing(false);+ setEditValue('');+ setError('');+ };++ const validateUsername = (value: string): string => {+ const trimmed = value.trim();+ if (!trimmed) return t('profile.usernameRequired');+ if (!usernameRegex.test(trimmed)) return t('profile.usernameRule');+ return '';+ };++ const handleSave = useCallback(async () => {+ const validationError = validateUsername(editValue);+ if (validationError) {+ setError(validationError);+ return;+ }++ try {+ setSaving(true);+ setError('');+ await updateUsername(editValue.trim());+ setIsEditing(false);+ } catch (err: any) {+ console.error('Failed to update username:', err);+ // Handle duplicate username error+ if (err?.data?.code === 'CONFLICT' || err?.message === 'USERNAME_TAKEN') {+ setError(t('profile.usernameDuplicate'));+ } else {+ setError(t('profile.usernameUpdateFailed'));+ }+ } finally {+ setSaving(false);+ }+ }, [editValue, updateUsername, t]);++ const handleInputChange = (e: ChangeEvent<HTMLInputElement>) => {+ const value = e.target.value;+ setEditValue(value);++ if (!value.trim()) {+ setError('');+ return;+ }++ if (!usernameRegex.test(value)) {+ setError(t('profile.usernameRule'));+ return;+ }++ setError('');+ };++ const editingContent = (+ <motion.div+ animate={{ opacity: 1, y: 0 }}+ exit={{ opacity: 0, y: -10 }}+ initial={{ opacity: 0, y: -10 }}+ key="editing"+ transition={{ duration: 0.2 }}+ >+ <Flexbox gap={12}>+ {!mobile && <Text strong>{t('profile.usernameInputHint')}</Text>}+ <Input+ autoFocus+ onChange={handleInputChange}+ onPressEnter={handleSave}+ placeholder={t('profile.usernamePlaceholder')}+ status={error ? 'error' : undefined}+ value={editValue}+ />+ {error && (+ <Text style={{ fontSize: 12 }} type="danger">+ {error}+ </Text>+ )}+ <Flexbox gap={8} horizontal justify="flex-end">+ <Button disabled={saving} onClick={handleCancel} size="small">+ {t('profile.cancel')}+ </Button>+ <Button loading={saving} onClick={handleSave} size="small" type="primary">+ {t('profile.save')}+ </Button>+ </Flexbox>+ </Flexbox>+ </motion.div>+ );++ const displayContent = (+ <motion.div+ animate={{ opacity: 1 }}+ exit={{ opacity: 0 }}+ initial={{ opacity: 0 }}+ key="display"+ transition={{ duration: 0.2 }}+ >+ {mobile ? (+ <Text>{username || '--'}</Text>+ ) : (+ <Flexbox align="center" horizontal justify="space-between">+ <Text>{username || '--'}</Text>+ <Text onClick={handleStartEdit} style={{ cursor: 'pointer', fontSize: 13 }}>+ {t('profile.updateUsername')}+ </Text>+ </Flexbox>+ )}+ </motion.div>+ );++ if (mobile) {+ return (+ <Flexbox gap={12} style={rowStyle}>+ <Flexbox align="center" horizontal justify="space-between">+ <Text strong>{t('profile.username')}</Text>+ {!isEditing && (+ <Text onClick={handleStartEdit} style={{ cursor: 'pointer', fontSize: 13 }}>+ {t('profile.updateUsername')}+ </Text>+ )}+ </Flexbox>+ <AnimatePresence mode="wait">{isEditing ? editingContent : displayContent}</AnimatePresence>+ </Flexbox>+ );+ }++ return (+ <Flexbox gap={24} horizontal style={rowStyle}>+ <Text style={labelStyle}>{t('profile.username')}</Text>+ <Flexbox style={{ flex: 1 }}>+ <AnimatePresence mode="wait">{isEditing ? editingContent : displayContent}</AnimatePresence>+ </Flexbox>+ </Flexbox>+ );+};++export default UsernameRow;diff --git a/src/app/[variants]/(main)/settings/profile/index.tsx b/src/app/[variants]/(main)/settings/profile/index.tsxindex 2f4de5e1cbf..7ea9f4bdb99 100644--- a/src/app/[variants]/(main)/settings/profile/index.tsx+++ b/src/app/[variants]/(main)/settings/profile/index.tsx@@ -1,11 +1,126 @@'use client';-import { memo } from 'react';+import { isDesktop } from '@lobechat/const';+import { FormGroup, Skeleton, Text } from '@lobehub/ui';+import { Divider } from 'antd';+import { useEffect } from 'react';+import { useTranslation } from 'react-i18next';-import Client from './Client';+import SettingHeader from '@/app/[variants]/(main)/settings/features/SettingHeader';+import { useServerConfigStore } from '@/store/serverConfig';+import { serverConfigSelectors } from '@/store/serverConfig/selectors';+import { useUserStore } from '@/store/user';+import { authSelectors, userProfileSelectors } from '@/store/user/selectors';-const ProfileSettings = memo<{ mobile?: boolean }>(({ mobile }) => {- return <Client mobile={mobile} />;-});+import AvatarRow from './features/AvatarRow';+import FullNameRow from './features/FullNameRow';+import InterestsRow from './features/InterestsRow';+import KlavisAuthorizationList from './features/KlavisAuthorizationList';+import PasswordRow from './features/PasswordRow';+import ProfileRow from './features/ProfileRow';+import SSOProvidersList from './features/SSOProvidersList';+import UsernameRow from './features/UsernameRow';-export default ProfileSettings;+interface ProfileSettingProps {+ mobile?: boolean;+}++const ProfileSetting = ({ mobile }: ProfileSettingProps) => {+ const [isLoginWithNextAuth, isLoginWithBetterAuth] = useUserStore((s) => [+ authSelectors.isLoginWithNextAuth(s),+ authSelectors.isLoginWithBetterAuth(s),+ ]);+ const [userProfile, isUserLoaded] = useUserStore((s) => [+ userProfileSelectors.userProfile(s),+ s.isLoaded,+ ]);+ const isLoadedAuthProviders = useUserStore(authSelectors.isLoadedAuthProviders);+ const fetchAuthProviders = useUserStore((s) => s.fetchAuthProviders);+ const enableKlavis = useServerConfigStore(serverConfigSelectors.enableKlavis);++ const isLoginWithAuth = isLoginWithNextAuth || isLoginWithBetterAuth;+ const isLoading = !isUserLoaded || (isLoginWithAuth && !isLoadedAuthProviders);++ useEffect(() => {+ if (isLoginWithAuth) {+ fetchAuthProviders();+ }+ }, [isLoginWithAuth, fetchAuthProviders]);++ const { t } = useTranslation('auth');++ if (isLoading)+ return (+ <Skeleton+ active+ paragraph={{ rows: 6 }}+ style={{ padding: mobile ? 16 : undefined }}+ title={false}+ />+ );++ return (+ <>+ <SettingHeader title={t('profile.title')} />+ <FormGroup collapsible={false} gap={16} title={t('profile.account')} variant={'filled'}>+ {/* Avatar Row - Editable */}+ <AvatarRow mobile={mobile} />++ <Divider style={{ margin: 0 }} />++ {/* Full Name Row - Editable */}+ <FullNameRow mobile={mobile} />++ <Divider style={{ margin: 0 }} />++ {/* Username Row - Editable */}+ <UsernameRow mobile={mobile} />++ <Divider style={{ margin: 0 }} />++ {/* Interests Row - Editable */}+ <InterestsRow mobile={mobile} />++ {/* Password Row - For Better Auth users to change or set password */}+ {!isDesktop && isLoginWithBetterAuth && (+ <>+ <Divider style={{ margin: 0 }} />+ <PasswordRow mobile={mobile} />+ </>+ )}++ {/* Email Row - Read Only */}+ {isLoginWithAuth && userProfile?.email && (+ <>+ <Divider style={{ margin: 0 }} />+ <ProfileRow label={t('profile.email')} mobile={mobile}>+ <Text>{userProfile.email}</Text>+ </ProfileRow>+ </>+ )}++ {/* SSO Providers Row */}+ {isLoginWithAuth && (+ <>+ <Divider style={{ margin: 0 }} />+ <ProfileRow label={t('profile.sso.providers')} mobile={mobile}>+ <SSOProvidersList />+ </ProfileRow>+ </>+ )}++ {/* Klavis Authorizations Row */}+ {enableKlavis && (+ <>+ <Divider style={{ margin: 0 }} />+ <ProfileRow label={t('profile.authorizations.title')} mobile={mobile}>+ <KlavisAuthorizationList />+ </ProfileRow>+ </>+ )}+ </FormGroup>+ </>+ );+};++export default ProfileSetting;diff --git a/src/app/[variants]/(main)/settings/proxy/index.tsx b/src/app/[variants]/(main)/settings/proxy/index.tsxindex 6648bf02ca4..d57860104ab 100644--- a/src/app/[variants]/(main)/settings/proxy/index.tsx+++ b/src/app/[variants]/(main)/settings/proxy/index.tsx@@ -1,15 +1,21 @@-'use client';+import { useTranslation } from 'react-i18next';++import SettingHeader from '@/app/[variants]/(main)/settings/features/SettingHeader';import ProxyForm from './features/ProxyForm';-const ProxySettings = () => {+const Page = () => {+ const { t } = useTranslation('setting');return (- <div style={{ maxWidth: '1024px', width: '100%' }}>- <ProxyForm />- </div>+ <>+ <SettingHeader title={t('tab.proxy')} />+ <div style={{ maxWidth: '1024px', width: '100%' }}>+ <ProxyForm />+ </div>+ </>);};-ProxySettings.displayName = 'ProxySettings';+Page.displayName = 'ProxySetting';-export default ProxySettings;+export default Page;diff --git a/src/app/[variants]/(main)/settings/security/index.tsx b/src/app/[variants]/(main)/settings/security/index.tsxindex 2d41c40190b..b89cf17c8fa 100644--- a/src/app/[variants]/(main)/settings/security/index.tsx+++ b/src/app/[variants]/(main)/settings/security/index.tsx@@ -2,9 +2,10 @@import { Skeleton } from '@lobehub/ui';import dynamic from 'next/dynamic';-import { memo } from 'react';+import { useTranslation } from 'react-i18next';import { Navigate } from 'react-router-dom';+import SettingHeader from '@/app/[variants]/(main)/settings/features/SettingHeader';import { enableClerk } from '@/const/auth';const ClerkProfile = dynamic(() => import('./features/ClerkProfile'), {@@ -15,8 +16,17 @@ const ClerkProfile = dynamic(() => import('./features/ClerkProfile'), {),});-const SecuritySettings = memo(() => {- return enableClerk ? <ClerkProfile /> : <Navigate replace to="/settings" />;-});+const Page = () => {+ const { t } = useTranslation('setting');+ if (!enableClerk) return <Navigate replace to="/settings" />;+ return (+ <>+ <SettingHeader title={t('tab.security')} />+ <ClerkProfile />+ </>+ );+};++Page.displayName = 'SecuritySetting';-export default SecuritySettings;+export default Page;diff --git a/src/app/[variants]/(main)/settings/stats/features/overview/TotalAssistants.tsx b/src/app/[variants]/(main)/settings/stats/features/overview/TotalAssistants.tsxindex ed8ea4a1f30..2c988ddb606 100644--- a/src/app/[variants]/(main)/settings/stats/features/overview/TotalAssistants.tsx+++ b/src/app/[variants]/(main)/settings/stats/features/overview/TotalAssistants.tsx@@ -1,4 +1,3 @@-import { cssVar } from 'antd-style';import { memo } from 'react';import { useTranslation } from 'react-i18next';@@ -12,7 +11,7 @@ import { lastMonth } from '@/utils/time';import TotalCard from './ShareButton/TotalCard';-const TotalMessages = memo<{ inShare?: boolean; mobile?: boolean }>(({ mobile, inShare }) => {+const TotalMessages = memo<{ inShare?: boolean; mobile?: boolean }>(({ inShare }) => {const { t } = useTranslation('auth');const { data, isLoading } = useClientDataSWR('stats-sessions', async () => ({count: await sessionService.countSessions(),@@ -29,7 +28,6 @@ const TotalMessages = memo<{ inShare?: boolean; mobile?: boolean }>(({ mobile, ireturn (<StatisticCard- highlight={mobile ? undefined : cssVar.purple}loading={isLoading || !data}statistic={{description: (diff --git a/src/app/[variants]/(main)/settings/stats/features/overview/TotalMessages.tsx b/src/app/[variants]/(main)/settings/stats/features/overview/TotalMessages.tsxindex d856e8f6340..274168efc88 100644--- a/src/app/[variants]/(main)/settings/stats/features/overview/TotalMessages.tsx+++ b/src/app/[variants]/(main)/settings/stats/features/overview/TotalMessages.tsx@@ -1,4 +1,3 @@-import { cssVar } from 'antd-style';import { memo } from 'react';import { useTranslation } from 'react-i18next';@@ -12,7 +11,7 @@ import { lastMonth } from '@/utils/time';import TotalCard from './ShareButton/TotalCard';-const TotalMessages = memo<{ inShare?: boolean; mobile?: boolean }>(({ inShare, mobile }) => {+const TotalMessages = memo<{ inShare?: boolean; mobile?: boolean }>(({ inShare }) => {const { t } = useTranslation('auth');const { data, isLoading } = useClientDataSWR('stats-messages', async () => ({count: await messageService.countMessages(),@@ -29,7 +28,6 @@ const TotalMessages = memo<{ inShare?: boolean; mobile?: boolean }>(({ inShare,return (<StatisticCard- highlight={mobile ? undefined : cssVar.yellow}loading={isLoading || !data}statistic={{description: (diff --git a/src/app/[variants]/(main)/settings/stats/features/overview/TotalTopics.tsx b/src/app/[variants]/(main)/settings/stats/features/overview/TotalTopics.tsxindex 81283f7a2cd..600040ca4ea 100644--- a/src/app/[variants]/(main)/settings/stats/features/overview/TotalTopics.tsx+++ b/src/app/[variants]/(main)/settings/stats/features/overview/TotalTopics.tsx@@ -1,4 +1,3 @@-import { cssVar } from 'antd-style';import { memo } from 'react';import { useTranslation } from 'react-i18next';@@ -12,7 +11,7 @@ import { lastMonth } from '@/utils/time';import TotalCard from './ShareButton/TotalCard';-const TotalMessages = memo<{ inShare?: boolean; mobile?: boolean }>(({ inShare, mobile }) => {+const TotalMessages = memo<{ inShare?: boolean; mobile?: boolean }>(({ inShare }) => {const { t } = useTranslation('auth');const { data, isLoading } = useClientDataSWR('stats-topics', async () => ({count: await topicService.countTopics(),@@ -26,7 +25,6 @@ const TotalMessages = memo<{ inShare?: boolean; mobile?: boolean }>(({ inShare,return (<StatisticCard- highlight={mobile ? undefined : cssVar.gold}loading={isLoading || !data}statistic={{description: (diff --git a/src/app/[variants]/(main)/settings/stats/features/overview/Welcome.tsx b/src/app/[variants]/(main)/settings/stats/features/overview/Welcome.tsxindex f726eadd9b5..f2eb74fb499 100644--- a/src/app/[variants]/(main)/settings/stats/features/overview/Welcome.tsx+++ b/src/app/[variants]/(main)/settings/stats/features/overview/Welcome.tsx@@ -1,6 +1,5 @@import { BRANDING_NAME } from '@lobechat/business-const';-import { Flexbox, FluentEmoji, Skeleton } from '@lobehub/ui';-import { cssVar } from 'antd-style';+import { Flexbox, Skeleton } from '@lobehub/ui';import { Clock3Icon, ClockArrowUp } from 'lucide-react';import { memo } from 'react';import { Trans, useTranslation } from 'react-i18next';@@ -32,13 +31,13 @@ const Welcome = memo<{ mobile?: boolean }>(({ mobile }) => {);return (- <Flexbox gap={8} padding={mobile ? 16 : 0}>+ <Flexbox padding={mobile ? 16 : 0}><Flexboxalign={'center'}gap={8}horizontalstyle={{- fontSize: mobile ? 16 : 20,+ fontSize: 16,fontWeight: 500,}}>@@ -62,16 +61,8 @@ const Welcome = memo<{ mobile?: boolean }>(({ mobile }) => {username: nickname || username,}}/>- {!mobile && <FluentEmoji emoji={'🫶'} size={32} type={'anim'} />}</Flexbox>- <Flexbox- gap={16}- horizontal- style={{- color: cssVar.colorTextDescription,- }}- wrap={'wrap'}- >+ <Flexbox gap={16} horizontal wrap={'wrap'}><TimeLabel date={data?.createdAt} icon={Clock3Icon} title={t('stats.createdAt')} /><TimeLabel date={data?.updatedAt} icon={ClockArrowUp} title={t('stats.updatedAt')} /></Flexbox>diff --git a/src/app/[variants]/(main)/settings/stats/features/visualization/AiHeatmaps.tsx b/src/app/[variants]/(main)/settings/stats/features/visualization/AiHeatmaps.tsxindex 01d34e7f09b..78fec535287 100644--- a/src/app/[variants]/(main)/settings/stats/features/visualization/AiHeatmaps.tsx+++ b/src/app/[variants]/(main)/settings/stats/features/visualization/AiHeatmaps.tsx@@ -1,8 +1,7 @@import { Heatmaps, type HeatmapsProps } from '@lobehub/charts';import { Flexbox, Icon, Tag } from '@lobehub/ui';-import { cssVar, useTheme } from 'antd-style';+import { cssVar } from 'antd-style';import { FlameIcon } from 'lucide-react';-import { readableColor } from 'polished';import { memo } from 'react';import { useTranslation } from 'react-i18next';@@ -15,7 +14,6 @@ const AiHeatmaps = memo<Omit<HeatmapsProps, 'data' | 'ref'> & { inShare?: boolean; mobile?: boolean }>(({ inShare, mobile, ...rest }) => {const { t } = useTranslation('auth');- const theme = useTheme();const { data, isLoading } = useClientDataSWR('stats-heatmaps', async () =>messageService.getHeatmaps(),);@@ -60,39 +58,10 @@ const AiHeatmaps = memo</>);- const fillColor = readableColor(theme.gold);const tags = (- <Flexbox- gap={4}- horizontal- style={{- alignSelf: 'center',- flex: 'none',- zoom: 0.9,- }}- >- <Tag- style={{- background: cssVar.colorText,- color: cssVar.colorBgLayout,- fontWeight: 500,- margin: 0,- }}- variant={'filled'}- >- {[days, t('stats.days')].join(' ')}- </Tag>- <Tag- color={'gold'}- icon={<Icon color={fillColor} fill={fillColor} icon={FlameIcon} />}- style={{- background: cssVar.gold,- color: fillColor,- fontWeight: 500,- margin: 0,- }}- variant={'filled'}- >+ <Flexbox gap={8} horizontal>+ <Tag variant={'filled'}>{[days, t('stats.days')].join(' ')}</Tag>+ <Tag color={'success'} icon={<Icon icon={FlameIcon} />} variant={'filled'}>{[hotDays, t('stats.days')].join(' ')}</Tag></Flexbox>diff --git a/src/app/[variants]/(main)/settings/stats/index.tsx b/src/app/[variants]/(main)/settings/stats/index.tsxindex c4f8dcc3e4d..414aa307205 100644--- a/src/app/[variants]/(main)/settings/stats/index.tsx+++ b/src/app/[variants]/(main)/settings/stats/index.tsx@@ -1,6 +1,6 @@'use client';-import { Block, Flexbox, Grid, Icon, Segmented } from '@lobehub/ui';+import { FormGroup, Grid, Icon, Segmented } from '@lobehub/ui';import { ProviderIcon } from '@lobehub/ui/icons';import { DatePicker, type DatePickerProps, Divider } from 'antd';import dayjs from 'dayjs';@@ -8,10 +8,10 @@ import { Brain } from 'lucide-react';import { memo, useEffect, useState } from 'react';import { useTranslation } from 'react-i18next';+import SettingHeader from '@/app/[variants]/(main)/settings/features/SettingHeader';import { useClientDataSWR } from '@/libs/swr';import { usageService } from '@/services/usage';-import StatsFormGroup from './features/components/StatsFormGroup';import {ShareButton,TotalAssistants,@@ -55,43 +55,36 @@ const StatsSetting = memo<{ mobile?: boolean }>(({ mobile }) => {};return (- <Flexbox gap={16}>+ <>+ <SettingHeader title={t('tab.stats')} />{/* ========== Header Section ========== */}- {/* Welcome + Share Button */}- {mobile ? (- <Welcome mobile />- ) : (- <Flexbox- align={'flex-start'}- gap={16}- horizontal- justify={'space-between'}- style={{ marginTop: 12 }}- >- <Welcome />- <ShareButton />- </Flexbox>- )}- <div />- <Grid maxItemWidth={150} rows={4}>- <TotalAssistants mobile={mobile} />- <TotalTopics mobile={mobile} />- <TotalMessages mobile={mobile} />- <TotalWords />- </Grid>- <Block padding={16} variant={'outlined'}>+ <FormGroup+ collapsible={false}+ extra={<ShareButton />}+ gap={16}+ title={<Welcome mobile={mobile} />}+ variant={'filled'}+ >+ <Grid gap={8} maxItemWidth={150} rows={4}>+ <TotalAssistants mobile={mobile} />+ <TotalTopics mobile={mobile} />+ <TotalMessages mobile={mobile} />+ <TotalWords />+ </Grid>+ <Divider dashed /><AiHeatmaps mobile={mobile} /><Divider dashed />- <Grid gap={16} rows={3}>+ <Grid gap={16} rows={3} style={{ paddingBottom: 12 }}><ModelsRank /><AssistantsRank mobile={mobile} /><TopicsRank mobile={mobile} /></Grid>- </Block>- <div />- <StatsFormGroup+ </FormGroup>+ <FormGroup+ collapsible={false}extra={<>+ <DatePicker onChange={handleDateChange} picker="month" value={dateRange} /><SegmentedonChange={(v) => setGroupBy(v as GroupBy)}options={[@@ -106,21 +99,26 @@ const StatsSetting = memo<{ mobile?: boolean }>(({ mobile }) => {value: GroupBy.Provider,},]}+ style={{ marginLeft: 8 }}value={groupBy}+ variant={'outlined'}/>- <DatePicker onChange={handleDateChange} picker="month" value={dateRange} /></>}+ gap={16}+ styles={{+ title: { lineHeight: '35px' },+ }}title={t('tab.usage')}+ variant={'filled'}><UsageCards data={data} groupBy={groupBy} isLoading={isLoading} />- </StatsFormGroup>- <Block padding={16} variant={'outlined'}>- <UsageTrends data={data} groupBy={groupBy} isLoading={isLoading} /><Divider />+ <UsageTrends data={data} groupBy={groupBy} isLoading={isLoading} />+ <div style={{ height: 24 }} /><UsageTable dateStrings={dateStrings} />- </Block>- </Flexbox>+ </FormGroup>+ </>);});diff --git a/src/app/[variants]/(main)/settings/storage/Advanced.tsx b/src/app/[variants]/(main)/settings/storage/features/Advanced.tsxsimilarity index 98%rename from src/app/[variants]/(main)/settings/storage/Advanced.tsxrename to src/app/[variants]/(main)/settings/storage/features/Advanced.tsxindex 1b3ee0cc9ad..2fab39c9ba5 100644--- a/src/app/[variants]/(main)/settings/storage/Advanced.tsx+++ b/src/app/[variants]/(main)/settings/storage/features/Advanced.tsx@@ -143,12 +143,13 @@ const AdvancedActions = () => {};return (<Form+ collapsible={false}form={form}initialValues={settings}items={[analytics, system]}itemsType={'group'}onValuesChange={setSettings}- variant={'borderless'}+ variant={'filled'}{...FORM_STYLE}/>);diff --git a/src/app/[variants]/(main)/settings/storage/index.tsx b/src/app/[variants]/(main)/settings/storage/index.tsxindex c3a1c7425fe..e630a3b0c88 100644--- a/src/app/[variants]/(main)/settings/storage/index.tsx+++ b/src/app/[variants]/(main)/settings/storage/index.tsx@@ -1,9 +1,19 @@-'use client';+import { useTranslation } from 'react-i18next';-import Advanced from './Advanced';+import SettingHeader from '@/app/[variants]/(main)/settings/features/SettingHeader';-const StorageEstimate = () => {- return <Advanced />;+import Advanced from './features/Advanced';++const Page = () => {+ const { t } = useTranslation('setting');+ return (+ <>+ <SettingHeader title={t('tab.storage')} />+ <Advanced />+ </>+ );};-export default StorageEstimate;+Page.displayName = 'StorageSetting';++export default Page;diff --git a/src/app/[variants]/(main)/settings/tts/features/OpenAI.tsx b/src/app/[variants]/(main)/settings/tts/features/OpenAI.tsxindex b6cd0bb2e9a..e1727d72edf 100644--- a/src/app/[variants]/(main)/settings/tts/features/OpenAI.tsx+++ b/src/app/[variants]/(main)/settings/tts/features/OpenAI.tsx@@ -1,7 +1,7 @@'use client';import { Form, type FormGroupItemType, Icon } from '@lobehub/ui';-import { Select , Skeleton } from '@lobehub/ui';+import { Select, Skeleton } from '@lobehub/ui';import isEqual from 'fast-deep-equal';import { Loader2Icon } from 'lucide-react';import { memo, useState } from 'react';@@ -41,6 +41,7 @@ const OpenAI = memo(() => {return (<Form+ collapsible={false}form={form}initialValues={tts}items={[openai]}@@ -52,7 +53,7 @@ const OpenAI = memo(() => {});setLoading(false);}}- variant={'borderless'}+ variant={'filled'}{...FORM_STYLE}/>);diff --git a/src/app/[variants]/(main)/settings/tts/features/STT.tsx b/src/app/[variants]/(main)/settings/tts/features/STT.tsxindex 43af70966e2..dad18a708f8 100644--- a/src/app/[variants]/(main)/settings/tts/features/STT.tsx+++ b/src/app/[variants]/(main)/settings/tts/features/STT.tsx@@ -47,6 +47,7 @@ const STT = memo(() => {return (<Form+ collapsible={false}form={form}initialValues={tts}items={[stt]}@@ -58,7 +59,7 @@ const STT = memo(() => {});setLoading(false);}}- variant={'borderless'}+ variant={'filled'}{...FORM_STYLE}/>);diff --git a/src/app/[variants]/(main)/settings/tts/index.tsx b/src/app/[variants]/(main)/settings/tts/index.tsxindex b117b9d2980..b0451c81243 100644--- a/src/app/[variants]/(main)/settings/tts/index.tsx+++ b/src/app/[variants]/(main)/settings/tts/index.tsx@@ -1,9 +1,15 @@+import { useTranslation } from 'react-i18next';++import SettingHeader from '@/app/[variants]/(main)/settings/features/SettingHeader';+import OpenAI from './features/OpenAI';import STT from './features/STT';const Page = () => {+ const { t } = useTranslation('setting');return (<>+ <SettingHeader title={t('tab.tts')} /><STT /><OpenAI /></>diff --git a/src/components/Statistic/index.tsx b/src/components/Statistic/index.tsxindex 4f9bf98cf73..977aef00378 100644--- a/src/components/Statistic/index.tsx+++ b/src/components/Statistic/index.tsx@@ -4,7 +4,7 @@ import { type ReactNode, memo } from 'react';const Statistic = memo<{ title: ReactNode; value: ReactNode }>(({ value, title }) => {return (- <Flexbox gap={4} horizontal style={{ color: cssVar.colorTextSecondary, fontSize: 12 }}>+ <Flexbox gap={4} horizontal style={{ color: cssVar.colorTextDescription, fontSize: 12 }}><span style={{ fontWeight: 'bold' }}>{value}</span><span style={{ fontWeight: 'normal' }}>{title}</span></Flexbox>diff --git a/src/components/StatisticCard/index.tsx b/src/components/StatisticCard/index.tsxindex 64288592de5..494f02f9896 100644--- a/src/components/StatisticCard/index.tsx+++ b/src/components/StatisticCard/index.tsx@@ -2,10 +2,10 @@ import {StatisticCard as AntdStatisticCard,type StatisticCardProps as AntdStatisticCardProps,} from '@ant-design/pro-components';-import { Text } from '@lobehub/ui';+import { Block, BlockProps, Text } from '@lobehub/ui';import { Spin } from 'antd';-import { createStaticStyles, cx, responsive, useResponsive, useThemeMode } from 'antd-style';-import { type CSSProperties, memo, useMemo } from 'react';+import { createStaticStyles, cx, responsive, useResponsive } from 'antd-style';+import { memo } from 'react';const prefixCls = 'ant';@@ -71,8 +71,8 @@ const styles = createStaticStyles(({ css, cssVar }) => ({}.${prefixCls}-pro-card-header {- padding-block-start: 8px;- padding-inline: 16px;+ padding-block-start: 0;+ padding-inline: 0;.${prefixCls}-pro-card-title {line-height: 32px;@@ -106,10 +106,9 @@ const styles = createStaticStyles(({ css, cssVar }) => ({display: flex;flex-direction: column;gap: 16px;- ${responsive.sm} {- padding-block-end: 0 !important;- padding-inline: 0 !important;- }++ padding-block-end: 0 !important;+ padding-inline: 0 !important;}.${prefixCls}-pro-statistic-card-content-horizontal {@@ -121,50 +120,6 @@ const styles = createStaticStyles(({ css, cssVar }) => ({}}`,- highlight: css`- --highlight-adjusted: transparent;- --highlight-color: transparent;-- overflow: hidden;-- &::before {- content: '';-- position: absolute;- z-index: 0;- inset-block-end: -30%;- inset-inline-end: -30%;- transform: rotate(-15deg);-- width: 66%;- height: 50%;- border-radius: 50%;-- background-image: linear-gradient(- 60deg,- var(--highlight-adjusted) 20%,- var(--highlight-color) 80%- );- background-repeat: no-repeat;- background-position: left center;- background-size: contain;- filter: blur(32px);- }-- > div {- z-index: 1;- }- `,- highlightDark: css`- &::before {- opacity: 1;- }- `,- highlightLight: css`- &::before {- opacity: 0.33;- }- `,icon: css`border-radius: ${cssVar.borderRadius};background: ${cssVar.colorFillSecondary};@@ -175,64 +130,63 @@ const styles = createStaticStyles(({ css, cssVar }) => ({`,}));-interface StatisticCardProps extends AntdStatisticCardProps {- highlight?: string;- variant?: 'raw' | 'card';-}+interface StatisticCardProps+ extends+ AntdStatisticCardProps,+ Pick<BlockProps, 'variant' | 'padding' | 'paddingBlock' | 'paddingInline'> {}const StatisticCard = memo<StatisticCardProps>(- ({ title, className, highlight, variant, loading, extra, ...rest }) => {- const { isDarkMode } = useThemeMode();+ ({+ title,+ className,++ variant = 'borderless',+ loading,+ extra,+ style,+ padding,+ paddingBlock,+ paddingInline,+ ...rest+ }) => {const { mobile } = useResponsive();- const isPure = variant === 'raw';-- const highlightStyles = useMemo<CSSProperties>(- () =>- highlight- ? ({- '--highlight-adjusted': highlight,- '--highlight-color': highlight,- } as CSSProperties)- : {},- [highlight],- );return (- <AntdStatisticCard- bordered={!mobile}- className={cx(- styles.container,- isPure ? styles.raw : cx(styles.card, isDarkMode ? styles.cardDark : styles.cardLight),- highlight &&- cx(styles.highlight, isDarkMode ? styles.highlightDark : styles.highlightLight),- className,- )}- extra={loading ? <Spin percent={'auto'} size={'small'} /> : extra}- style={{- ...highlightStyles,- ...rest.style,- }}- title={- typeof title === 'string' ? (- <Text- as={'h2'}- ellipsis={{ rows: 1, tooltip: true }}- style={{- fontSize: 'inherit',- fontWeight: 'inherit',- lineHeight: 'inherit',- margin: 0,- overflow: 'hidden',- }}- >- {title}- </Text>- ) : (- title- )- }- {...rest}- />+ <Block+ className={className}+ flex={1}+ padding={padding}+ paddingBlock={paddingBlock}+ paddingInline={paddingInline}+ style={style}+ variant={variant}+ >+ <AntdStatisticCard+ bordered={!mobile}+ className={cx(styles.container, styles.raw)}+ extra={loading ? <Spin percent={'auto'} size={'small'} /> : extra}+ title={+ typeof title === 'string' ? (+ <Text+ as={'h2'}+ ellipsis={{ rows: 1, tooltip: true }}+ style={{+ fontSize: 'inherit',+ fontWeight: 'inherit',+ lineHeight: 'inherit',+ margin: 0,+ overflow: 'hidden',+ }}+ >+ {title}+ </Text>+ ) : (+ title+ )+ }+ {...rest}+ />+ </Block>);},);diff --git a/src/features/Conversation/Messages/AssistantGroup/Actions/useGroupActions.ts b/src/features/Conversation/Messages/AssistantGroup/Actions/useGroupActions.tsindex e1622b83fa9..7cb50ac8494 100644--- a/src/features/Conversation/Messages/AssistantGroup/Actions/useGroupActions.ts+++ b/src/features/Conversation/Messages/AssistantGroup/Actions/useGroupActions.ts@@ -131,7 +131,9 @@ export const useGroupActions = ({},edit: {handleClick: () => {- toggleMessageEditing(id, true);+ if (!contentBlock) return;++ toggleMessageEditing(contentBlock.id, true);},icon: Edit,key: 'edit',diff --git a/src/features/Setting/SettingContainer.tsx b/src/features/Setting/SettingContainer.tsxindex 235aeae0e7a..9d6d9ed2680 100644--- a/src/features/Setting/SettingContainer.tsx+++ b/src/features/Setting/SettingContainer.tsx@@ -30,7 +30,7 @@ const SettingContainer = memo<PropsWithChildren<SettingContainerProps>>({addonBefore}<Flexboxflex={1}- gap={64}+ gap={36}style={{maxWidth,}}diff --git a/src/locales/default/auth.ts b/src/locales/default/auth.tsindex 279cf7622a8..e0b72a63af0 100644--- a/src/locales/default/auth.ts+++ b/src/locales/default/auth.ts@@ -153,6 +153,7 @@ export default {'loginGuide.f4': 'Explore powerful plugins','loginGuide.title': 'After logging in, you can:','loginOrSignup': 'Log In / Sign Up',+ 'profile.account': 'Account','profile.authorizations.actions.revoke': 'Revoke','profile.authorizations.revoke.description':'After revoking, the tool will no longer have access to your data. Re-authorization is required to use it again.',