@lobehub/chat 0.152.0 → 0.152.2

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 (255) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/README.md +8 -8
  3. package/README.zh-CN.md +8 -8
  4. package/locales/ar/common.json +14 -0
  5. package/locales/ar/setting.json +4 -1
  6. package/locales/bg-BG/common.json +14 -0
  7. package/locales/bg-BG/setting.json +4 -1
  8. package/locales/de-DE/common.json +14 -0
  9. package/locales/de-DE/setting.json +4 -1
  10. package/locales/en-US/common.json +14 -0
  11. package/locales/en-US/setting.json +4 -1
  12. package/locales/es-ES/common.json +14 -0
  13. package/locales/es-ES/setting.json +4 -1
  14. package/locales/fr-FR/common.json +14 -0
  15. package/locales/fr-FR/setting.json +4 -1
  16. package/locales/it-IT/common.json +14 -0
  17. package/locales/it-IT/setting.json +4 -1
  18. package/locales/ja-JP/common.json +14 -0
  19. package/locales/ja-JP/setting.json +4 -1
  20. package/locales/ko-KR/common.json +14 -0
  21. package/locales/ko-KR/setting.json +4 -1
  22. package/locales/nl-NL/common.json +14 -0
  23. package/locales/nl-NL/setting.json +4 -1
  24. package/locales/pl-PL/common.json +14 -0
  25. package/locales/pl-PL/setting.json +4 -1
  26. package/locales/pt-BR/common.json +14 -0
  27. package/locales/pt-BR/setting.json +4 -1
  28. package/locales/ru-RU/common.json +14 -0
  29. package/locales/ru-RU/setting.json +4 -1
  30. package/locales/tr-TR/common.json +14 -0
  31. package/locales/tr-TR/setting.json +4 -1
  32. package/locales/vi-VN/common.json +14 -0
  33. package/locales/vi-VN/setting.json +4 -1
  34. package/locales/zh-CN/common.json +14 -0
  35. package/locales/zh-CN/setting.json +4 -1
  36. package/locales/zh-TW/common.json +14 -0
  37. package/locales/zh-TW/setting.json +4 -1
  38. package/package.json +1 -1
  39. package/src/app/(main)/(mobile)/me/features/AvatarBanner.tsx +52 -0
  40. package/src/app/(main)/(mobile)/me/features/Cate.tsx +34 -0
  41. package/src/app/(main)/(mobile)/me/features/ExtraCate.tsx +26 -0
  42. package/src/app/(main)/(mobile)/me/features/useExtraCate.tsx +68 -0
  43. package/src/app/(main)/(mobile)/me/layout.tsx +11 -0
  44. package/src/app/(main)/(mobile)/me/loading.tsx +17 -0
  45. package/src/app/(main)/(mobile)/me/page.tsx +31 -0
  46. package/src/app/(main)/@nav/_layout/Desktop/BottomActions.tsx +7 -120
  47. package/src/app/(main)/@nav/_layout/Desktop/index.tsx +7 -2
  48. package/src/app/(main)/@nav/_layout/Mobile.tsx +3 -3
  49. package/src/app/(main)/@nav/features/UserAvatar.tsx +24 -0
  50. package/src/app/(main)/@nav/features/UserPanel/LangButton.tsx +55 -0
  51. package/src/app/(main)/@nav/features/UserPanel/Popover.tsx +34 -0
  52. package/src/app/(main)/@nav/features/UserPanel/ThemeButton.tsx +70 -0
  53. package/src/app/(main)/@nav/features/UserPanel/UserInfo.tsx +35 -0
  54. package/src/app/(main)/@nav/features/UserPanel/index.tsx +69 -0
  55. package/src/app/(main)/@nav/features/UserPanel/useMenu.tsx +144 -0
  56. package/src/app/(main)/@nav/features/UserPanel/useNewVersion.tsx +12 -0
  57. package/src/app/(main)/chat/(mobile)/features/SessionHeader.tsx +1 -1
  58. package/src/app/(main)/chat/_layout/Desktop/index.tsx +6 -8
  59. package/src/app/(main)/chat/_layout/Mobile/index.tsx +5 -3
  60. package/src/app/(main)/chat/_layout/type.ts +5 -0
  61. package/src/app/(main)/chat/features/SettingButton.tsx +5 -2
  62. package/src/app/(main)/chat/layout.ts +5 -2
  63. package/src/app/(main)/chat/settings/{(desktop) → _layout/Desktop}/Header.tsx +2 -0
  64. package/src/app/(main)/chat/settings/_layout/Desktop/index.tsx +32 -0
  65. package/src/app/(main)/chat/settings/{(mobile) → _layout/Mobile}/Header.tsx +3 -2
  66. package/src/app/(main)/chat/settings/_layout/Mobile/index.tsx +15 -0
  67. package/src/app/(main)/chat/settings/error.tsx +5 -0
  68. package/src/app/(main)/chat/settings/features/HeaderContent.tsx +15 -9
  69. package/src/app/(main)/chat/settings/features/SubmitAgentButton/SubmitAgentModal.tsx +2 -0
  70. package/src/app/(main)/chat/settings/features/SubmitAgentButton/index.tsx +16 -8
  71. package/src/app/(main)/chat/settings/layout.tsx +9 -2
  72. package/src/app/(main)/chat/settings/loading.tsx +3 -0
  73. package/src/app/(main)/chat/settings/not-found.tsx +3 -0
  74. package/src/app/(main)/chat/settings/page.tsx +2 -9
  75. package/src/app/(main)/market/@detail/default.tsx +12 -0
  76. package/src/app/(main)/market/{features/AgentDetailContent/AgentInfo → @detail/features/AgentDetailContent}/Header.tsx +30 -21
  77. package/src/app/(main)/market/{features/AgentDetailContent/AgentInfo → @detail/features/AgentDetailContent}/index.tsx +10 -4
  78. package/src/app/(main)/market/{features/AgentDetailContent/AgentInfo → @detail/features/AgentDetailContent}/style.ts +7 -11
  79. package/src/app/(main)/market/@detail/loading.tsx +1 -0
  80. package/src/app/(main)/market/_layout/Desktop/{AgentDetail.tsx → DetailSidebar.tsx} +17 -12
  81. package/src/app/(main)/market/_layout/Desktop/Header.tsx +3 -6
  82. package/src/app/(main)/market/_layout/Desktop/Hero.tsx +39 -0
  83. package/src/app/(main)/market/_layout/Desktop/index.tsx +24 -44
  84. package/src/app/(main)/market/{(mobile)/features/AgentDetail.tsx → _layout/Mobile/DetailModal.tsx} +9 -7
  85. package/src/app/(main)/market/_layout/Mobile/Header.tsx +2 -2
  86. package/src/app/(main)/market/_layout/Mobile/index.tsx +17 -9
  87. package/src/app/(main)/market/_layout/type.ts +6 -0
  88. package/src/app/(main)/market/features/AgentCard/AgentCardBanner.tsx +10 -9
  89. package/src/app/(main)/market/features/AgentCard/index.tsx +133 -58
  90. package/src/app/(main)/market/features/AgentList.tsx +94 -0
  91. package/src/app/(main)/market/features/AgentSearchBar.tsx +42 -0
  92. package/src/app/(main)/market/features/ShareAgentButton/Inner.tsx +9 -7
  93. package/src/app/(main)/market/features/ShareAgentButton/index.tsx +22 -15
  94. package/src/app/(main)/market/features/TagList.tsx +65 -0
  95. package/src/app/(main)/market/layout.tsx +11 -0
  96. package/src/app/(main)/market/loading.tsx +2 -2
  97. package/src/app/(main)/market/page.tsx +22 -12
  98. package/src/app/(main)/settings/@category/default.tsx +16 -0
  99. package/src/app/(main)/settings/@category/features/CategoryContent.tsx +35 -0
  100. package/src/app/(main)/settings/@category/features/UpgradeAlert.tsx +38 -0
  101. package/src/app/(main)/settings/_layout/Desktop/Header.tsx +78 -23
  102. package/src/app/(main)/settings/_layout/Desktop/SideBar.tsx +39 -27
  103. package/src/app/(main)/settings/_layout/Desktop/index.tsx +41 -17
  104. package/src/app/(main)/settings/_layout/Mobile/{SubSettingHeader.tsx → Header.tsx} +3 -1
  105. package/src/app/(main)/settings/_layout/Mobile/index.tsx +7 -18
  106. package/src/app/(main)/settings/_layout/type.ts +6 -0
  107. package/src/app/(main)/settings/about/features/AboutList.tsx +122 -0
  108. package/src/app/(main)/settings/about/features/Analytics.tsx +42 -0
  109. package/src/app/(main)/settings/about/layout.tsx +26 -0
  110. package/src/app/(main)/settings/about/loading.tsx +5 -0
  111. package/src/app/(main)/settings/about/page.tsx +20 -25
  112. package/src/app/(main)/settings/agent/layout.tsx +35 -0
  113. package/src/app/(main)/settings/agent/loading.tsx +4 -2
  114. package/src/app/(main)/settings/agent/page.tsx +25 -12
  115. package/src/app/(main)/settings/common/{Common.tsx → features/Common.tsx} +7 -5
  116. package/src/app/(main)/settings/common/{Theme.tsx → features/Theme/index.tsx} +8 -6
  117. package/src/app/(main)/settings/common/page.tsx +21 -4
  118. package/src/app/(main)/settings/error.tsx +5 -0
  119. package/src/app/(main)/settings/features/Footer.tsx +2 -0
  120. package/src/app/(main)/settings/features/UpgradeAlert.tsx +21 -13
  121. package/src/app/(main)/settings/hooks/useCategory.tsx +54 -0
  122. package/src/app/(main)/settings/hooks/useSyncSettings.ts +2 -2
  123. package/src/app/(main)/settings/layout.ts +4 -1
  124. package/src/app/(main)/settings/llm/Anthropic/index.tsx +4 -10
  125. package/src/app/(main)/settings/llm/Azure/index.tsx +3 -1
  126. package/src/app/(main)/settings/llm/Bedrock/index.tsx +3 -1
  127. package/src/app/(main)/settings/llm/Google/index.tsx +4 -2
  128. package/src/app/(main)/settings/llm/Groq/index.tsx +3 -1
  129. package/src/app/(main)/settings/llm/Minimax/index.tsx +3 -9
  130. package/src/app/(main)/settings/llm/Mistral/index.tsx +3 -9
  131. package/src/app/(main)/settings/llm/Moonshot/index.tsx +3 -1
  132. package/src/app/(main)/settings/llm/Ollama/index.tsx +3 -1
  133. package/src/app/(main)/settings/llm/OpenAI/index.tsx +2 -0
  134. package/src/app/(main)/settings/llm/OpenRouter/index.tsx +3 -9
  135. package/src/app/(main)/settings/llm/Perplexity/index.tsx +3 -9
  136. package/src/app/(main)/settings/llm/TogetherAI/index.tsx +3 -9
  137. package/src/app/(main)/settings/llm/ZeroOne/index.tsx +3 -9
  138. package/src/app/(main)/settings/llm/Zhipu/index.tsx +3 -10
  139. package/src/app/(main)/settings/llm/components/Checker.tsx +2 -0
  140. package/src/app/(main)/settings/llm/components/Footer.tsx +26 -0
  141. package/src/app/(main)/settings/llm/components/ProviderConfig/index.tsx +16 -1
  142. package/src/app/(main)/settings/llm/page.tsx +57 -3
  143. package/src/app/(main)/settings/loading.tsx +9 -0
  144. package/src/app/(main)/settings/not-found.tsx +3 -0
  145. package/src/app/(main)/settings/page.tsx +2 -14
  146. package/src/app/(main)/settings/sync/{DeviceInfo → features/DeviceInfo}/Card.tsx +6 -5
  147. package/src/app/(main)/settings/sync/features/DeviceInfo/DeviceName.tsx +63 -0
  148. package/src/app/(main)/settings/sync/{components → features/DeviceInfo}/SystemIcon.tsx +6 -14
  149. package/src/app/(main)/settings/sync/{DeviceInfo → features/DeviceInfo}/index.tsx +22 -36
  150. package/src/app/(main)/settings/sync/{WebRTC → features/WebRTC}/ChannelNameInput.tsx +3 -3
  151. package/src/app/(main)/settings/sync/{WebRTC → features/WebRTC}/index.tsx +10 -9
  152. package/src/app/(main)/settings/sync/page.tsx +19 -11
  153. package/src/app/(main)/settings/tts/features/OpenAI.tsx +54 -0
  154. package/src/app/(main)/settings/tts/{TTS/index.tsx → features/STT.tsx} +11 -27
  155. package/src/app/(main)/settings/tts/page.tsx +17 -11
  156. package/src/app/@modal/(.)settings/about/layout.tsx +1 -0
  157. package/src/app/@modal/(.)settings/about/page.tsx +1 -0
  158. package/src/app/@modal/(.)settings/agent/layout.tsx +1 -0
  159. package/src/app/@modal/(.)settings/agent/page.tsx +1 -0
  160. package/src/app/@modal/(.)settings/common/page.tsx +1 -0
  161. package/src/app/@modal/(.)settings/layout.tsx +28 -0
  162. package/src/app/@modal/(.)settings/llm/page.tsx +1 -0
  163. package/src/app/@modal/(.)settings/loading.tsx +5 -0
  164. package/src/app/@modal/(.)settings/sync/page.tsx +1 -0
  165. package/src/app/@modal/(.)settings/tts/page.tsx +1 -0
  166. package/src/app/@modal/_layout/SettingModalLayout.tsx +59 -0
  167. package/src/app/@modal/chat/(.)settings/features/CategoryContent.tsx +36 -0
  168. package/src/app/@modal/chat/(.)settings/features/useCategory.tsx +62 -0
  169. package/src/app/@modal/chat/(.)settings/layout.tsx +55 -0
  170. package/src/app/@modal/chat/(.)settings/loading.tsx +5 -0
  171. package/src/app/@modal/chat/(.)settings/page.tsx +40 -0
  172. package/src/app/@modal/default.tsx +1 -0
  173. package/src/app/@modal/layout.tsx +30 -0
  174. package/src/app/@modal/loading.tsx +5 -0
  175. package/src/app/layout.tsx +11 -3
  176. package/src/components/BrandWatermark/index.tsx +39 -0
  177. package/src/components/Cell/Divider.tsx +19 -0
  178. package/src/components/Cell/index.tsx +38 -0
  179. package/src/components/Menu/index.tsx +97 -0
  180. package/src/components/SkeletonLoading/index.tsx +21 -0
  181. package/src/const/url.ts +1 -0
  182. package/src/features/AgentSetting/AgentChat/index.tsx +135 -0
  183. package/src/features/AgentSetting/AgentMeta/index.tsx +4 -3
  184. package/src/features/AgentSetting/AgentModal/index.tsx +95 -0
  185. package/src/features/AgentSetting/AgentPlugin/index.tsx +65 -66
  186. package/src/features/AgentSetting/AgentPrompt/index.tsx +101 -47
  187. package/src/features/AgentSetting/AgentTTS/index.tsx +4 -0
  188. package/src/features/AgentSetting/StoreUpdater.tsx +2 -0
  189. package/src/features/AgentSetting/index.tsx +6 -6
  190. package/src/features/AgentSetting/store/index.ts +2 -0
  191. package/src/features/AvatarWithUpload/index.tsx +2 -0
  192. package/src/features/ChatInput/STT/browser.tsx +1 -1
  193. package/src/features/ChatInput/STT/openai.tsx +1 -1
  194. package/src/features/Conversation/components/InboxWelcome/AgentsSuggest.tsx +2 -2
  195. package/src/hooks/useQuery.ts +7 -0
  196. package/src/hooks/useQueryRoute.ts +16 -0
  197. package/src/locales/default/common.ts +14 -0
  198. package/src/locales/default/setting.ts +3 -0
  199. package/src/locales/resources.ts +1 -0
  200. package/src/server/redirectHard.ts +9 -0
  201. package/src/server/translation.ts +20 -0
  202. package/src/services/__tests__/chat.test.ts +1 -1
  203. package/src/store/global/initialState.ts +1 -0
  204. package/src/store/market/action.ts +1 -1
  205. package/src/store/session/slices/session/action.ts +1 -1
  206. package/src/utils/difference.ts +2 -1
  207. package/src/app/(main)/@nav/_layout/Desktop/Avatar.tsx +0 -11
  208. package/src/app/(main)/chat/settings/(desktop)/index.tsx +0 -23
  209. package/src/app/(main)/chat/settings/(mobile)/index.tsx +0 -16
  210. package/src/app/(main)/market/(desktop)/index.tsx +0 -20
  211. package/src/app/(main)/market/(mobile)/features/AgentCard.tsx +0 -31
  212. package/src/app/(main)/market/(mobile)/index.tsx +0 -25
  213. package/src/app/(main)/market/components/Loading.tsx +0 -13
  214. package/src/app/(main)/market/features/AgentCard/AgentCardItem.tsx +0 -54
  215. package/src/app/(main)/market/features/AgentCard/style.ts +0 -33
  216. package/src/app/(main)/market/features/AgentDetailContent/index.tsx +0 -12
  217. package/src/app/(main)/market/features/AgentSearchBar/index.tsx +0 -40
  218. package/src/app/(main)/market/features/PageTitle/index.tsx +0 -13
  219. package/src/app/(main)/market/features/TagList/Inner.tsx +0 -28
  220. package/src/app/(main)/market/features/TagList/index.tsx +0 -23
  221. package/src/app/(main)/market/layout.ts +0 -8
  222. package/src/app/(main)/settings/(desktop)/index.tsx +0 -23
  223. package/src/app/(main)/settings/(mobile)/features/AvatarBanner.tsx +0 -68
  224. package/src/app/(main)/settings/(mobile)/features/ExtraList.tsx +0 -65
  225. package/src/app/(main)/settings/(mobile)/index.tsx +0 -53
  226. package/src/app/(main)/settings/about/AboutList.tsx +0 -53
  227. package/src/app/(main)/settings/about/Analytics.tsx +0 -40
  228. package/src/app/(main)/settings/about/style.ts +0 -22
  229. package/src/app/(main)/settings/agent/Agent.tsx +0 -29
  230. package/src/app/(main)/settings/common/index.tsx +0 -24
  231. package/src/app/(main)/settings/common/loading.tsx +0 -3
  232. package/src/app/(main)/settings/features/SettingList/index.tsx +0 -47
  233. package/src/app/(main)/settings/llm/index.tsx +0 -59
  234. package/src/app/(main)/settings/llm/layout.tsx +0 -11
  235. package/src/app/(main)/settings/llm/loading.tsx +0 -3
  236. package/src/app/(main)/settings/sync/DeviceInfo/DeviceName.tsx +0 -66
  237. package/src/app/(main)/settings/sync/PageTitle.tsx +0 -11
  238. package/src/app/(main)/settings/sync/layout.tsx +0 -12
  239. package/src/app/(main)/settings/sync/loading.tsx +0 -3
  240. package/src/app/(main)/settings/tts/loading.tsx +0 -3
  241. package/src/features/AgentSetting/AgentConfig/index.tsx +0 -202
  242. package/src/features/AgentSetting/AgentConfig/useSyncConfig.ts +0 -23
  243. /package/src/app/(main)/market/{features/AgentDetailContent/AgentInfo → @detail/features/AgentDetailContent}/Comment.tsx +0 -0
  244. /package/src/app/(main)/market/{features/AgentDetailContent/AgentInfo → @detail/features/AgentDetailContent}/Loading.tsx +0 -0
  245. /package/src/app/(main)/market/{features/AgentDetailContent/AgentInfo → @detail/features/AgentDetailContent}/TokenTag.tsx +0 -0
  246. /package/src/app/(main)/settings/{features/SettingList → about/features}/Item.tsx +0 -0
  247. /package/src/app/(main)/settings/{features → common/features/Theme}/ThemeSwatches/ThemeSwatchesNeutral.tsx +0 -0
  248. /package/src/app/(main)/settings/{features → common/features/Theme}/ThemeSwatches/ThemeSwatchesPrimary.tsx +0 -0
  249. /package/src/app/(main)/settings/{features → common/features/Theme}/ThemeSwatches/index.ts +0 -0
  250. /package/src/app/(main)/settings/sync/{Alert.tsx → features/Alert.tsx} +0 -0
  251. /package/src/app/(main)/settings/sync/{components → features/WebRTC}/SyncSwitch/index.css +0 -0
  252. /package/src/app/(main)/settings/sync/{components → features/WebRTC}/SyncSwitch/index.tsx +0 -0
  253. /package/src/app/(main)/settings/sync/{util.ts → features/WebRTC/generateRandomRoomName.ts} +0 -0
  254. /package/src/app/(main)/settings/tts/{TTS/options.ts → features/const.ts} +0 -0
  255. /package/src/features/AgentSetting/{AgentConfig → AgentModal}/ModelSelect.tsx +0 -0
@@ -1,18 +1,31 @@
1
- 'use client';
1
+ import AgentChat from '@/features/AgentSetting/AgentChat';
2
+ import AgentMeta from '@/features/AgentSetting/AgentMeta';
3
+ import AgentModal from '@/features/AgentSetting/AgentModal';
4
+ import AgentPlugin from '@/features/AgentSetting/AgentPlugin';
5
+ import AgentPrompt from '@/features/AgentSetting/AgentPrompt';
6
+ import AgentTTS from '@/features/AgentSetting/AgentTTS';
7
+ import { translation } from '@/server/translation';
2
8
 
3
- import { memo } from 'react';
4
- import { useTranslation } from 'react-i18next';
9
+ export const generateMetadata = async () => {
10
+ const { t } = await translation('setting');
11
+ return {
12
+ title: t('tab.agent'),
13
+ };
14
+ };
5
15
 
6
- import PageTitle from '@/components/PageTitle';
7
-
8
- import Agent from './Agent';
9
-
10
- export default memo(() => {
11
- const { t } = useTranslation('setting');
16
+ const Page = () => {
12
17
  return (
13
18
  <>
14
- <PageTitle title={t('tab.agent')} />
15
- <Agent />
19
+ <AgentPrompt />
20
+ <AgentMeta />
21
+ <AgentChat />
22
+ <AgentModal />
23
+ <AgentTTS />
24
+ <AgentPlugin />
16
25
  </>
17
26
  );
18
- });
27
+ };
28
+
29
+ Page.displayName = 'AgentSetting';
30
+
31
+ export default Page;
@@ -1,12 +1,13 @@
1
+ 'use client';
2
+
1
3
  import { Form, type ItemGroup } from '@lobehub/ui';
2
- import { Form as AntForm, App, Button, Input } from 'antd';
4
+ import { App, Button, Input } from 'antd';
3
5
  import isEqual from 'fast-deep-equal';
4
- import { AppWindow } from 'lucide-react';
5
6
  import { signIn, signOut } from 'next-auth/react';
6
7
  import { memo, useCallback } from 'react';
7
8
  import { useTranslation } from 'react-i18next';
8
9
 
9
- import { useSyncSettings } from '@/app/(main)/settings/hooks/useSyncSettings';
10
+ import { useSyncSettings } from '@/app/(main)/settings//hooks/useSyncSettings';
10
11
  import { FORM_STYLE } from '@/const/layoutTokens';
11
12
  import { DEFAULT_SETTINGS } from '@/const/settings';
12
13
  import { useOAuthSession } from '@/hooks/useOAuthSession';
@@ -26,7 +27,7 @@ export interface SettingsCommonProps {
26
27
 
27
28
  const Common = memo<SettingsCommonProps>(({ showAccessCodeConfig, showOAuthLogin }) => {
28
29
  const { t } = useTranslation('setting');
29
- const [form] = AntForm.useForm();
30
+ const [form] = Form.useForm();
30
31
 
31
32
  const { user, isOAuthLoggedIn } = useOAuthSession();
32
33
 
@@ -146,7 +147,6 @@ const Common = memo<SettingsCommonProps>(({ showAccessCodeConfig, showOAuthLogin
146
147
  minWidth: undefined,
147
148
  },
148
149
  ],
149
- icon: AppWindow,
150
150
  title: t('settingSystem.title'),
151
151
  };
152
152
 
@@ -157,7 +157,9 @@ const Common = memo<SettingsCommonProps>(({ showAccessCodeConfig, showOAuthLogin
157
157
  form={form}
158
158
  initialValues={settings}
159
159
  items={[system]}
160
+ itemsType={'group'}
160
161
  onValuesChange={setSettings}
162
+ variant={'pure'}
161
163
  {...FORM_STYLE}
162
164
  />
163
165
  );
@@ -1,7 +1,9 @@
1
+ 'use client';
2
+
1
3
  import { Form, type ItemGroup, SelectWithImg, SliderWithInput } from '@lobehub/ui';
2
- import { Form as AntForm, Select } from 'antd';
4
+ import { Select } from 'antd';
3
5
  import isEqual from 'fast-deep-equal';
4
- import { Monitor, Moon, Palette, Sun } from 'lucide-react';
6
+ import { Monitor, Moon, Sun } from 'lucide-react';
5
7
  import { memo } from 'react';
6
8
  import { useTranslation } from 'react-i18next';
7
9
 
@@ -14,14 +16,13 @@ import { useUserStore } from '@/store/user';
14
16
  import { settingsSelectors } from '@/store/user/selectors';
15
17
  import { switchLang } from '@/utils/client/switchLang';
16
18
 
17
- import { ThemeSwatchesNeutral, ThemeSwatchesPrimary } from '../features/ThemeSwatches';
19
+ import { ThemeSwatchesNeutral, ThemeSwatchesPrimary } from './ThemeSwatches';
18
20
 
19
21
  type SettingItemGroup = ItemGroup;
20
22
 
21
23
  const Theme = memo(() => {
22
24
  const { t } = useTranslation('setting');
23
- const [form] = AntForm.useForm();
24
-
25
+ const [form] = Form.useForm();
25
26
  const settings = useUserStore(settingsSelectors.currentSettings, isEqual);
26
27
  const [setThemeMode, setSettings] = useUserStore((s) => [s.switchThemeMode, s.setSettings]);
27
28
 
@@ -125,7 +126,6 @@ const Theme = memo(() => {
125
126
  minWidth: undefined,
126
127
  },
127
128
  ],
128
- icon: Palette,
129
129
  title: t('settingTheme.title'),
130
130
  };
131
131
 
@@ -134,7 +134,9 @@ const Theme = memo(() => {
134
134
  form={form}
135
135
  initialValues={settings}
136
136
  items={[theme]}
137
+ itemsType={'group'}
137
138
  onValuesChange={setSettings}
139
+ variant={'pure'}
138
140
  {...FORM_STYLE}
139
141
  />
140
142
  );
@@ -1,9 +1,26 @@
1
1
  import { getServerConfig } from '@/config/server';
2
+ import { translation } from '@/server/translation';
2
3
 
3
- import Index from './index';
4
+ import Common from './features/Common';
5
+ import Theme from './features/Theme';
4
6
 
5
- export default () => {
6
- const { SHOW_ACCESS_CODE_CONFIG, ENABLE_OAUTH_SSO } = getServerConfig();
7
+ export const generateMetadata = async () => {
8
+ const { t } = await translation('setting');
9
+ return {
10
+ title: t('tab.common'),
11
+ };
12
+ };
7
13
 
8
- return <Index showAccessCodeConfig={SHOW_ACCESS_CODE_CONFIG} showOAuthLogin={ENABLE_OAUTH_SSO} />;
14
+ const Page = () => {
15
+ const { SHOW_ACCESS_CODE_CONFIG, ENABLE_OAUTH_SSO } = getServerConfig();
16
+ return (
17
+ <>
18
+ <Theme />
19
+ <Common showAccessCodeConfig={SHOW_ACCESS_CODE_CONFIG} showOAuthLogin={ENABLE_OAUTH_SSO} />
20
+ </>
21
+ );
9
22
  };
23
+
24
+ Page.displayName = 'CommonSetting';
25
+
26
+ export default Page;
@@ -0,0 +1,5 @@
1
+ 'use client';
2
+
3
+ import dynamic from 'next/dynamic';
4
+
5
+ export default dynamic(() => import('@/components/Error'));
@@ -1,3 +1,5 @@
1
+ 'use client';
2
+
1
3
  import { Divider } from 'antd';
2
4
  import { createStyles } from 'antd-style';
3
5
  import { PropsWithChildren, memo } from 'react';
@@ -1,8 +1,11 @@
1
+ 'use client';
2
+
1
3
  import { Alert } from '@lobehub/ui';
2
4
  import { Button } from 'antd';
3
5
  import Link from 'next/link';
4
6
  import { memo } from 'react';
5
7
  import { useTranslation } from 'react-i18next';
8
+ import { Flexbox } from 'react-layout-kit';
6
9
 
7
10
  import { MANUAL_UPGRADE_URL } from '@/const/url';
8
11
  import { useGlobalStore } from '@/store/global';
@@ -11,23 +14,28 @@ const UpgradeAlert = memo(() => {
11
14
  const [hasNewVersion, latestVersion] = useGlobalStore((s) => [s.hasNewVersion, s.latestVersion]);
12
15
  const { t } = useTranslation('common');
13
16
 
17
+ if (!hasNewVersion) return;
18
+
14
19
  return (
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'}>
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'}>
20
32
  {t('upgradeVersion.action')}
21
33
  </Button>
22
34
  </Link>
23
- }
24
- closable
25
- message={t('upgradeVersion.newVersion', { version: latestVersion })}
26
- showIcon={false}
27
- style={{ marginBottom: 6 }}
28
- type={'info'}
29
- />
30
- )
35
+ </Flexbox>
36
+ }
37
+ type={'info'}
38
+ />
31
39
  );
32
40
  });
33
41
 
@@ -0,0 +1,54 @@
1
+ import { Icon } from '@lobehub/ui';
2
+ import { Bot, Cloudy, Info, Mic2, Settings2, Webhook } from 'lucide-react';
3
+ import { useMemo } from 'react';
4
+ import { useTranslation } from 'react-i18next';
5
+
6
+ import type { MenuProps } from '@/components/Menu';
7
+ import { SettingsTabs } from '@/store/global/initialState';
8
+ import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfig';
9
+
10
+ interface UseCategoryOptions {
11
+ mobile?: boolean;
12
+ }
13
+
14
+ export const useCategory = ({ mobile }: UseCategoryOptions = {}) => {
15
+ const { t } = useTranslation('setting');
16
+ const { enableWebrtc, showLLM } = useServerConfigStore(featureFlagsSelectors);
17
+
18
+ const iconSize = mobile ? { fontSize: 20 } : undefined;
19
+
20
+ const cateItems: MenuProps['items'] = useMemo(
21
+ () =>
22
+ [
23
+ {
24
+ icon: <Icon icon={Settings2} size={iconSize} />,
25
+ key: SettingsTabs.Common,
26
+ label: t('tab.common'),
27
+ },
28
+ enableWebrtc && {
29
+ icon: <Icon icon={Cloudy} size={iconSize} />,
30
+ key: SettingsTabs.Sync,
31
+ label: t('tab.sync'),
32
+ },
33
+ showLLM && {
34
+ icon: <Icon icon={Webhook} size={iconSize} />,
35
+ key: SettingsTabs.LLM,
36
+ label: t('tab.llm'),
37
+ },
38
+ { icon: <Icon icon={Mic2} size={iconSize} />, key: SettingsTabs.TTS, label: t('tab.tts') },
39
+ {
40
+ icon: <Icon icon={Bot} size={iconSize} />,
41
+ key: SettingsTabs.Agent,
42
+ label: t('tab.agent'),
43
+ },
44
+ {
45
+ icon: <Icon icon={Info} size={iconSize} />,
46
+ key: SettingsTabs.About,
47
+ label: t('tab.about'),
48
+ },
49
+ ].filter(Boolean) as MenuProps['items'],
50
+ [t, enableWebrtc, showLLM],
51
+ );
52
+
53
+ return cateItems;
54
+ };
@@ -1,10 +1,10 @@
1
1
  import { FormInstance } from 'antd/es/form/hooks/useForm';
2
- import { useEffect } from 'react';
2
+ import { useLayoutEffect } from 'react';
3
3
 
4
4
  import { useUserStore } from '@/store/user';
5
5
 
6
6
  export const useSyncSettings = (form: FormInstance) => {
7
- useEffect(() => {
7
+ useLayoutEffect(() => {
8
8
  // set the first time
9
9
  form.setFieldsValue(useUserStore.getState().settings);
10
10
 
@@ -2,7 +2,10 @@ 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';
5
6
 
6
- const SettingsLayout = ServerLayout({ Desktop, Mobile });
7
+ const SettingsLayout = ServerLayout<LayoutProps>({ Desktop, Mobile });
8
+
9
+ SettingsLayout.displayName = 'SettingsLayout';
7
10
 
8
11
  export default SettingsLayout;
@@ -1,5 +1,6 @@
1
- import { Anthropic, Claude } from '@lobehub/icons';
2
- import { useTheme } from 'antd-style';
1
+ 'use client';
2
+
3
+ import { Anthropic } from '@lobehub/icons';
3
4
  import { memo } from 'react';
4
5
 
5
6
  import { ModelProvider } from '@/libs/agent-runtime';
@@ -7,19 +8,12 @@ import { ModelProvider } from '@/libs/agent-runtime';
7
8
  import ProviderConfig from '../components/ProviderConfig';
8
9
 
9
10
  const AnthropicProvider = memo(() => {
10
- const theme = useTheme();
11
-
12
11
  return (
13
12
  <ProviderConfig
14
13
  checkModel={'claude-3-haiku-20240307'}
15
14
  provider={ModelProvider.Anthropic}
16
15
  showEndpoint
17
- title={
18
- <Anthropic.Text
19
- color={theme.isDarkMode ? theme.colorText : Claude.colorPrimary}
20
- size={18}
21
- />
22
- }
16
+ title={<Anthropic.Text size={15} />}
23
17
  />
24
18
  );
25
19
  });
@@ -1,3 +1,5 @@
1
+ 'use client';
2
+
1
3
  import { Azure, OpenAI } from '@lobehub/icons';
2
4
  import { Markdown } from '@lobehub/ui';
3
5
  import { AutoComplete, Divider, Input } from 'antd';
@@ -95,7 +97,7 @@ const AzureOpenAIProvider = memo(() => {
95
97
  provider={providerKey}
96
98
  title={
97
99
  <Flexbox align={'center'} gap={8} horizontal>
98
- <Azure.Combine size={24} type={'color'}></Azure.Combine>
100
+ <Azure.Combine size={22} type={'color'}></Azure.Combine>
99
101
  <Divider style={{ margin: '0 4px' }} type={'vertical'} />
100
102
  <OpenAI.Combine size={24}></OpenAI.Combine>
101
103
  </Flexbox>
@@ -1,3 +1,5 @@
1
+ 'use client';
2
+
1
3
  import { Aws, Bedrock } from '@lobehub/icons';
2
4
  import { Divider, Input, Select } from 'antd';
3
5
  import { memo } from 'react';
@@ -62,7 +64,7 @@ const BedrockProvider = memo(() => {
62
64
  <Flexbox align={'center'} gap={8} horizontal>
63
65
  <Aws.Color size={32} />
64
66
  <Divider style={{ margin: '0 4px' }} type={'vertical'} />
65
- <Bedrock.Combine size={24} type={'color'} />
67
+ <Bedrock.Combine size={26} type={'color'} />
66
68
  </Flexbox>
67
69
  }
68
70
  />
@@ -1,3 +1,5 @@
1
+ 'use client';
2
+
1
3
  import { Gemini, Google } from '@lobehub/icons';
2
4
  import { Divider } from 'antd';
3
5
  import { memo } from 'react';
@@ -15,9 +17,9 @@ const GoogleProvider = memo(() => {
15
17
  showEndpoint
16
18
  title={
17
19
  <Flexbox align={'center'} gap={8} horizontal>
18
- <Google.BrandColor size={28} />
20
+ <Google.BrandColor size={22} />
19
21
  <Divider style={{ margin: '0 4px' }} type={'vertical'} />
20
- <Gemini.Combine size={24} type={'color'} />
22
+ <Gemini.Combine size={22} type={'color'} />
21
23
  </Flexbox>
22
24
  }
23
25
  />
@@ -1,3 +1,5 @@
1
+ 'use client';
2
+
1
3
  import { Groq } from '@lobehub/icons';
2
4
  import { useTheme } from 'antd-style';
3
5
  import { memo } from 'react';
@@ -13,7 +15,7 @@ const GroqProvider = memo(() => {
13
15
  <ProviderConfig
14
16
  checkModel={'gemma-7b-it'}
15
17
  provider={ModelProvider.Groq}
16
- title={<Groq.Text color={theme.isDarkMode ? theme.colorText : Groq.colorPrimary} size={24} />}
18
+ title={<Groq.Text color={theme.isDarkMode ? theme.colorText : Groq.colorPrimary} size={20} />}
17
19
  />
18
20
  );
19
21
  });
@@ -1,5 +1,6 @@
1
+ 'use client';
2
+
1
3
  import { Minimax } from '@lobehub/icons';
2
- import { useTheme } from 'antd-style';
3
4
  import { memo } from 'react';
4
5
 
5
6
  import { ModelProvider } from '@/libs/agent-runtime';
@@ -7,18 +8,11 @@ import { ModelProvider } from '@/libs/agent-runtime';
7
8
  import ProviderConfig from '../components/ProviderConfig';
8
9
 
9
10
  const MinimaxProvider = memo(() => {
10
- const theme = useTheme();
11
-
12
11
  return (
13
12
  <ProviderConfig
14
13
  checkModel={'abab5.5s-chat'}
15
14
  provider={ModelProvider.Minimax}
16
- title={
17
- <Minimax.Combine
18
- color={theme.isDarkMode ? theme.colorText : Minimax.colorPrimary}
19
- size={32}
20
- />
21
- }
15
+ title={<Minimax.Combine size={32} type={'color'} />}
22
16
  />
23
17
  );
24
18
  });
@@ -1,5 +1,6 @@
1
+ 'use client';
2
+
1
3
  import { Mistral } from '@lobehub/icons';
2
- import { useTheme } from 'antd-style';
3
4
  import { memo } from 'react';
4
5
 
5
6
  import { ModelProvider } from '@/libs/agent-runtime';
@@ -7,18 +8,11 @@ import { ModelProvider } from '@/libs/agent-runtime';
7
8
  import ProviderConfig from '../components/ProviderConfig';
8
9
 
9
10
  const MistralProvider = memo(() => {
10
- const theme = useTheme();
11
-
12
11
  return (
13
12
  <ProviderConfig
14
13
  checkModel={'open-mistral-7b'}
15
14
  provider={ModelProvider.Mistral}
16
- title={
17
- <Mistral.Combine
18
- color={theme.isDarkMode ? theme.colorText : Mistral.colorPrimary}
19
- size={24}
20
- />
21
- }
15
+ title={<Mistral.Combine size={26} type={'color'} />}
22
16
  />
23
17
  );
24
18
  });
@@ -1,3 +1,5 @@
1
+ 'use client';
2
+
1
3
  import { Moonshot } from '@lobehub/icons';
2
4
  import { useTheme } from 'antd-style';
3
5
  import { memo } from 'react';
@@ -16,7 +18,7 @@ const MoonshotProvider = memo(() => {
16
18
  title={
17
19
  <Moonshot.Combine
18
20
  color={theme.isDarkMode ? theme.colorText : Moonshot.colorPrimary}
19
- size={24}
21
+ size={22}
20
22
  />
21
23
  }
22
24
  />
@@ -1,3 +1,5 @@
1
+ 'use client';
2
+
1
3
  import { Ollama } from '@lobehub/icons';
2
4
  import { memo } from 'react';
3
5
  import { useTranslation } from 'react-i18next';
@@ -23,7 +25,7 @@ const OllamaProvider = memo(() => {
23
25
  showApiKey={false}
24
26
  showBrowserRequest
25
27
  showEndpoint
26
- title={<Ollama.Combine size={24} />}
28
+ title={<Ollama.Combine size={28} />}
27
29
  />
28
30
  );
29
31
  });
@@ -1,3 +1,5 @@
1
+ 'use client';
2
+
1
3
  import { OpenAI } from '@lobehub/icons';
2
4
  import { memo } from 'react';
3
5
 
@@ -1,5 +1,6 @@
1
+ 'use client';
2
+
1
3
  import { OpenRouter } from '@lobehub/icons';
2
- import { useTheme } from 'antd-style';
3
4
  import { memo } from 'react';
4
5
 
5
6
  import { ModelProvider } from '@/libs/agent-runtime';
@@ -7,19 +8,12 @@ import { ModelProvider } from '@/libs/agent-runtime';
7
8
  import ProviderConfig from '../components/ProviderConfig';
8
9
 
9
10
  const OpenRouterProvider = memo(() => {
10
- const theme = useTheme();
11
-
12
11
  return (
13
12
  <ProviderConfig
14
13
  checkModel={'mistralai/mistral-7b-instruct:free'}
15
14
  modelList={{ showModelFetcher: true }}
16
15
  provider={ModelProvider.OpenRouter}
17
- title={
18
- <OpenRouter.Combine
19
- color={theme.isDarkMode ? theme.colorText : OpenRouter.colorPrimary}
20
- size={24}
21
- />
22
- }
16
+ title={<OpenRouter.Combine iconProps={{ color: OpenRouter.colorPrimary }} size={20} />}
23
17
  />
24
18
  );
25
19
  });
@@ -1,5 +1,6 @@
1
+ 'use client';
2
+
1
3
  import { Perplexity } from '@lobehub/icons';
2
- import { useTheme } from 'antd-style';
3
4
  import { memo } from 'react';
4
5
 
5
6
  import { ModelProvider } from '@/libs/agent-runtime';
@@ -7,18 +8,11 @@ import { ModelProvider } from '@/libs/agent-runtime';
7
8
  import ProviderConfig from '../components/ProviderConfig';
8
9
 
9
10
  const PerplexityProvider = memo(() => {
10
- const theme = useTheme();
11
-
12
11
  return (
13
12
  <ProviderConfig
14
13
  checkModel={'pplx-7b-chat'}
15
14
  provider={ModelProvider.Perplexity}
16
- title={
17
- <Perplexity.Combine
18
- color={theme.isDarkMode ? theme.colorText : Perplexity.colorPrimary}
19
- size={24}
20
- />
21
- }
15
+ title={<Perplexity.Combine size={24} type={'color'} />}
22
16
  />
23
17
  );
24
18
  });
@@ -1,23 +1,17 @@
1
+ 'use client';
2
+
1
3
  import { Together } from '@lobehub/icons';
2
- import { useTheme } from 'antd-style';
3
4
  import { memo } from 'react';
4
5
 
5
6
  import ProviderConfig from '../components/ProviderConfig';
6
7
 
7
8
  const TogetherAIProvider = memo(() => {
8
- const theme = useTheme();
9
-
10
9
  return (
11
10
  <ProviderConfig
12
11
  checkModel={'togethercomputer/alpaca-7b'}
13
12
  modelList={{ showModelFetcher: true }}
14
13
  provider={'togetherai'}
15
- title={
16
- <Together.Combine
17
- color={theme.isDarkMode ? theme.colorText : Together.colorPrimary}
18
- size={24}
19
- />
20
- }
14
+ title={<Together.Combine size={26} type={'color'} />}
21
15
  />
22
16
  );
23
17
  });
@@ -1,5 +1,6 @@
1
+ 'use client';
2
+
1
3
  import { ZeroOne } from '@lobehub/icons';
2
- import { useTheme } from 'antd-style';
3
4
  import { memo } from 'react';
4
5
 
5
6
  import { ModelProvider } from '@/libs/agent-runtime';
@@ -7,18 +8,11 @@ import { ModelProvider } from '@/libs/agent-runtime';
7
8
  import ProviderConfig from '../components/ProviderConfig';
8
9
 
9
10
  const ZeroOneProvider = memo(() => {
10
- const theme = useTheme();
11
-
12
11
  return (
13
12
  <ProviderConfig
14
13
  checkModel={'yi-34b-chat-0205'}
15
14
  provider={ModelProvider.ZeroOne}
16
- title={
17
- <ZeroOne.Combine
18
- color={theme.isDarkMode ? theme.colorText : ZeroOne.colorPrimary}
19
- size={32}
20
- />
21
- }
15
+ title={<ZeroOne.Text size={20} />}
22
16
  />
23
17
  );
24
18
  });
@@ -1,23 +1,16 @@
1
+ 'use client';
2
+
1
3
  import { Zhipu } from '@lobehub/icons';
2
- import { useTheme } from 'antd-style';
3
- import { lighten } from 'polished';
4
4
  import { memo } from 'react';
5
5
 
6
6
  import ProviderConfig from '../components/ProviderConfig';
7
7
 
8
8
  const ZhipuProvider = memo(() => {
9
- const theme = useTheme();
10
-
11
9
  return (
12
10
  <ProviderConfig
13
11
  checkModel={'glm-3-turbo'}
14
12
  provider={'zhipu'}
15
- title={
16
- <Zhipu.Combine
17
- color={theme.isDarkMode ? lighten(0.1, Zhipu.colorPrimary) : Zhipu.colorPrimary}
18
- size={32}
19
- />
20
- }
13
+ title={<Zhipu.Combine size={32} type={'color'} />}
21
14
  />
22
15
  );
23
16
  });
@@ -1,3 +1,5 @@
1
+ 'use client';
2
+
1
3
  import { CheckCircleFilled } from '@ant-design/icons';
2
4
  import { Alert, Highlighter } from '@lobehub/ui';
3
5
  import { Button } from 'antd';