@lobehub/lobehub 2.0.0-next.212 → 2.0.0-next.214

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (152) hide show
  1. package/.github/workflows/auto-i18n.yml +1 -1
  2. package/.github/workflows/bundle-analyzer.yml +1 -1
  3. package/.github/workflows/claude-auto-testing.yml +1 -1
  4. package/.github/workflows/claude-dedupe-issues.yml +1 -1
  5. package/.github/workflows/claude-issue-triage.yml +1 -1
  6. package/.github/workflows/claude-translate-comments.yml +1 -1
  7. package/.github/workflows/claude-translator.yml +1 -1
  8. package/.github/workflows/claude.yml +1 -1
  9. package/.github/workflows/desktop-build-electron.yml +2 -2
  10. package/.github/workflows/e2e.yml +1 -1
  11. package/.github/workflows/issue-auto-close-duplicates.yml +1 -1
  12. package/.github/workflows/lighthouse.yml +2 -2
  13. package/.github/workflows/lock-closed-issues.yml +1 -1
  14. package/.github/workflows/manual-build-desktop.yml +6 -6
  15. package/.github/workflows/pr-build-desktop.yml +5 -5
  16. package/.github/workflows/pr-build-docker.yml +2 -2
  17. package/.github/workflows/release-desktop-beta.yml +4 -4
  18. package/.github/workflows/release-docker.yml +2 -2
  19. package/.github/workflows/release.yml +1 -1
  20. package/.github/workflows/sync-database-schema.yml +1 -1
  21. package/.github/workflows/sync.yml +1 -1
  22. package/.github/workflows/test.yml +5 -5
  23. package/.github/workflows/verify-desktop-patch.yml +1 -1
  24. package/CHANGELOG.md +58 -0
  25. package/apps/desktop/package.json +3 -2
  26. package/apps/desktop/src/main/const/store.ts +1 -1
  27. package/apps/desktop/src/main/controllers/SystemCtr.ts +2 -3
  28. package/apps/desktop/src/main/core/App.ts +10 -3
  29. package/apps/desktop/src/main/types/store.ts +1 -1
  30. package/changelog/v1.json +14 -0
  31. package/locales/ar/models.json +35 -4
  32. package/locales/ar/providers.json +1 -0
  33. package/locales/bg-BG/models.json +24 -1
  34. package/locales/bg-BG/providers.json +1 -0
  35. package/locales/de-DE/models.json +30 -1
  36. package/locales/de-DE/providers.json +1 -0
  37. package/locales/en-US/models.json +1 -0
  38. package/locales/en-US/providers.json +1 -0
  39. package/locales/es-ES/models.json +32 -1
  40. package/locales/es-ES/providers.json +1 -0
  41. package/locales/fa-IR/models.json +48 -1
  42. package/locales/fa-IR/providers.json +1 -0
  43. package/locales/fr-FR/models.json +47 -1
  44. package/locales/fr-FR/providers.json +1 -0
  45. package/locales/it-IT/models.json +32 -1
  46. package/locales/it-IT/providers.json +1 -0
  47. package/locales/ja-JP/models.json +2 -1
  48. package/locales/ja-JP/providers.json +1 -0
  49. package/locales/ko-KR/models.json +24 -1
  50. package/locales/ko-KR/providers.json +1 -0
  51. package/locales/nl-NL/models.json +46 -1
  52. package/locales/nl-NL/providers.json +1 -0
  53. package/locales/pl-PL/models.json +41 -1
  54. package/locales/pl-PL/providers.json +1 -0
  55. package/locales/pt-BR/models.json +32 -1
  56. package/locales/pt-BR/providers.json +1 -0
  57. package/locales/ru-RU/models.json +54 -2
  58. package/locales/ru-RU/providers.json +1 -0
  59. package/locales/tr-TR/models.json +32 -1
  60. package/locales/tr-TR/providers.json +1 -0
  61. package/locales/vi-VN/models.json +37 -1
  62. package/locales/vi-VN/providers.json +1 -0
  63. package/locales/zh-CN/models.json +24 -3
  64. package/locales/zh-CN/providers.json +1 -0
  65. package/locales/zh-TW/models.json +11 -1
  66. package/locales/zh-TW/providers.json +1 -0
  67. package/package.json +4 -3
  68. package/packages/builtin-tool-knowledge-base/src/client/Render/SearchKnowledgeBase/Item/index.tsx +4 -2
  69. package/packages/builtin-tool-local-system/src/client/Intervention/EditLocalFile/index.tsx +3 -2
  70. package/packages/builtin-tool-local-system/src/client/Render/EditLocalFile/index.tsx +3 -2
  71. package/packages/const/src/theme.ts +0 -2
  72. package/packages/context-engine/src/engine/messages/types.ts +1 -1
  73. package/packages/desktop-bridge/src/routeVariants.ts +2 -9
  74. package/packages/electron-client-ipc/src/types/system.ts +1 -1
  75. package/packages/model-runtime/src/core/BaseAI.ts +1 -1
  76. package/packages/model-runtime/src/core/streams/qwen.test.ts +140 -0
  77. package/packages/model-runtime/src/core/streams/qwen.ts +17 -5
  78. package/packages/model-runtime/src/types/chat.ts +12 -12
  79. package/packages/model-runtime/src/types/error.ts +1 -1
  80. package/packages/model-runtime/src/types/image.ts +1 -1
  81. package/scripts/electronWorkflow/modifiers/nextConfig.mts +41 -13
  82. package/src/app/[variants]/(auth)/_layout/index.tsx +3 -2
  83. package/src/app/[variants]/(auth)/_layout/style.ts +8 -18
  84. package/src/app/[variants]/(auth)/layout.tsx +7 -3
  85. package/src/app/[variants]/(desktop)/desktop-onboarding/_layout/index.tsx +4 -2
  86. package/src/app/[variants]/(desktop)/desktop-onboarding/_layout/style.ts +3 -0
  87. package/src/app/[variants]/(main)/_layout/DesktopLayoutContainer.tsx +3 -2
  88. package/src/app/[variants]/(main)/chat/features/Conversation/Header/index.tsx +2 -1
  89. package/src/app/[variants]/(main)/chat/profile/features/ProfileEditor/PluginTag.tsx +3 -2
  90. package/src/app/[variants]/(main)/community/(list)/_layout/Footer.tsx +3 -2
  91. package/src/app/[variants]/(main)/group/features/Conversation/ChatItem/Thread.tsx +3 -2
  92. package/src/app/[variants]/(main)/group/profile/features/AgentBuilder/index.tsx +0 -1
  93. package/src/app/[variants]/(main)/group/profile/features/ProfileEditor/PluginTag.tsx +3 -2
  94. package/src/app/[variants]/(main)/home/_layout/Body/Agent/List/AgentItem/Editing.tsx +2 -2
  95. package/src/app/[variants]/(main)/home/_layout/Footer/index.tsx +1 -1
  96. package/src/app/[variants]/(main)/home/_layout/index.tsx +3 -2
  97. package/src/app/[variants]/(main)/home/features/CommunityAgents/Item.tsx +3 -2
  98. package/src/app/[variants]/(main)/image/_layout/ConfigPanel/components/AspectRatioSelect/index.tsx +4 -2
  99. package/src/app/[variants]/(main)/image/_layout/ConfigPanel/components/ModelSelect/ImageModelItem.tsx +3 -2
  100. package/src/app/[variants]/(main)/image/_layout/ConfigPanel/components/Select/index.tsx +4 -2
  101. package/src/app/[variants]/(main)/image/features/PromptInput/index.tsx +3 -2
  102. package/src/app/[variants]/(main)/memory/features/TimeLineView/index.tsx +9 -4
  103. package/src/app/[variants]/(main)/page/_layout/Body/List/Item/Editing.tsx +2 -2
  104. package/src/app/[variants]/(main)/settings/common/features/Common/Common.tsx +11 -11
  105. package/src/app/[variants]/(main)/settings/provider/(list)/ProviderGrid/Card.tsx +3 -2
  106. package/src/app/[variants]/(main)/settings/stats/features/overview/ShareButton/TotalCard.tsx +4 -2
  107. package/src/app/[variants]/(mobile)/me/(home)/features/Header.tsx +6 -8
  108. package/src/app/[variants]/layout.tsx +10 -15
  109. package/src/app/[variants]/onboarding/_layout/index.tsx +3 -2
  110. package/src/app/[variants]/onboarding/features/ModeSelectionStep.tsx +3 -2
  111. package/src/app/[variants]/router/index.tsx +12 -8
  112. package/src/components/Cell/Divider.tsx +4 -2
  113. package/src/components/DataStyleModal/index.tsx +4 -2
  114. package/src/components/FeatureList/index.tsx +4 -2
  115. package/src/components/FileParsingStatus/EmbeddingStatus.tsx +3 -2
  116. package/src/components/FileParsingStatus/index.tsx +3 -2
  117. package/src/components/Notification/index.tsx +4 -2
  118. package/src/components/client/ClientOnly.tsx +17 -0
  119. package/src/features/AlertBanner/CloudBanner.tsx +4 -3
  120. package/src/features/CommandMenu/ThemeMenu.tsx +1 -1
  121. package/src/features/CommandMenu/types.ts +5 -2
  122. package/src/features/CommandMenu/useCommandMenu.ts +3 -2
  123. package/src/features/Conversation/Markdown/plugins/LobeArtifact/Render/index.tsx +3 -2
  124. package/src/features/Conversation/Messages/components/FileChunks/ChunkItem.tsx +3 -2
  125. package/src/features/Conversation/Messages/components/FileChunks/index.tsx +4 -2
  126. package/src/features/Conversation/Messages/components/SearchGrounding.tsx +3 -2
  127. package/src/features/ElectronTitlebar/hooks/useWatchThemeUpdate.ts +21 -38
  128. package/src/features/GroupChatSettings/AgentCard.tsx +3 -2
  129. package/src/features/GroupChatSettings/HostMemberCard.tsx +3 -2
  130. package/src/features/PageEditor/DiffAllToolbar.tsx +4 -2
  131. package/src/features/User/UserPanel/ThemeButton.tsx +18 -29
  132. package/src/hooks/useIsDark.ts +11 -0
  133. package/src/layout/AuthProvider/Clerk/useAppearance.ts +4 -2
  134. package/src/layout/AuthProvider/MarketAuth/MarketAuthConfirmModal.tsx +3 -2
  135. package/src/layout/GlobalProvider/AppTheme.tsx +15 -19
  136. package/src/layout/GlobalProvider/NextThemeProvider.tsx +22 -0
  137. package/src/layout/GlobalProvider/StyleRegistry.tsx +18 -13
  138. package/src/layout/GlobalProvider/index.tsx +38 -36
  139. package/src/libs/next/proxy/define-config.ts +2 -11
  140. package/src/server/services/comfyui/config/constants.ts +7 -7
  141. package/src/server/services/comfyui/config/promptToolConst.ts +26 -26
  142. package/src/server/services/comfyui/utils/promptSplitter.ts +23 -23
  143. package/src/server/services/comfyui/utils/weightDType.ts +4 -5
  144. package/src/store/global/action.test.ts +0 -15
  145. package/src/store/global/actions/__tests__/general.test.ts +0 -37
  146. package/src/store/global/actions/general.ts +0 -21
  147. package/src/store/global/initialState.ts +0 -6
  148. package/src/store/global/selectors/systemStatus.test.ts +0 -20
  149. package/src/store/global/selectors/systemStatus.ts +0 -2
  150. package/src/styles/global.ts +0 -2
  151. package/src/utils/server/routeVariants.test.ts +17 -51
  152. package/src/utils/server/routeVariants.ts +0 -1
@@ -5,6 +5,7 @@ import { Select, Skeleton } from '@lobehub/ui';
5
5
  import { Segmented, Switch } from 'antd';
6
6
  import isEqual from 'fast-deep-equal';
7
7
  import { Ban, Gauge, Loader2Icon, Monitor, Moon, Mouse, Sun, Waves } from 'lucide-react';
8
+ import { useTheme as useNextThemesTheme } from 'next-themes';
8
9
  import { memo, useState } from 'react';
9
10
  import { useTranslation } from 'react-i18next';
10
11
 
@@ -22,16 +23,15 @@ const Common = memo(() => {
22
23
  const { t } = useTranslation('setting');
23
24
 
24
25
  const general = useUserStore((s) => settingsSelectors.currentSettings(s).general, isEqual);
25
- const themeMode = useGlobalStore(systemStatusSelectors.themeMode);
26
+ const { theme, setTheme } = useNextThemesTheme();
26
27
  const language = useGlobalStore(systemStatusSelectors.language);
27
28
  const [setSettings, isUserStateInit] = useUserStore((s) => [s.setSettings, s.isUserStateInit]);
28
- const [setThemeMode, switchLocale, isStatusInit] = useGlobalStore((s) => [
29
- s.switchThemeMode,
30
- s.switchLocale,
31
- s.isStatusInit,
32
- ]);
29
+ const [switchLocale, isStatusInit] = useGlobalStore((s) => [s.switchLocale, s.isStatusInit]);
33
30
  const [loading, setLoading] = useState(false);
34
31
 
32
+ // Use the theme value from next-themes, default to 'system'
33
+ const currentTheme = theme || 'system';
34
+
35
35
  const handleLangChange = (value: LocaleMode) => {
36
36
  switchLocale(value);
37
37
  };
@@ -39,13 +39,13 @@ const Common = memo(() => {
39
39
  if (!(isStatusInit && isUserStateInit))
40
40
  return <Skeleton active paragraph={{ rows: 5 }} title={false} />;
41
41
 
42
- const theme: FormGroupItemType = {
42
+ const themeFormGroup: FormGroupItemType = {
43
43
  children: [
44
44
  {
45
45
  children: (
46
46
  <ImageSelect
47
47
  height={60}
48
- onChange={setThemeMode}
48
+ onChange={(value) => setTheme(value === 'auto' ? 'system' : value)}
49
49
  options={[
50
50
  {
51
51
  icon: Sun,
@@ -63,11 +63,11 @@ const Common = memo(() => {
63
63
  icon: Monitor,
64
64
  img: imageUrl('theme_auto.webp'),
65
65
  label: t('settingCommon.themeMode.auto'),
66
- value: 'auto',
66
+ value: 'system',
67
67
  },
68
68
  ]}
69
69
  unoptimized={isDesktop}
70
- value={themeMode}
70
+ value={currentTheme}
71
71
  width={100}
72
72
  />
73
73
  ),
@@ -173,7 +173,7 @@ const Common = memo(() => {
173
173
  <Form
174
174
  collapsible={false}
175
175
  initialValues={general}
176
- items={[theme]}
176
+ items={[themeFormGroup]}
177
177
  itemsType={'group'}
178
178
  onValuesChange={async (v) => {
179
179
  setLoading(true);
@@ -2,11 +2,12 @@ import { BRANDING_PROVIDER } from '@lobechat/business-const';
2
2
  import { ProviderCombine, ProviderIcon } from '@lobehub/icons';
3
3
  import { Avatar, Flexbox, Skeleton, Text } from '@lobehub/ui';
4
4
  import { Divider } from 'antd';
5
- import { cssVar, cx, useThemeMode } from 'antd-style';
5
+ import { cssVar, cx } from 'antd-style';
6
6
  import { memo } from 'react';
7
7
  import { useTranslation } from 'react-i18next';
8
8
 
9
9
  import { BrandingProviderCard } from '@/business/client/features/BrandingProviderCard';
10
+ import { useIsDark } from '@/hooks/useIsDark';
10
11
  import { type AiProviderListItem } from '@/types/aiProvider';
11
12
 
12
13
  import EnableSwitch from './EnableSwitch';
@@ -19,7 +20,7 @@ interface ProviderCardProps extends AiProviderListItem {
19
20
  const ProviderCard = memo<ProviderCardProps>(
20
21
  ({ id, description, name, enabled, source, logo, loading, onProviderSelect }) => {
21
22
  const { t } = useTranslation('providers');
22
- const { isDarkMode } = useThemeMode();
23
+ const isDarkMode = useIsDark();
23
24
 
24
25
  if (loading)
25
26
  return (
@@ -1,14 +1,16 @@
1
1
  import { Flexbox } from '@lobehub/ui';
2
- import { cssVar, useThemeMode } from 'antd-style';
2
+ import { cssVar } from 'antd-style';
3
3
  import { memo } from 'react';
4
4
 
5
+ import { useIsDark } from '@/hooks/useIsDark';
6
+
5
7
  interface TotalCardProps {
6
8
  count: string | number;
7
9
  title: string;
8
10
  }
9
11
 
10
12
  const TotalCard = memo<TotalCardProps>(({ title, count }) => {
11
- const { isDarkMode } = useThemeMode();
13
+ const isDarkMode = useIsDark();
12
14
  return (
13
15
  <Flexbox
14
16
  padding={12}
@@ -2,28 +2,26 @@
2
2
 
3
3
  import { ActionIcon } from '@lobehub/ui';
4
4
  import { ChatHeader } from '@lobehub/ui/mobile';
5
- import { useThemeMode } from 'antd-style';
6
5
  import { Moon, Sun } from 'lucide-react';
6
+ import { useTheme as useNextThemesTheme } from 'next-themes';
7
7
  import { memo } from 'react';
8
8
 
9
9
  import { MOBILE_HEADER_ICON_SIZE } from '@/const/layoutTokens';
10
- import { useGlobalStore } from '@/store/global';
11
- import { mobileHeaderSticky } from '@/styles/mobileHeader';
10
+ import { useIsDark } from '@/hooks/useIsDark';
12
11
 
13
12
  const Header = memo(() => {
14
- const { isDarkMode } = useThemeMode();
15
- const switchThemeMode = useGlobalStore((s) => s.switchThemeMode);
13
+ const { setTheme } = useNextThemesTheme();
14
+ const isDark = useIsDark();
16
15
 
17
16
  return (
18
17
  <ChatHeader
19
18
  right={
20
19
  <ActionIcon
21
- icon={isDarkMode ? Moon : Sun}
22
- onClick={() => switchThemeMode(isDarkMode ? 'light' : 'dark')}
20
+ icon={isDark ? Moon : Sun}
21
+ onClick={() => setTheme(isDark ? 'light' : 'dark')}
23
22
  size={MOBILE_HEADER_ICON_SIZE}
24
23
  />
25
24
  }
26
- style={mobileHeaderSticky}
27
25
  />
28
26
  );
29
27
  });
@@ -1,6 +1,5 @@
1
1
  import { ENABLE_BUSINESS_FEATURES } from '@lobechat/business-const';
2
2
  import { SpeedInsights } from '@vercel/speed-insights/next';
3
- import { type ThemeAppearance } from 'antd-style';
4
3
  import { type ResolvingViewport } from 'next';
5
4
  import Script from 'next/script';
6
5
  import { type ReactNode, Suspense } from 'react';
@@ -26,7 +25,7 @@ export interface RootLayoutProps extends DynamicLayoutProps {
26
25
  const RootLayout = async ({ children, params }: RootLayoutProps) => {
27
26
  const { variants } = await params;
28
27
 
29
- const { locale, isMobile, theme, primaryColor, neutralColor } =
28
+ const { locale, isMobile, primaryColor, neutralColor } =
30
29
  RouteVariants.deserializeVariants(variants);
31
30
 
32
31
  const direction = isRtlLang(locale) ? 'rtl' : 'ltr';
@@ -34,7 +33,6 @@ const RootLayout = async ({ children, params }: RootLayoutProps) => {
34
33
  const renderContent = () => {
35
34
  return (
36
35
  <GlobalProvider
37
- appearance={theme}
38
36
  isMobile={isMobile}
39
37
  locale={locale}
40
38
  neutralColor={neutralColor}
@@ -50,8 +48,9 @@ const RootLayout = async ({ children, params }: RootLayoutProps) => {
50
48
  };
51
49
 
52
50
  return (
53
- <html dir={direction} lang={locale}>
51
+ <html dir={direction} lang={locale} suppressHydrationWarning>
54
52
  <head>
53
+ {/* <script dangerouslySetInnerHTML={{ __html: 'setTimeout(() => {debugger}, 16)' }} /> */}
55
54
  {process.env.DEBUG_REACT_SCAN === '1' && (
56
55
  <Script
57
56
  crossOrigin={'anonymous'}
@@ -99,7 +98,6 @@ export const generateViewport = async (props: DynamicLayoutProps): ResolvingView
99
98
  };
100
99
 
101
100
  export const generateStaticParams = () => {
102
- const themes: ThemeAppearance[] = ['dark', 'light'];
103
101
  const mobileOptions = isDesktop ? [false] : [true, false];
104
102
  // only static for serveral page, other go to dynamtic
105
103
  const staticLocales: Locales[] = [DEFAULT_LANG, 'zh-CN'];
@@ -107,16 +105,13 @@ export const generateStaticParams = () => {
107
105
  const variants: { variants: string }[] = [];
108
106
 
109
107
  for (const locale of staticLocales) {
110
- for (const theme of themes) {
111
- for (const isMobile of mobileOptions) {
112
- variants.push({
113
- variants: RouteVariants.serializeVariants({
114
- isMobile,
115
- locale,
116
- theme: theme as 'dark' | 'light',
117
- }),
118
- });
119
- }
108
+ for (const isMobile of mobileOptions) {
109
+ variants.push({
110
+ variants: RouteVariants.serializeVariants({
111
+ isMobile,
112
+ locale,
113
+ }),
114
+ });
120
115
  }
121
116
  }
122
117
 
@@ -2,16 +2,17 @@
2
2
 
3
3
  import { Center, Flexbox, Text } from '@lobehub/ui';
4
4
  import { Divider } from 'antd';
5
- import { cx, useThemeMode } from 'antd-style';
5
+ import { cx } from 'antd-style';
6
6
  import type { FC, PropsWithChildren } from 'react';
7
7
 
8
8
  import LangButton from '@/features/User/UserPanel/LangButton';
9
9
  import ThemeButton from '@/features/User/UserPanel/ThemeButton';
10
+ import { useIsDark } from '@/hooks/useIsDark';
10
11
 
11
12
  import { styles } from './style';
12
13
 
13
14
  const OnBoardingContainer: FC<PropsWithChildren> = ({ children }) => {
14
- const { isDarkMode } = useThemeMode();
15
+ const isDarkMode = useIsDark();
15
16
  return (
16
17
  <Flexbox className={styles.outerContainer} height={'100%'} padding={8} width={'100%'}>
17
18
  <Flexbox
@@ -1,13 +1,14 @@
1
1
  'use client';
2
2
 
3
3
  import { Block, Button, Flexbox, Text } from '@lobehub/ui';
4
- import { createStaticStyles, cssVar, cx, useThemeMode } from 'antd-style';
4
+ import { createStaticStyles, cssVar, cx } from 'antd-style';
5
5
  import { Undo2Icon } from 'lucide-react';
6
6
  import React, { memo, useMemo } from 'react';
7
7
  import { useTranslation } from 'react-i18next';
8
8
  import { useNavigate } from 'react-router-dom';
9
9
 
10
10
  import LobeMessage from '@/app/[variants]/onboarding/components/LobeMessage';
11
+ import { useIsDark } from '@/hooks/useIsDark';
11
12
  import { useUserStore } from '@/store/user';
12
13
 
13
14
  const styles = createStaticStyles(({ css, cssVar }) => ({
@@ -76,7 +77,7 @@ interface ModeSelectionStepProps {
76
77
  const ModeSelectionStep = memo<ModeSelectionStepProps>(({ onBack, onNext }) => {
77
78
  const { t } = useTranslation('onboarding');
78
79
  const navigate = useNavigate();
79
- const { isDarkMode } = useThemeMode();
80
+ const isDarkMode = useIsDark();
80
81
 
81
82
  const imageStyles = useMemo<React.CSSProperties>(
82
83
  () =>
@@ -1,16 +1,20 @@
1
1
  'use client';
2
2
 
3
- import dynamic from 'next/dynamic';
3
+ import { useEffect, useState } from 'react';
4
4
 
5
- import Loading from '@/components/Loading/BrandTextLoading';
6
-
7
- const DesktopRouterClient = dynamic(() => import('./DesktopClientRouter'), {
8
- loading: () => <Loading debugId="DesktopRouter" />,
9
- ssr: false,
10
- });
5
+ import DesktopClientRouter from './DesktopClientRouter';
11
6
 
7
+ const useIsClient = () => {
8
+ const [isClient, setIsClient] = useState(false);
9
+ useEffect(() => {
10
+ setIsClient(true);
11
+ }, []);
12
+ return isClient;
13
+ };
12
14
  const DesktopRouter = () => {
13
- return <DesktopRouterClient />;
15
+ const isClient = useIsClient();
16
+ if (!isClient) return null;
17
+ return <DesktopClientRouter />;
14
18
  };
15
19
 
16
20
  export default DesktopRouter;
@@ -1,8 +1,10 @@
1
1
  'use client';
2
2
 
3
- import { createStaticStyles, useThemeMode } from 'antd-style';
3
+ import { createStaticStyles } from 'antd-style';
4
4
  import { memo } from 'react';
5
5
 
6
+ import { useIsDark } from '@/hooks/useIsDark';
7
+
6
8
  const styles = createStaticStyles(({ css, cssVar }) => ({
7
9
  dividerDark: css`
8
10
  flex: none;
@@ -19,7 +21,7 @@ const styles = createStaticStyles(({ css, cssVar }) => ({
19
21
  }));
20
22
 
21
23
  const Divider = memo(() => {
22
- const { isDarkMode } = useThemeMode();
24
+ const isDarkMode = useIsDark();
23
25
 
24
26
  return <div className={isDarkMode ? styles.dividerDark : styles.dividerLight} />;
25
27
  });
@@ -1,8 +1,10 @@
1
1
  import { Flexbox, Icon, Modal } from '@lobehub/ui';
2
- import { createStaticStyles, useThemeMode } from 'antd-style';
2
+ import { createStaticStyles } from 'antd-style';
3
3
  import { type LucideIcon } from 'lucide-react';
4
4
  import { type ReactNode, memo } from 'react';
5
5
 
6
+ import { useIsDark } from '@/hooks/useIsDark';
7
+
6
8
  const prefixCls = 'ant';
7
9
 
8
10
  const styles = createStaticStyles(({ css, cssVar }) => ({
@@ -52,7 +54,7 @@ interface DataStyleModalProps {
52
54
 
53
55
  const DataStyleModal = memo<DataStyleModalProps>(
54
56
  ({ icon, onOpenChange, title, open, children, width = 550, height }) => {
55
- const { isDarkMode } = useThemeMode();
57
+ const isDarkMode = useIsDark();
56
58
 
57
59
  return (
58
60
  <Modal
@@ -1,8 +1,10 @@
1
1
  import { Center, Flexbox, Icon } from '@lobehub/ui';
2
- import { createStaticStyles, useThemeMode , responsive } from 'antd-style';
2
+ import { createStaticStyles, responsive } from 'antd-style';
3
3
  import { type LucideIcon } from 'lucide-react';
4
4
  import { memo } from 'react';
5
5
 
6
+ import { useIsDark } from '@/hooks/useIsDark';
7
+
6
8
  const styles = createStaticStyles(({ css, cssVar }) => ({
7
9
  desc: css`
8
10
  width: 280px;
@@ -48,7 +50,7 @@ interface FeatureListProps {
48
50
  }
49
51
 
50
52
  const FeatureList = memo<FeatureListProps>(({ data }) => {
51
- const { isDarkMode } = useThemeMode();
53
+ const isDarkMode = useIsDark();
52
54
 
53
55
  return (
54
56
  <Flexbox gap={32}>
@@ -1,9 +1,10 @@
1
1
  import { Flexbox, Icon, Tag, Tooltip } from '@lobehub/ui';
2
- import { createStaticStyles, cx, useThemeMode } from 'antd-style';
2
+ import { createStaticStyles, cx } from 'antd-style';
3
3
  import { BoltIcon, RotateCwIcon } from 'lucide-react';
4
4
  import { memo } from 'react';
5
5
  import { useTranslation } from 'react-i18next';
6
6
 
7
+ import { useIsDark } from '@/hooks/useIsDark';
7
8
  import { AsyncTaskStatus, type FileParsingTask } from '@/types/asyncTask';
8
9
 
9
10
  const styles = createStaticStyles(({ css, cssVar }) => ({
@@ -36,7 +37,7 @@ interface EmbeddingStatusProps extends FileParsingTask {
36
37
  const EmbeddingStatus = memo<EmbeddingStatusProps>(
37
38
  ({ chunkCount, embeddingStatus, embeddingError, onClick, onErrorClick, className }) => {
38
39
  const { t } = useTranslation(['components', 'common']);
39
- const { isDarkMode } = useThemeMode();
40
+ const isDarkMode = useIsDark();
40
41
 
41
42
  switch (embeddingStatus) {
42
43
  case AsyncTaskStatus.Processing: {
@@ -1,10 +1,11 @@
1
1
  import { Button, Flexbox, Icon, Tag, Tooltip } from '@lobehub/ui';
2
2
  import { Badge } from 'antd';
3
- import { createStaticStyles, cssVar, cx, useThemeMode } from 'antd-style';
3
+ import { createStaticStyles, cssVar, cx } from 'antd-style';
4
4
  import { BoltIcon, Loader2Icon, RotateCwIcon } from 'lucide-react';
5
5
  import { memo } from 'react';
6
6
  import { useTranslation } from 'react-i18next';
7
7
 
8
+ import { useIsDark } from '@/hooks/useIsDark';
8
9
  import { AsyncTaskStatus, type FileParsingTask } from '@/types/asyncTask';
9
10
 
10
11
  import EmbeddingStatus from './EmbeddingStatus';
@@ -52,7 +53,7 @@ const FileParsingStatus = memo<FileParsingStatusProps>(
52
53
  hideEmbeddingButton,
53
54
  }) => {
54
55
  const { t } = useTranslation(['components', 'common']);
55
- const { isDarkMode } = useThemeMode();
56
+ const isDarkMode = useIsDark();
56
57
 
57
58
  switch (chunkingStatus) {
58
59
  case AsyncTaskStatus.Processing: {
@@ -1,10 +1,12 @@
1
1
  'use client';
2
2
 
3
3
  import { ActionIcon, Flexbox, type FlexboxProps } from '@lobehub/ui';
4
- import { createStaticStyles, cssVar, cx, useThemeMode } from 'antd-style';
4
+ import { createStaticStyles, cssVar, cx } from 'antd-style';
5
5
  import { XIcon } from 'lucide-react';
6
6
  import { memo } from 'react';
7
7
 
8
+ import { useIsDark } from '@/hooks/useIsDark';
9
+
8
10
  const styles = createStaticStyles(({ css }) => ({
9
11
  cancelIcon: css`
10
12
  position: absolute;
@@ -70,7 +72,7 @@ const Notification = memo<NotificationProps>(
70
72
  className,
71
73
  ...rest
72
74
  }) => {
73
- const { isDarkMode } = useThemeMode();
75
+ const isDarkMode = useIsDark();
74
76
  const { className: wrapperClassName, ...restWrapper } = wrapper;
75
77
  return (
76
78
  show && (
@@ -0,0 +1,17 @@
1
+ 'use client';
2
+
3
+ import { type FC, type PropsWithChildren, useEffect, useState } from 'react';
4
+
5
+ const ClientOnly: FC<PropsWithChildren> = ({ children }) => {
6
+ const [mounted, setMounted] = useState(false);
7
+
8
+ useEffect(() => {
9
+ setMounted(true);
10
+ }, []);
11
+
12
+ if (!mounted) return null;
13
+
14
+ return children;
15
+ };
16
+
17
+ export default ClientOnly;
@@ -1,9 +1,9 @@
1
1
  'use client';
2
2
 
3
3
  import { LOBE_CHAT_CLOUD, UTM_SOURCE } from '@lobechat/business-const';
4
- import { Button, Center, Flexbox, Icon , lobeStaticStylish } from '@lobehub/ui';
4
+ import { Button, Center, Flexbox, Icon, lobeStaticStylish } from '@lobehub/ui';
5
5
  import { useSize } from 'ahooks';
6
- import { createStaticStyles, cx, useThemeMode } from 'antd-style';
6
+ import { createStaticStyles, cx } from 'antd-style';
7
7
  import { ArrowRightIcon } from 'lucide-react';
8
8
  import Link from 'next/link';
9
9
  import { memo, useEffect, useRef, useState } from 'react';
@@ -11,6 +11,7 @@ import Marquee from 'react-fast-marquee';
11
11
  import { useTranslation } from 'react-i18next';
12
12
 
13
13
  import { OFFICIAL_URL } from '@/const/url';
14
+ import { useIsDark } from '@/hooks/useIsDark';
14
15
  import { isOnServerSide } from '@/utils/env';
15
16
 
16
17
  export const BANNER_HEIGHT = 40;
@@ -50,7 +51,7 @@ const CloudBanner = memo<{ mobile?: boolean }>(({ mobile }) => {
50
51
  const contentRef = useRef(null);
51
52
  const size = useSize(ref);
52
53
  const contentSize = useSize(contentRef);
53
- const { isDarkMode } = useThemeMode();
54
+ const isDarkMode = useIsDark();
54
55
  const { t } = useTranslation('common');
55
56
  const [isTruncated, setIsTruncated] = useState(mobile);
56
57
 
@@ -24,7 +24,7 @@ const ThemeMenu = memo(() => {
24
24
  <div className={styles.itemLabel}>{t('cmdk.themeDark')}</div>
25
25
  </div>
26
26
  </Command.Item>
27
- <Command.Item onSelect={() => handleThemeChange('auto')} value="theme-auto">
27
+ <Command.Item onSelect={() => handleThemeChange('system')} value="theme-system">
28
28
  <Monitor className={styles.icon} />
29
29
  <div className={styles.itemContent}>
30
30
  <div className={styles.itemLabel}>{t('cmdk.themeAuto')}</div>
@@ -4,7 +4,7 @@ export interface ChatMessage {
4
4
  role: 'user' | 'assistant';
5
5
  }
6
6
 
7
- export type ThemeMode = 'light' | 'dark' | 'auto';
7
+ export type ThemeMode = 'light' | 'dark' | 'system';
8
8
 
9
9
  export type PageType = 'theme' | 'ask-ai' | string;
10
10
 
@@ -25,4 +25,7 @@ export type MenuContext =
25
25
  | 'page'
26
26
  | 'painting';
27
27
 
28
- export type ContextType = Extract<MenuContext, 'agent' | 'group' | 'resource' | 'settings' | 'page' | 'painting'>;
28
+ export type ContextType = Extract<
29
+ MenuContext,
30
+ 'agent' | 'group' | 'resource' | 'settings' | 'page' | 'painting'
31
+ >;
@@ -1,4 +1,5 @@
1
1
  import { useDebounce } from 'ahooks';
2
+ import { useTheme as useNextThemesTheme } from 'next-themes';
2
3
  import { useEffect, useMemo } from 'react';
3
4
  import { useNavigate } from 'react-router-dom';
4
5
  import useSWR from 'swr';
@@ -37,7 +38,7 @@ export const useCommandMenu = () => {
37
38
  } = useCommandMenuContext();
38
39
 
39
40
  const navigate = useNavigate();
40
- const switchThemeMode = useGlobalStore((s) => s.switchThemeMode);
41
+ const { setTheme } = useNextThemesTheme();
41
42
  const createAgent = useAgentStore((s) => s.createAgent);
42
43
  const refreshAgentList = useHomeStore((s) => s.refreshAgentList);
43
44
  const inboxAgentId = useAgentStore(builtinAgentSelectors.inboxAgentId);
@@ -106,7 +107,7 @@ export const useCommandMenu = () => {
106
107
  };
107
108
 
108
109
  const handleThemeChange = (theme: ThemeMode) => {
109
- switchThemeMode(theme);
110
+ setTheme(theme);
110
111
  closeCommandMenu();
111
112
  };
112
113
 
@@ -1,9 +1,10 @@
1
1
  import { Center, Flexbox, Icon } from '@lobehub/ui';
2
- import { createStaticStyles, cx, useThemeMode } from 'antd-style';
2
+ import { createStaticStyles, cx } from 'antd-style';
3
3
  import { Loader2 } from 'lucide-react';
4
4
  import { memo, useEffect } from 'react';
5
5
  import { useTranslation } from 'react-i18next';
6
6
 
7
+ import { useIsDark } from '@/hooks/useIsDark';
7
8
  import { useChatStore } from '@/store/chat';
8
9
  import { chatPortalSelectors, messageStateSelectors } from '@/store/chat/selectors';
9
10
  import { dotLoading } from '@/styles/loading';
@@ -57,7 +58,7 @@ interface ArtifactProps extends MarkdownElementProps {
57
58
 
58
59
  const Render = memo<ArtifactProps>(({ identifier, title, type, language, children, id }) => {
59
60
  const { t } = useTranslation('chat');
60
- const { isDarkMode } = useThemeMode();
61
+ const isDarkMode = useIsDark();
61
62
 
62
63
  const hasChildren = !!children;
63
64
  const str = ((children as string) || '').toString?.();
@@ -1,9 +1,10 @@
1
1
  import { type ChatFileChunk } from '@lobechat/types';
2
2
  import { Center, Flexbox, Text, Tooltip } from '@lobehub/ui';
3
- import { cx, useThemeMode } from 'antd-style';
3
+ import { cx } from 'antd-style';
4
4
  import { memo } from 'react';
5
5
 
6
6
  import FileIcon from '@/components/FileIcon';
7
+ import { useIsDark } from '@/hooks/useIsDark';
7
8
  import { useChatStore } from '@/store/chat';
8
9
 
9
10
  import { styles } from './style';
@@ -13,7 +14,7 @@ export interface ChunkItemProps extends ChatFileChunk {
13
14
  }
14
15
 
15
16
  const ChunkItem = memo<ChunkItemProps>(({ id, fileId, similarity, text, filename, fileType }) => {
16
- const { isDarkMode } = useThemeMode();
17
+ const isDarkMode = useIsDark();
17
18
  // Note: openFilePreview is a portal action, kept in ChatStore as it's a global UI state
18
19
  const openFilePreview = useChatStore((s) => s.openFilePreview);
19
20
 
@@ -1,10 +1,12 @@
1
1
  import { type ChatFileChunk } from '@lobechat/types';
2
2
  import { Flexbox, Icon } from '@lobehub/ui';
3
- import { createStaticStyles, cssVar, cx, useThemeMode } from 'antd-style';
3
+ import { createStaticStyles, cssVar, cx } from 'antd-style';
4
4
  import { BookOpenTextIcon, ChevronDown, ChevronRight } from 'lucide-react';
5
5
  import { memo, useState } from 'react';
6
6
  import { useTranslation } from 'react-i18next';
7
7
 
8
+ import { useIsDark } from '@/hooks/useIsDark';
9
+
8
10
  import ChunkItem from './ChunkItem';
9
11
 
10
12
  const styles = createStaticStyles(({ css }) => ({
@@ -47,7 +49,7 @@ interface FileChunksProps {
47
49
 
48
50
  const FileChunks = memo<FileChunksProps>(({ data }) => {
49
51
  const { t } = useTranslation('chat');
50
- const { isDarkMode } = useThemeMode();
52
+ const isDarkMode = useIsDark();
51
53
 
52
54
  const [showDetail, setShowDetail] = useState(false);
53
55
 
@@ -1,11 +1,12 @@
1
1
  import { Flexbox, Icon, SearchResultCards, Tag } from '@lobehub/ui';
2
- import { createStaticStyles, cssVar, cx, useThemeMode } from 'antd-style';
2
+ import { createStaticStyles, cssVar, cx } from 'antd-style';
3
3
  import { ChevronDown, ChevronRight, Globe } from 'lucide-react';
4
4
  import { AnimatePresence, m as motion } from 'motion/react';
5
5
  import Image from 'next/image';
6
6
  import { memo, useState } from 'react';
7
7
  import { useTranslation } from 'react-i18next';
8
8
 
9
+ import { useIsDark } from '@/hooks/useIsDark';
9
10
  import { type GroundingSearch } from '@/types/search';
10
11
 
11
12
  const styles = createStaticStyles(({ css, cssVar }) => ({
@@ -46,7 +47,7 @@ const styles = createStaticStyles(({ css, cssVar }) => ({
46
47
 
47
48
  const SearchGrounding = memo<GroundingSearch>(({ searchQueries, citations }) => {
48
49
  const { t } = useTranslation('chat');
49
- const { isDarkMode } = useThemeMode();
50
+ const isDarkMode = useIsDark();
50
51
 
51
52
  const [showDetail, setShowDetail] = useState(false);
52
53