@lobehub/chat 0.152.3 → 0.152.5

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 (211) hide show
  1. package/CHANGELOG.md +4 -29
  2. package/locales/ar/common.json +0 -14
  3. package/locales/ar/setting.json +1 -4
  4. package/locales/bg-BG/common.json +0 -14
  5. package/locales/bg-BG/setting.json +1 -4
  6. package/locales/de-DE/common.json +0 -14
  7. package/locales/de-DE/setting.json +1 -4
  8. package/locales/en-US/common.json +0 -14
  9. package/locales/en-US/setting.json +1 -4
  10. package/locales/es-ES/common.json +0 -14
  11. package/locales/es-ES/setting.json +1 -4
  12. package/locales/fr-FR/common.json +0 -14
  13. package/locales/fr-FR/setting.json +1 -4
  14. package/locales/it-IT/common.json +0 -14
  15. package/locales/it-IT/setting.json +1 -4
  16. package/locales/ja-JP/common.json +0 -14
  17. package/locales/ja-JP/setting.json +1 -4
  18. package/locales/ko-KR/common.json +0 -14
  19. package/locales/ko-KR/setting.json +1 -4
  20. package/locales/nl-NL/common.json +0 -14
  21. package/locales/nl-NL/setting.json +1 -4
  22. package/locales/pl-PL/common.json +0 -14
  23. package/locales/pl-PL/setting.json +1 -4
  24. package/locales/pt-BR/common.json +0 -14
  25. package/locales/pt-BR/setting.json +1 -4
  26. package/locales/ru-RU/common.json +0 -14
  27. package/locales/ru-RU/setting.json +1 -4
  28. package/locales/tr-TR/common.json +0 -14
  29. package/locales/tr-TR/setting.json +1 -4
  30. package/locales/vi-VN/common.json +0 -14
  31. package/locales/vi-VN/setting.json +1 -4
  32. package/locales/zh-CN/common.json +0 -14
  33. package/locales/zh-CN/setting.json +1 -4
  34. package/locales/zh-TW/common.json +0 -14
  35. package/locales/zh-TW/setting.json +1 -4
  36. package/package.json +1 -1
  37. package/src/app/(main)/@nav/_layout/Desktop/Avatar.tsx +11 -0
  38. package/src/app/(main)/@nav/_layout/Desktop/BottomActions.tsx +120 -7
  39. package/src/app/(main)/@nav/_layout/Desktop/index.tsx +2 -7
  40. package/src/app/(main)/@nav/_layout/Mobile.tsx +3 -3
  41. package/src/app/(main)/chat/(mobile)/features/SessionHeader.tsx +1 -1
  42. package/src/app/(main)/chat/_layout/Desktop/index.tsx +8 -6
  43. package/src/app/(main)/chat/_layout/Mobile/index.tsx +3 -5
  44. package/src/app/(main)/chat/features/SettingButton.tsx +5 -4
  45. package/src/app/(main)/chat/layout.ts +2 -5
  46. package/src/app/(main)/chat/settings/{_layout/Desktop → (desktop)}/Header.tsx +0 -2
  47. package/src/app/(main)/chat/settings/(desktop)/index.tsx +23 -0
  48. package/src/app/(main)/chat/settings/{_layout/Mobile → (mobile)}/Header.tsx +2 -3
  49. package/src/app/(main)/chat/settings/(mobile)/index.tsx +16 -0
  50. package/src/app/(main)/chat/settings/features/HeaderContent.tsx +9 -15
  51. package/src/app/(main)/chat/settings/features/SubmitAgentButton/SubmitAgentModal.tsx +0 -2
  52. package/src/app/(main)/chat/settings/features/SubmitAgentButton/index.tsx +8 -16
  53. package/src/app/(main)/chat/settings/layout.tsx +2 -9
  54. package/src/app/(main)/chat/settings/page.tsx +9 -2
  55. package/src/app/(main)/market/{_layout/Desktop/DetailSidebar.tsx → @detail/_layout/Desktop.tsx} +2 -2
  56. package/src/app/(main)/market/{_layout/Mobile/DetailModal.tsx → @detail/_layout/Mobile.tsx} +2 -2
  57. package/src/app/(main)/market/@detail/default.tsx +10 -1
  58. package/src/app/(main)/market/_layout/Desktop/index.tsx +1 -2
  59. package/src/app/(main)/market/_layout/Mobile/index.tsx +1 -3
  60. package/src/app/(main)/settings/(desktop)/index.tsx +23 -0
  61. package/src/app/(main)/settings/(mobile)/features/AvatarBanner.tsx +68 -0
  62. package/src/app/(main)/settings/(mobile)/features/ExtraList.tsx +65 -0
  63. package/src/app/(main)/settings/(mobile)/index.tsx +53 -0
  64. package/src/app/(main)/settings/_layout/Desktop/Header.tsx +23 -78
  65. package/src/app/(main)/settings/_layout/Desktop/SideBar.tsx +27 -39
  66. package/src/app/(main)/settings/_layout/Desktop/index.tsx +17 -41
  67. package/src/app/(main)/settings/_layout/Mobile/{Header.tsx → SubSettingHeader.tsx} +1 -3
  68. package/src/app/(main)/settings/_layout/Mobile/index.tsx +18 -7
  69. package/src/app/(main)/settings/about/AboutList.tsx +53 -0
  70. package/src/app/(main)/settings/about/Analytics.tsx +40 -0
  71. package/src/app/(main)/settings/about/page.tsx +33 -13
  72. package/src/app/(main)/settings/about/style.ts +22 -0
  73. package/src/app/(main)/settings/agent/Agent.tsx +29 -0
  74. package/src/app/(main)/settings/agent/loading.tsx +3 -0
  75. package/src/app/(main)/settings/agent/page.tsx +16 -8
  76. package/src/app/(main)/settings/common/{features/Common.tsx → Common.tsx} +5 -7
  77. package/src/app/(main)/settings/common/{features/Theme/index.tsx → Theme.tsx} +6 -8
  78. package/src/app/(main)/settings/common/index.tsx +16 -11
  79. package/src/app/(main)/settings/common/loading.tsx +3 -0
  80. package/src/app/(main)/settings/common/page.tsx +7 -8
  81. package/src/app/(main)/settings/features/Footer.tsx +0 -2
  82. package/src/app/(main)/settings/features/SettingList/index.tsx +47 -0
  83. package/src/app/(main)/settings/features/UpgradeAlert.tsx +13 -21
  84. package/src/app/(main)/settings/hooks/useSyncSettings.ts +2 -2
  85. package/src/app/(main)/settings/layout.ts +1 -4
  86. package/src/app/(main)/settings/llm/Anthropic/index.tsx +10 -4
  87. package/src/app/(main)/settings/llm/Azure/index.tsx +1 -3
  88. package/src/app/(main)/settings/llm/Bedrock/index.tsx +1 -3
  89. package/src/app/(main)/settings/llm/Google/index.tsx +2 -4
  90. package/src/app/(main)/settings/llm/Groq/index.tsx +1 -3
  91. package/src/app/(main)/settings/llm/Minimax/index.tsx +9 -3
  92. package/src/app/(main)/settings/llm/Mistral/index.tsx +9 -3
  93. package/src/app/(main)/settings/llm/Moonshot/index.tsx +1 -3
  94. package/src/app/(main)/settings/llm/Ollama/index.tsx +1 -3
  95. package/src/app/(main)/settings/llm/OpenAI/index.tsx +0 -2
  96. package/src/app/(main)/settings/llm/OpenRouter/index.tsx +9 -3
  97. package/src/app/(main)/settings/llm/Perplexity/index.tsx +9 -3
  98. package/src/app/(main)/settings/llm/TogetherAI/index.tsx +9 -3
  99. package/src/app/(main)/settings/llm/ZeroOne/index.tsx +9 -3
  100. package/src/app/(main)/settings/llm/Zhipu/index.tsx +10 -3
  101. package/src/app/(main)/settings/llm/components/Checker.tsx +0 -2
  102. package/src/app/(main)/settings/llm/components/ProviderConfig/index.tsx +1 -16
  103. package/src/app/(main)/settings/llm/index.tsx +24 -12
  104. package/src/app/(main)/settings/llm/layout.tsx +11 -0
  105. package/src/app/(main)/settings/llm/loading.tsx +3 -0
  106. package/src/app/(main)/settings/llm/page.tsx +0 -15
  107. package/src/app/(main)/settings/page.tsx +14 -2
  108. package/src/app/(main)/settings/sync/{features/DeviceInfo → DeviceInfo}/Card.tsx +5 -6
  109. package/src/app/(main)/settings/sync/DeviceInfo/DeviceName.tsx +66 -0
  110. package/src/app/(main)/settings/sync/{features/DeviceInfo → DeviceInfo}/index.tsx +36 -22
  111. package/src/app/(main)/settings/sync/PageTitle.tsx +11 -0
  112. package/src/app/(main)/settings/sync/{features/WebRTC → WebRTC}/ChannelNameInput.tsx +3 -3
  113. package/src/app/(main)/settings/sync/{features/WebRTC → WebRTC}/index.tsx +9 -10
  114. package/src/app/(main)/settings/sync/{features/DeviceInfo → components}/SystemIcon.tsx +14 -6
  115. package/src/app/(main)/settings/sync/layout.tsx +12 -0
  116. package/src/app/(main)/settings/sync/loading.tsx +3 -0
  117. package/src/app/(main)/settings/sync/page.tsx +15 -11
  118. package/src/app/(main)/settings/tts/{features/STT.tsx → TTS/index.tsx} +27 -11
  119. package/src/app/(main)/settings/tts/loading.tsx +3 -0
  120. package/src/app/(main)/settings/tts/page.tsx +16 -8
  121. package/src/app/layout.tsx +3 -11
  122. package/src/const/url.ts +0 -1
  123. package/src/features/AgentSetting/AgentConfig/index.tsx +202 -0
  124. package/src/features/AgentSetting/AgentConfig/useSyncConfig.ts +23 -0
  125. package/src/features/AgentSetting/AgentMeta/index.tsx +3 -4
  126. package/src/features/AgentSetting/AgentPlugin/index.tsx +66 -65
  127. package/src/features/AgentSetting/AgentPrompt/index.tsx +47 -101
  128. package/src/features/AgentSetting/AgentTTS/index.tsx +0 -4
  129. package/src/features/AgentSetting/StoreUpdater.tsx +0 -2
  130. package/src/features/AgentSetting/index.tsx +6 -6
  131. package/src/features/AgentSetting/store/index.ts +0 -2
  132. package/src/features/AvatarWithUpload/index.tsx +0 -2
  133. package/src/locales/default/common.ts +0 -14
  134. package/src/locales/default/setting.ts +0 -3
  135. package/src/store/global/initialState.ts +0 -1
  136. package/src/app/(main)/(mobile)/me/features/AvatarBanner.tsx +0 -52
  137. package/src/app/(main)/(mobile)/me/features/Cate.tsx +0 -35
  138. package/src/app/(main)/(mobile)/me/features/ExtraCate.tsx +0 -26
  139. package/src/app/(main)/(mobile)/me/features/useExtraCate.tsx +0 -68
  140. package/src/app/(main)/(mobile)/me/layout.tsx +0 -11
  141. package/src/app/(main)/(mobile)/me/loading.tsx +0 -17
  142. package/src/app/(main)/(mobile)/me/page.tsx +0 -31
  143. package/src/app/(main)/@nav/features/UserAvatar.tsx +0 -24
  144. package/src/app/(main)/@nav/features/UserPanel/LangButton.tsx +0 -55
  145. package/src/app/(main)/@nav/features/UserPanel/Popover.tsx +0 -34
  146. package/src/app/(main)/@nav/features/UserPanel/ThemeButton.tsx +0 -70
  147. package/src/app/(main)/@nav/features/UserPanel/UserInfo.tsx +0 -35
  148. package/src/app/(main)/@nav/features/UserPanel/index.tsx +0 -69
  149. package/src/app/(main)/@nav/features/UserPanel/useMenu.tsx +0 -144
  150. package/src/app/(main)/@nav/features/UserPanel/useNewVersion.tsx +0 -12
  151. package/src/app/(main)/chat/_layout/type.ts +0 -5
  152. package/src/app/(main)/chat/settings/_layout/Desktop/index.tsx +0 -32
  153. package/src/app/(main)/chat/settings/_layout/Mobile/index.tsx +0 -15
  154. package/src/app/(main)/chat/settings/error.tsx +0 -5
  155. package/src/app/(main)/chat/settings/loading.tsx +0 -3
  156. package/src/app/(main)/chat/settings/m/page.tsx +0 -15
  157. package/src/app/(main)/chat/settings/not-found.tsx +0 -3
  158. package/src/app/(main)/market/@detail/loading.tsx +0 -1
  159. package/src/app/(main)/settings/@category/default.tsx +0 -16
  160. package/src/app/(main)/settings/@category/features/CategoryContent.tsx +0 -37
  161. package/src/app/(main)/settings/@category/features/UpgradeAlert.tsx +0 -38
  162. package/src/app/(main)/settings/_layout/type.ts +0 -6
  163. package/src/app/(main)/settings/about/features/AboutList.tsx +0 -122
  164. package/src/app/(main)/settings/about/features/Analytics.tsx +0 -42
  165. package/src/app/(main)/settings/about/index.tsx +0 -35
  166. package/src/app/(main)/settings/agent/index.tsx +0 -48
  167. package/src/app/(main)/settings/error.tsx +0 -5
  168. package/src/app/(main)/settings/hooks/useCategory.tsx +0 -54
  169. package/src/app/(main)/settings/llm/components/Footer.tsx +0 -26
  170. package/src/app/(main)/settings/loading.tsx +0 -9
  171. package/src/app/(main)/settings/m/page.tsx +0 -19
  172. package/src/app/(main)/settings/not-found.tsx +0 -3
  173. package/src/app/(main)/settings/sync/features/DeviceInfo/DeviceName.tsx +0 -63
  174. package/src/app/(main)/settings/sync/index.tsx +0 -17
  175. package/src/app/(main)/settings/tts/features/OpenAI.tsx +0 -54
  176. package/src/app/(main)/settings/tts/index.tsx +0 -15
  177. package/src/app/@modal/(.)settings/m/index.tsx +0 -34
  178. package/src/app/@modal/(.)settings/m/layout.tsx +0 -28
  179. package/src/app/@modal/(.)settings/m/loading.tsx +0 -5
  180. package/src/app/@modal/(.)settings/m/page.tsx +0 -10
  181. package/src/app/@modal/_layout/Desktop.tsx +0 -32
  182. package/src/app/@modal/_layout/Mobile.tsx +0 -1
  183. package/src/app/@modal/_layout/SettingModalLayout.tsx +0 -59
  184. package/src/app/@modal/chat/(.)settings/m/features/CategoryContent.tsx +0 -36
  185. package/src/app/@modal/chat/(.)settings/m/features/useCategory.tsx +0 -62
  186. package/src/app/@modal/chat/(.)settings/m/layout.tsx +0 -55
  187. package/src/app/@modal/chat/(.)settings/m/loading.tsx +0 -5
  188. package/src/app/@modal/chat/(.)settings/m/page.tsx +0 -34
  189. package/src/app/@modal/default.tsx +0 -1
  190. package/src/app/@modal/layout.tsx +0 -30
  191. package/src/app/@modal/loading.tsx +0 -5
  192. package/src/components/BrandWatermark/index.tsx +0 -39
  193. package/src/components/Cell/Divider.tsx +0 -19
  194. package/src/components/Cell/index.tsx +0 -38
  195. package/src/components/Menu/index.tsx +0 -97
  196. package/src/components/SkeletonLoading/index.tsx +0 -21
  197. package/src/features/AgentSetting/AgentChat/index.tsx +0 -135
  198. package/src/features/AgentSetting/AgentModal/index.tsx +0 -95
  199. package/src/hooks/useQuery.ts +0 -7
  200. package/src/hooks/useQueryRoute.ts +0 -16
  201. package/src/server/redirectHard.ts +0 -9
  202. /package/src/app/(main)/settings/{about/features → features/SettingList}/Item.tsx +0 -0
  203. /package/src/app/(main)/settings/{common/features/Theme → features}/ThemeSwatches/ThemeSwatchesNeutral.tsx +0 -0
  204. /package/src/app/(main)/settings/{common/features/Theme → features}/ThemeSwatches/ThemeSwatchesPrimary.tsx +0 -0
  205. /package/src/app/(main)/settings/{common/features/Theme → features}/ThemeSwatches/index.ts +0 -0
  206. /package/src/app/(main)/settings/sync/{features/Alert.tsx → Alert.tsx} +0 -0
  207. /package/src/app/(main)/settings/sync/{features/WebRTC → components}/SyncSwitch/index.css +0 -0
  208. /package/src/app/(main)/settings/sync/{features/WebRTC → components}/SyncSwitch/index.tsx +0 -0
  209. /package/src/app/(main)/settings/sync/{features/WebRTC/generateRandomRoomName.ts → util.ts} +0 -0
  210. /package/src/app/(main)/settings/tts/{features/const.ts → TTS/options.ts} +0 -0
  211. /package/src/features/AgentSetting/{AgentModal → AgentConfig}/ModelSelect.tsx +0 -0
@@ -0,0 +1,40 @@
1
+ import { Switch } from 'antd';
2
+ import { memo } from 'react';
3
+ import { useTranslation } from 'react-i18next';
4
+ import { Flexbox } from 'react-layout-kit';
5
+
6
+ import { useUserStore } from '@/store/user';
7
+ import { preferenceSelectors } from '@/store/user/selectors';
8
+
9
+ import { useStyles } from './style';
10
+
11
+ const Analytics = memo(() => {
12
+ const { t } = useTranslation('setting');
13
+ const { styles } = useStyles();
14
+ const checked = useUserStore(preferenceSelectors.userAllowTrace);
15
+ const [updatePreference] = useUserStore((s) => [s.updatePreference]);
16
+
17
+ return (
18
+ <div className={styles.wrapper}>
19
+ <Flexbox className={styles.container} gap={24} padding={16}>
20
+ <Flexbox className={styles.title} gap={8} horizontal>
21
+ {t('analytics.title')}
22
+ </Flexbox>
23
+ <Flexbox gap={24} horizontal>
24
+ <Switch
25
+ checked={!!checked}
26
+ onChange={(e) => {
27
+ updatePreference({ telemetry: e });
28
+ }}
29
+ />
30
+ <Flexbox gap={8}>
31
+ <Flexbox>{t('analytics.telemetry.title')}</Flexbox>
32
+ <Flexbox className={styles.desc}>{t('analytics.telemetry.desc')}</Flexbox>
33
+ </Flexbox>
34
+ </Flexbox>
35
+ </Flexbox>
36
+ </div>
37
+ );
38
+ });
39
+
40
+ export default Analytics;
@@ -1,17 +1,37 @@
1
- import { translation } from '@/server/translation';
2
- import { isMobileDevice } from '@/utils/responsive';
1
+ 'use client';
3
2
 
4
- import Page from './index';
3
+ import { createStyles } from 'antd-style';
4
+ import { memo } from 'react';
5
+ import { useTranslation } from 'react-i18next';
6
+ import { Flexbox } from 'react-layout-kit';
5
7
 
6
- export const generateMetadata = async () => {
7
- const { t } = await translation('setting');
8
- return {
9
- title: t('tab.about'),
10
- };
11
- };
8
+ import PageTitle from '@/components/PageTitle';
9
+ import { useServerConfigStore } from '@/store/serverConfig';
10
+ import { serverConfigSelectors } from '@/store/serverConfig/selectors';
12
11
 
13
- export default () => {
14
- const isMobile = isMobileDevice();
12
+ import AboutList from './AboutList';
13
+ import Analytics from './Analytics';
15
14
 
16
- return <Page mobile={isMobile} />;
17
- };
15
+ const useStyles = createStyles(({ css }) => ({
16
+ container: css`
17
+ width: 100%;
18
+ max-width: 1024px;
19
+ `,
20
+ }));
21
+
22
+ export default memo(() => {
23
+ const { t } = useTranslation('setting');
24
+
25
+ const { styles } = useStyles();
26
+ const enabledTelemetryChat = useServerConfigStore(serverConfigSelectors.enabledTelemetryChat);
27
+
28
+ return (
29
+ <>
30
+ <PageTitle title={t('tab.tts')} />
31
+ <Flexbox align={'center'} className={styles.container} gap={12}>
32
+ <AboutList />
33
+ {enabledTelemetryChat && <Analytics />}
34
+ </Flexbox>
35
+ </>
36
+ );
37
+ });
@@ -0,0 +1,22 @@
1
+ import { createStyles } from 'antd-style';
2
+
3
+ export const useStyles = createStyles(({ css, token, responsive }) => ({
4
+ container: css`
5
+ border: 1px solid ${token.colorBorder};
6
+ border-radius: 8px;
7
+ `,
8
+ desc: css`
9
+ color: ${token.colorTextTertiary};
10
+ `,
11
+ title: css`
12
+ font-size: 16px;
13
+ font-weight: 600;
14
+ `,
15
+ wrapper: css`
16
+ width: 100%;
17
+
18
+ ${responsive.mobile} {
19
+ padding: 0 12px;
20
+ }
21
+ `,
22
+ }));
@@ -0,0 +1,29 @@
1
+ import isEqual from 'fast-deep-equal';
2
+ import { memo } from 'react';
3
+
4
+ import { INBOX_SESSION_ID } from '@/const/session';
5
+ import AgentSetting from '@/features/AgentSetting';
6
+ import { useUserStore } from '@/store/user';
7
+ import { settingsSelectors } from '@/store/user/selectors';
8
+
9
+ const Agent = memo(() => {
10
+ const config = useUserStore(settingsSelectors.defaultAgentConfig, isEqual);
11
+ const meta = useUserStore(settingsSelectors.defaultAgentMeta, isEqual);
12
+ const [updateAgent] = useUserStore((s) => [s.updateDefaultAgent]);
13
+
14
+ return (
15
+ <AgentSetting
16
+ config={config}
17
+ id={INBOX_SESSION_ID}
18
+ meta={meta}
19
+ onConfigChange={(config) => {
20
+ updateAgent({ config });
21
+ }}
22
+ onMetaChange={(meta) => {
23
+ updateAgent({ meta });
24
+ }}
25
+ />
26
+ );
27
+ });
28
+
29
+ export default Agent;
@@ -0,0 +1,3 @@
1
+ import { Skeleton } from 'antd';
2
+
3
+ export default () => <Skeleton paragraph={{ rows: 8 }} />;
@@ -1,10 +1,18 @@
1
- import { translation } from '@/server/translation';
1
+ 'use client';
2
2
 
3
- export const generateMetadata = async () => {
4
- const { t } = await translation('setting');
5
- return {
6
- title: t('tab.agent'),
7
- };
8
- };
3
+ import { memo } from 'react';
4
+ import { useTranslation } from 'react-i18next';
9
5
 
10
- export { default } from './index';
6
+ import PageTitle from '@/components/PageTitle';
7
+
8
+ import Agent from './Agent';
9
+
10
+ export default memo(() => {
11
+ const { t } = useTranslation('setting');
12
+ return (
13
+ <>
14
+ <PageTitle title={t('tab.agent')} />
15
+ <Agent />
16
+ </>
17
+ );
18
+ });
@@ -1,13 +1,12 @@
1
- 'use client';
2
-
3
1
  import { Form, type ItemGroup } from '@lobehub/ui';
4
- import { App, Button, Input } from 'antd';
2
+ import { Form as AntForm, App, Button, Input } from 'antd';
5
3
  import isEqual from 'fast-deep-equal';
4
+ import { AppWindow } from 'lucide-react';
6
5
  import { signIn, signOut } from 'next-auth/react';
7
6
  import { memo, useCallback } from 'react';
8
7
  import { useTranslation } from 'react-i18next';
9
8
 
10
- import { useSyncSettings } from '@/app/(main)/settings//hooks/useSyncSettings';
9
+ import { useSyncSettings } from '@/app/(main)/settings/hooks/useSyncSettings';
11
10
  import { FORM_STYLE } from '@/const/layoutTokens';
12
11
  import { DEFAULT_SETTINGS } from '@/const/settings';
13
12
  import { useOAuthSession } from '@/hooks/useOAuthSession';
@@ -27,7 +26,7 @@ export interface SettingsCommonProps {
27
26
 
28
27
  const Common = memo<SettingsCommonProps>(({ showAccessCodeConfig, showOAuthLogin }) => {
29
28
  const { t } = useTranslation('setting');
30
- const [form] = Form.useForm();
29
+ const [form] = AntForm.useForm();
31
30
 
32
31
  const { user, isOAuthLoggedIn } = useOAuthSession();
33
32
 
@@ -147,6 +146,7 @@ const Common = memo<SettingsCommonProps>(({ showAccessCodeConfig, showOAuthLogin
147
146
  minWidth: undefined,
148
147
  },
149
148
  ],
149
+ icon: AppWindow,
150
150
  title: t('settingSystem.title'),
151
151
  };
152
152
 
@@ -157,9 +157,7 @@ const Common = memo<SettingsCommonProps>(({ showAccessCodeConfig, showOAuthLogin
157
157
  form={form}
158
158
  initialValues={settings}
159
159
  items={[system]}
160
- itemsType={'group'}
161
160
  onValuesChange={setSettings}
162
- variant={'pure'}
163
161
  {...FORM_STYLE}
164
162
  />
165
163
  );
@@ -1,9 +1,7 @@
1
- 'use client';
2
-
3
1
  import { Form, type ItemGroup, SelectWithImg, SliderWithInput } from '@lobehub/ui';
4
- import { Select } from 'antd';
2
+ import { Form as AntForm, Select } from 'antd';
5
3
  import isEqual from 'fast-deep-equal';
6
- import { Monitor, Moon, Sun } from 'lucide-react';
4
+ import { Monitor, Moon, Palette, Sun } from 'lucide-react';
7
5
  import { memo } from 'react';
8
6
  import { useTranslation } from 'react-i18next';
9
7
 
@@ -16,13 +14,14 @@ import { useUserStore } from '@/store/user';
16
14
  import { settingsSelectors } from '@/store/user/selectors';
17
15
  import { switchLang } from '@/utils/client/switchLang';
18
16
 
19
- import { ThemeSwatchesNeutral, ThemeSwatchesPrimary } from './ThemeSwatches';
17
+ import { ThemeSwatchesNeutral, ThemeSwatchesPrimary } from '../features/ThemeSwatches';
20
18
 
21
19
  type SettingItemGroup = ItemGroup;
22
20
 
23
21
  const Theme = memo(() => {
24
22
  const { t } = useTranslation('setting');
25
- const [form] = Form.useForm();
23
+ const [form] = AntForm.useForm();
24
+
26
25
  const settings = useUserStore(settingsSelectors.currentSettings, isEqual);
27
26
  const [setThemeMode, setSettings] = useUserStore((s) => [s.switchThemeMode, s.setSettings]);
28
27
 
@@ -126,6 +125,7 @@ const Theme = memo(() => {
126
125
  minWidth: undefined,
127
126
  },
128
127
  ],
128
+ icon: Palette,
129
129
  title: t('settingTheme.title'),
130
130
  };
131
131
 
@@ -134,9 +134,7 @@ const Theme = memo(() => {
134
134
  form={form}
135
135
  initialValues={settings}
136
136
  items={[theme]}
137
- itemsType={'group'}
138
137
  onValuesChange={setSettings}
139
- variant={'pure'}
140
138
  {...FORM_STYLE}
141
139
  />
142
140
  );
@@ -1,19 +1,24 @@
1
- import { getServerConfig } from '@/config/server';
1
+ 'use client';
2
2
 
3
- import Common from './features/Common';
4
- import Theme from './features/Theme';
3
+ import { memo } from 'react';
4
+ import { useTranslation } from 'react-i18next';
5
5
 
6
- const { SHOW_ACCESS_CODE_CONFIG, ENABLE_OAUTH_SSO } = getServerConfig();
6
+ import PageTitle from '@/components/PageTitle';
7
+ import { CURRENT_VERSION } from '@/const/version';
8
+
9
+ import Footer from '../features/Footer';
10
+ import Common, { SettingsCommonProps } from './Common';
11
+ import Theme from './Theme';
12
+
13
+ export default memo<SettingsCommonProps>((props) => {
14
+ const { t } = useTranslation('setting');
7
15
 
8
- const Page = () => {
9
16
  return (
10
17
  <>
18
+ <PageTitle title={t('tab.common')} />
11
19
  <Theme />
12
- <Common showAccessCodeConfig={SHOW_ACCESS_CODE_CONFIG} showOAuthLogin={ENABLE_OAUTH_SSO} />
20
+ <Common {...props} />
21
+ <Footer>LobeChat v{CURRENT_VERSION}</Footer>
13
22
  </>
14
23
  );
15
- };
16
-
17
- Page.displayName = 'CommonSetting';
18
-
19
- export default Page;
24
+ });
@@ -0,0 +1,3 @@
1
+ import { Skeleton } from 'antd';
2
+
3
+ export default () => <Skeleton paragraph={{ rows: 8 }} />;
@@ -1,10 +1,9 @@
1
- import { translation } from '@/server/translation';
1
+ import { getServerConfig } from '@/config/server';
2
2
 
3
- export const generateMetadata = async () => {
4
- const { t } = await translation('setting');
5
- return {
6
- title: t('tab.common'),
7
- };
8
- };
3
+ import Index from './index';
4
+
5
+ export default () => {
6
+ const { SHOW_ACCESS_CODE_CONFIG, ENABLE_OAUTH_SSO } = getServerConfig();
9
7
 
10
- export { default } from './index';
8
+ return <Index showAccessCodeConfig={SHOW_ACCESS_CODE_CONFIG} showOAuthLogin={ENABLE_OAUTH_SSO} />;
9
+ };
@@ -1,5 +1,3 @@
1
- 'use client';
2
-
3
1
  import { Divider } from 'antd';
4
2
  import { createStyles } from 'antd-style';
5
3
  import { PropsWithChildren, memo } from 'react';
@@ -0,0 +1,47 @@
1
+ import { Bot, Cloudy, Info, Mic2, Settings2, Webhook } from 'lucide-react';
2
+ import Link from 'next/link';
3
+ import { memo } from 'react';
4
+ import { useTranslation } from 'react-i18next';
5
+
6
+ import { SettingsTabs } from '@/store/global/initialState';
7
+ import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfig';
8
+
9
+ import Item from './Item';
10
+
11
+ interface TabItem {
12
+ icon: any;
13
+ label: string;
14
+ value: SettingsTabs;
15
+ }
16
+
17
+ export interface SettingListProps {
18
+ activeTab?: SettingsTabs;
19
+ mobile?: boolean;
20
+ }
21
+
22
+ const SettingList = memo<SettingListProps>(({ activeTab, mobile }) => {
23
+ const { t } = useTranslation('setting');
24
+ const { enableWebrtc, showLLM } = useServerConfigStore(featureFlagsSelectors);
25
+
26
+ const items = [
27
+ { icon: Settings2, label: t('tab.common'), value: SettingsTabs.Common },
28
+ enableWebrtc && { icon: Cloudy, label: t('tab.sync'), value: SettingsTabs.Sync },
29
+ showLLM && { icon: Webhook, label: t('tab.llm'), value: SettingsTabs.LLM },
30
+ { icon: Mic2, label: t('tab.tts'), value: SettingsTabs.TTS },
31
+ { icon: Bot, label: t('tab.agent'), value: SettingsTabs.Agent },
32
+ { icon: Info, label: t('tab.about'), value: SettingsTabs.About },
33
+ ].filter(Boolean) as TabItem[];
34
+
35
+ return items.map(({ value, icon, label }) => (
36
+ <Link aria-label={label} href={`/settings/${value}`} key={value}>
37
+ <Item
38
+ active={mobile ? false : activeTab === value}
39
+ hoverable={!mobile}
40
+ icon={icon}
41
+ label={label}
42
+ />
43
+ </Link>
44
+ ));
45
+ });
46
+
47
+ export default SettingList;
@@ -1,11 +1,8 @@
1
- 'use client';
2
-
3
1
  import { Alert } from '@lobehub/ui';
4
2
  import { Button } from 'antd';
5
3
  import Link from 'next/link';
6
4
  import { memo } from 'react';
7
5
  import { useTranslation } from 'react-i18next';
8
- import { Flexbox } from 'react-layout-kit';
9
6
 
10
7
  import { MANUAL_UPGRADE_URL } from '@/const/url';
11
8
  import { useGlobalStore } from '@/store/global';
@@ -14,28 +11,23 @@ const UpgradeAlert = memo(() => {
14
11
  const [hasNewVersion, latestVersion] = useGlobalStore((s) => [s.hasNewVersion, s.latestVersion]);
15
12
  const { t } = useTranslation('common');
16
13
 
17
- if (!hasNewVersion) return;
18
-
19
14
  return (
20
- <Alert
21
- closable
22
- message={
23
- <Flexbox gap={8}>
24
- <p>{t('upgradeVersion.newVersion', { version: `v${latestVersion}` })}</p>
25
- <Link
26
- aria-label={t('upgradeVersion.action')}
27
- href={MANUAL_UPGRADE_URL}
28
- style={{ marginBottom: 6 }}
29
- target={'_blank'}
30
- >
31
- <Button block size={'small'} type={'primary'}>
15
+ hasNewVersion && (
16
+ <Alert
17
+ action={
18
+ <Link aria-label={t('upgradeVersion.action')} href={MANUAL_UPGRADE_URL} target={'_blank'}>
19
+ <Button size={'small'} type={'primary'}>
32
20
  {t('upgradeVersion.action')}
33
21
  </Button>
34
22
  </Link>
35
- </Flexbox>
36
- }
37
- type={'info'}
38
- />
23
+ }
24
+ closable
25
+ message={t('upgradeVersion.newVersion', { version: latestVersion })}
26
+ showIcon={false}
27
+ style={{ marginBottom: 6 }}
28
+ type={'info'}
29
+ />
30
+ )
39
31
  );
40
32
  });
41
33
 
@@ -1,10 +1,10 @@
1
1
  import { FormInstance } from 'antd/es/form/hooks/useForm';
2
- import { useLayoutEffect } from 'react';
2
+ import { useEffect } from 'react';
3
3
 
4
4
  import { useUserStore } from '@/store/user';
5
5
 
6
6
  export const useSyncSettings = (form: FormInstance) => {
7
- useLayoutEffect(() => {
7
+ useEffect(() => {
8
8
  // set the first time
9
9
  form.setFieldsValue(useUserStore.getState().settings);
10
10
 
@@ -2,10 +2,7 @@ import ServerLayout from '@/components/server/ServerLayout';
2
2
 
3
3
  import Desktop from './_layout/Desktop';
4
4
  import Mobile from './_layout/Mobile';
5
- import { LayoutProps } from './_layout/type';
6
5
 
7
- const SettingsLayout = ServerLayout<LayoutProps>({ Desktop, Mobile });
8
-
9
- SettingsLayout.displayName = 'SettingsLayout';
6
+ const SettingsLayout = ServerLayout({ Desktop, Mobile });
10
7
 
11
8
  export default SettingsLayout;
@@ -1,6 +1,5 @@
1
- 'use client';
2
-
3
- import { Anthropic } from '@lobehub/icons';
1
+ import { Anthropic, Claude } from '@lobehub/icons';
2
+ import { useTheme } from 'antd-style';
4
3
  import { memo } from 'react';
5
4
 
6
5
  import { ModelProvider } from '@/libs/agent-runtime';
@@ -8,12 +7,19 @@ import { ModelProvider } from '@/libs/agent-runtime';
8
7
  import ProviderConfig from '../components/ProviderConfig';
9
8
 
10
9
  const AnthropicProvider = memo(() => {
10
+ const theme = useTheme();
11
+
11
12
  return (
12
13
  <ProviderConfig
13
14
  checkModel={'claude-3-haiku-20240307'}
14
15
  provider={ModelProvider.Anthropic}
15
16
  showEndpoint
16
- title={<Anthropic.Text size={15} />}
17
+ title={
18
+ <Anthropic.Text
19
+ color={theme.isDarkMode ? theme.colorText : Claude.colorPrimary}
20
+ size={18}
21
+ />
22
+ }
17
23
  />
18
24
  );
19
25
  });
@@ -1,5 +1,3 @@
1
- 'use client';
2
-
3
1
  import { Azure, OpenAI } from '@lobehub/icons';
4
2
  import { Markdown } from '@lobehub/ui';
5
3
  import { AutoComplete, Divider, Input } from 'antd';
@@ -97,7 +95,7 @@ const AzureOpenAIProvider = memo(() => {
97
95
  provider={providerKey}
98
96
  title={
99
97
  <Flexbox align={'center'} gap={8} horizontal>
100
- <Azure.Combine size={22} type={'color'}></Azure.Combine>
98
+ <Azure.Combine size={24} type={'color'}></Azure.Combine>
101
99
  <Divider style={{ margin: '0 4px' }} type={'vertical'} />
102
100
  <OpenAI.Combine size={24}></OpenAI.Combine>
103
101
  </Flexbox>
@@ -1,5 +1,3 @@
1
- 'use client';
2
-
3
1
  import { Aws, Bedrock } from '@lobehub/icons';
4
2
  import { Divider, Input, Select } from 'antd';
5
3
  import { memo } from 'react';
@@ -64,7 +62,7 @@ const BedrockProvider = memo(() => {
64
62
  <Flexbox align={'center'} gap={8} horizontal>
65
63
  <Aws.Color size={32} />
66
64
  <Divider style={{ margin: '0 4px' }} type={'vertical'} />
67
- <Bedrock.Combine size={26} type={'color'} />
65
+ <Bedrock.Combine size={24} type={'color'} />
68
66
  </Flexbox>
69
67
  }
70
68
  />
@@ -1,5 +1,3 @@
1
- 'use client';
2
-
3
1
  import { Gemini, Google } from '@lobehub/icons';
4
2
  import { Divider } from 'antd';
5
3
  import { memo } from 'react';
@@ -17,9 +15,9 @@ const GoogleProvider = memo(() => {
17
15
  showEndpoint
18
16
  title={
19
17
  <Flexbox align={'center'} gap={8} horizontal>
20
- <Google.BrandColor size={22} />
18
+ <Google.BrandColor size={28} />
21
19
  <Divider style={{ margin: '0 4px' }} type={'vertical'} />
22
- <Gemini.Combine size={22} type={'color'} />
20
+ <Gemini.Combine size={24} type={'color'} />
23
21
  </Flexbox>
24
22
  }
25
23
  />
@@ -1,5 +1,3 @@
1
- 'use client';
2
-
3
1
  import { Groq } from '@lobehub/icons';
4
2
  import { useTheme } from 'antd-style';
5
3
  import { memo } from 'react';
@@ -15,7 +13,7 @@ const GroqProvider = memo(() => {
15
13
  <ProviderConfig
16
14
  checkModel={'gemma-7b-it'}
17
15
  provider={ModelProvider.Groq}
18
- title={<Groq.Text color={theme.isDarkMode ? theme.colorText : Groq.colorPrimary} size={20} />}
16
+ title={<Groq.Text color={theme.isDarkMode ? theme.colorText : Groq.colorPrimary} size={24} />}
19
17
  />
20
18
  );
21
19
  });
@@ -1,6 +1,5 @@
1
- 'use client';
2
-
3
1
  import { Minimax } from '@lobehub/icons';
2
+ import { useTheme } from 'antd-style';
4
3
  import { memo } from 'react';
5
4
 
6
5
  import { ModelProvider } from '@/libs/agent-runtime';
@@ -8,11 +7,18 @@ import { ModelProvider } from '@/libs/agent-runtime';
8
7
  import ProviderConfig from '../components/ProviderConfig';
9
8
 
10
9
  const MinimaxProvider = memo(() => {
10
+ const theme = useTheme();
11
+
11
12
  return (
12
13
  <ProviderConfig
13
14
  checkModel={'abab5.5s-chat'}
14
15
  provider={ModelProvider.Minimax}
15
- title={<Minimax.Combine size={32} type={'color'} />}
16
+ title={
17
+ <Minimax.Combine
18
+ color={theme.isDarkMode ? theme.colorText : Minimax.colorPrimary}
19
+ size={32}
20
+ />
21
+ }
16
22
  />
17
23
  );
18
24
  });
@@ -1,6 +1,5 @@
1
- 'use client';
2
-
3
1
  import { Mistral } from '@lobehub/icons';
2
+ import { useTheme } from 'antd-style';
4
3
  import { memo } from 'react';
5
4
 
6
5
  import { ModelProvider } from '@/libs/agent-runtime';
@@ -8,11 +7,18 @@ import { ModelProvider } from '@/libs/agent-runtime';
8
7
  import ProviderConfig from '../components/ProviderConfig';
9
8
 
10
9
  const MistralProvider = memo(() => {
10
+ const theme = useTheme();
11
+
11
12
  return (
12
13
  <ProviderConfig
13
14
  checkModel={'open-mistral-7b'}
14
15
  provider={ModelProvider.Mistral}
15
- title={<Mistral.Combine size={26} type={'color'} />}
16
+ title={
17
+ <Mistral.Combine
18
+ color={theme.isDarkMode ? theme.colorText : Mistral.colorPrimary}
19
+ size={24}
20
+ />
21
+ }
16
22
  />
17
23
  );
18
24
  });
@@ -1,5 +1,3 @@
1
- 'use client';
2
-
3
1
  import { Moonshot } from '@lobehub/icons';
4
2
  import { useTheme } from 'antd-style';
5
3
  import { memo } from 'react';
@@ -18,7 +16,7 @@ const MoonshotProvider = memo(() => {
18
16
  title={
19
17
  <Moonshot.Combine
20
18
  color={theme.isDarkMode ? theme.colorText : Moonshot.colorPrimary}
21
- size={22}
19
+ size={24}
22
20
  />
23
21
  }
24
22
  />
@@ -1,5 +1,3 @@
1
- 'use client';
2
-
3
1
  import { Ollama } from '@lobehub/icons';
4
2
  import { memo } from 'react';
5
3
  import { useTranslation } from 'react-i18next';
@@ -25,7 +23,7 @@ const OllamaProvider = memo(() => {
25
23
  showApiKey={false}
26
24
  showBrowserRequest
27
25
  showEndpoint
28
- title={<Ollama.Combine size={28} />}
26
+ title={<Ollama.Combine size={24} />}
29
27
  />
30
28
  );
31
29
  });
@@ -1,5 +1,3 @@
1
- 'use client';
2
-
3
1
  import { OpenAI } from '@lobehub/icons';
4
2
  import { memo } from 'react';
5
3