@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
@@ -0,0 +1 @@
1
+ export { default } from '@/app/(main)/settings/about/layout';
@@ -0,0 +1 @@
1
+ export { default } from '@/app/(main)/settings/about/page';
@@ -0,0 +1 @@
1
+ export { default } from '@/app/(main)/settings/agent/layout';
@@ -0,0 +1 @@
1
+ export { default } from '@/app/(main)/settings/agent/page';
@@ -0,0 +1 @@
1
+ export { default } from '@/app/(main)/settings/common/page';
@@ -0,0 +1,28 @@
1
+ import { Skeleton } from 'antd';
2
+ import dynamic from 'next/dynamic';
3
+ import { PropsWithChildren } from 'react';
4
+
5
+ import SettingModalLayout from '../_layout/SettingModalLayout';
6
+
7
+ const CategoryContent = dynamic(
8
+ () => import('@/app/(main)/settings/@category/features/CategoryContent'),
9
+ { loading: () => <Skeleton paragraph={{ rows: 6 }} title={false} /> },
10
+ );
11
+ const UpgradeAlert = dynamic(() => import('@/app/(main)/settings/features/UpgradeAlert'), {});
12
+
13
+ const Layout = ({ children }: PropsWithChildren) => {
14
+ return (
15
+ <SettingModalLayout
16
+ category={
17
+ <>
18
+ <CategoryContent modal />
19
+ <UpgradeAlert />
20
+ </>
21
+ }
22
+ >
23
+ {children}
24
+ </SettingModalLayout>
25
+ );
26
+ };
27
+
28
+ export default Layout;
@@ -0,0 +1 @@
1
+ export { default } from '@/app/(main)/settings/llm/page';
@@ -0,0 +1,5 @@
1
+ import { Skeleton } from 'antd';
2
+
3
+ export default () => {
4
+ return <Skeleton paragraph={{ rows: 6 }} style={{ paddingBlock: 16 }} />;
5
+ };
@@ -0,0 +1 @@
1
+ export { default } from '@/app/(main)/settings/sync/page';
@@ -0,0 +1 @@
1
+ export { default } from '@/app/(main)/settings/tts/page';
@@ -0,0 +1,59 @@
1
+ 'use client';
2
+
3
+ import { useResponsive, useTheme, useThemeMode } from 'antd-style';
4
+ import { ReactNode, useRef } from 'react';
5
+ import { Flexbox } from 'react-layout-kit';
6
+
7
+ import Header from '@/app/(main)/settings/_layout/Desktop/Header';
8
+ import SideBar from '@/app/(main)/settings/_layout/Desktop/SideBar';
9
+
10
+ interface SettingLayoutProps {
11
+ category: ReactNode;
12
+ children: ReactNode;
13
+ desc?: string;
14
+ title?: string;
15
+ }
16
+
17
+ const SettingModalLayout = ({ children, category, desc, title }: SettingLayoutProps) => {
18
+ const ref = useRef<any>(null);
19
+ const theme = useTheme();
20
+ const { isDarkMode } = useThemeMode();
21
+ const { md = true } = useResponsive();
22
+
23
+ return (
24
+ <>
25
+ {md ? (
26
+ <SideBar
27
+ desc={desc}
28
+ style={{
29
+ background: isDarkMode ? theme.colorBgContainer : theme.colorFillTertiary,
30
+ borderColor: theme.colorFillTertiary,
31
+ }}
32
+ title={title}
33
+ >
34
+ {category}
35
+ </SideBar>
36
+ ) : (
37
+ <Header getContainer={() => ref.current}>{category}</Header>
38
+ )}
39
+ <Flexbox
40
+ align={'center'}
41
+ gap={64}
42
+ style={{
43
+ background: isDarkMode ? theme.colorFillQuaternary : theme.colorBgElevated,
44
+ overflowX: 'hidden',
45
+ overflowY: 'auto',
46
+ paddingBlock: 32,
47
+ paddingInline: 56,
48
+ }}
49
+ width={'100%'}
50
+ >
51
+ {children}
52
+ </Flexbox>
53
+ </>
54
+ );
55
+ };
56
+
57
+ SettingModalLayout.displayName = 'SettingModalLayout';
58
+
59
+ export default SettingModalLayout;
@@ -0,0 +1,36 @@
1
+ 'use client';
2
+
3
+ import { memo } from 'react';
4
+ import { Flexbox } from 'react-layout-kit';
5
+
6
+ import HeaderContent from '@/app/(main)/chat/settings/features/HeaderContent';
7
+ import Menu from '@/components/Menu';
8
+ import { useQuery } from '@/hooks/useQuery';
9
+ import { useQueryRoute } from '@/hooks/useQueryRoute';
10
+
11
+ import { SettingsTabs, useCategory } from './useCategory';
12
+
13
+ const CategoryContent = memo(() => {
14
+ const cateItems = useCategory();
15
+ const router = useQueryRoute();
16
+ const { tab = SettingsTabs.Meta } = useQuery();
17
+
18
+ return (
19
+ <>
20
+ <Menu
21
+ items={cateItems}
22
+ onClick={({ key }) => {
23
+ router.replace('/chat/settings', { tab: key });
24
+ }}
25
+ selectable
26
+ selectedKeys={[tab as any]}
27
+ variant={'compact'}
28
+ />
29
+ <Flexbox align={'center'} gap={8} paddingInline={8} width={'100%'}>
30
+ <HeaderContent modal />
31
+ </Flexbox>
32
+ </>
33
+ );
34
+ });
35
+
36
+ export default CategoryContent;
@@ -0,0 +1,62 @@
1
+ import { Icon } from '@lobehub/ui';
2
+ import { Blocks, Bot, BrainCog, MessagesSquare, Mic2, UserCircle } from 'lucide-react';
3
+ import { useMemo } from 'react';
4
+ import { useTranslation } from 'react-i18next';
5
+
6
+ import type { MenuProps } from '@/components/Menu';
7
+
8
+ export enum SettingsTabs {
9
+ Chat = 'chat',
10
+ Meta = 'meta',
11
+ Modal = 'modal',
12
+ Plugin = 'plugin',
13
+ Prompt = 'prompt',
14
+ TTS = 'tts',
15
+ }
16
+
17
+ interface UseCategoryOptions {
18
+ mobile?: boolean;
19
+ }
20
+
21
+ export const useCategory = ({ mobile }: UseCategoryOptions = {}) => {
22
+ const { t } = useTranslation('setting');
23
+ const iconSize = mobile ? { fontSize: 20 } : undefined;
24
+
25
+ const cateItems: MenuProps['items'] = useMemo(
26
+ () => [
27
+ {
28
+ icon: <Icon icon={UserCircle} size={iconSize} />,
29
+ key: SettingsTabs.Meta,
30
+ label: t('settingAgent.title'),
31
+ },
32
+ {
33
+ icon: <Icon icon={Bot} size={iconSize} />,
34
+ key: SettingsTabs.Prompt,
35
+ label: t('settingAgent.prompt.title'),
36
+ },
37
+ {
38
+ icon: <Icon icon={MessagesSquare} size={iconSize} />,
39
+ key: SettingsTabs.Chat,
40
+ label: t('settingChat.title'),
41
+ },
42
+ {
43
+ icon: <Icon icon={BrainCog} size={iconSize} />,
44
+ key: SettingsTabs.Modal,
45
+ label: t('settingModel.title'),
46
+ },
47
+ {
48
+ icon: <Icon icon={Mic2} size={iconSize} />,
49
+ key: SettingsTabs.TTS,
50
+ label: t('settingTTS.title'),
51
+ },
52
+ {
53
+ icon: <Icon icon={Blocks} size={iconSize} />,
54
+ key: SettingsTabs.Plugin,
55
+ label: t('settingPlugin.title'),
56
+ },
57
+ ],
58
+ [t],
59
+ );
60
+
61
+ return cateItems;
62
+ };
@@ -0,0 +1,55 @@
1
+ 'use client';
2
+
3
+ import { Skeleton } from 'antd';
4
+ import isEqual from 'fast-deep-equal';
5
+ import dynamic from 'next/dynamic';
6
+ import { PropsWithChildren } from 'react';
7
+ import { useTranslation } from 'react-i18next';
8
+
9
+ import StoreUpdater from '@/features/AgentSetting/StoreUpdater';
10
+ import { Provider, createStore } from '@/features/AgentSetting/store';
11
+ import { useAgentStore } from '@/store/agent';
12
+ import { agentSelectors } from '@/store/agent/slices/chat';
13
+ import { useSessionStore } from '@/store/session';
14
+ import { sessionMetaSelectors } from '@/store/session/selectors';
15
+
16
+ import SettingModalLayout from '../../_layout/SettingModalLayout';
17
+
18
+ const CategoryContent = dynamic(() => import('./features/CategoryContent'), {
19
+ loading: () => <Skeleton paragraph={{ rows: 6 }} title={false} />,
20
+ ssr: false,
21
+ });
22
+
23
+ const Layout = ({ children }: PropsWithChildren) => {
24
+ const { t } = useTranslation('setting');
25
+ const id = useSessionStore((s) => s.activeId);
26
+ const config = useAgentStore(agentSelectors.currentAgentConfig, isEqual);
27
+ const meta = useSessionStore(sessionMetaSelectors.currentAgentMeta, isEqual);
28
+ const [updateAgentConfig] = useAgentStore((s) => [s.updateAgentConfig]);
29
+
30
+ const [updateAgentMeta] = useSessionStore((s) => [
31
+ s.updateSessionMeta,
32
+ sessionMetaSelectors.currentAgentTitle(s),
33
+ ]);
34
+
35
+ return (
36
+ <SettingModalLayout
37
+ category={<CategoryContent />}
38
+ desc={t('header.sessionDesc')}
39
+ title={t('header.session')}
40
+ >
41
+ <Provider createStore={createStore}>
42
+ <StoreUpdater
43
+ config={config}
44
+ id={id}
45
+ meta={meta}
46
+ onConfigChange={updateAgentConfig}
47
+ onMetaChange={updateAgentMeta}
48
+ />
49
+ {children}
50
+ </Provider>
51
+ </SettingModalLayout>
52
+ );
53
+ };
54
+
55
+ export default Layout;
@@ -0,0 +1,5 @@
1
+ import { Skeleton } from 'antd';
2
+
3
+ export default () => {
4
+ return <Skeleton paragraph={{ rows: 6 }} style={{ paddingBlock: 16 }} />;
5
+ };
@@ -0,0 +1,40 @@
1
+ 'use client';
2
+
3
+ import dynamic from 'next/dynamic';
4
+ import { useSearchParams } from 'next/navigation';
5
+ import qs from 'query-string';
6
+
7
+ import AgentMeta from '@/features/AgentSetting/AgentMeta';
8
+
9
+ import { SettingsTabs } from './features/useCategory';
10
+ import Skeleton from './loading';
11
+
12
+ const loading = () => <Skeleton />;
13
+
14
+ const AgentChat = dynamic(() => import('@/features/AgentSetting/AgentChat'), { loading });
15
+
16
+ const AgentPrompt = dynamic(() => import('@/features/AgentSetting/AgentPrompt'), { loading });
17
+
18
+ const AgentPlugin = dynamic(() => import('@/features/AgentSetting/AgentPlugin'), { loading });
19
+
20
+ const AgentModal = dynamic(() => import('@/features/AgentSetting/AgentModal'), { loading });
21
+
22
+ const AgentTTS = dynamic(() => import('@/features/AgentSetting/AgentTTS'), { loading });
23
+ const Page = () => {
24
+ const rawQuery = useSearchParams();
25
+ const { tab = SettingsTabs.Meta } = qs.parse(rawQuery.toString());
26
+ return (
27
+ <>
28
+ {tab === SettingsTabs.Meta && <AgentMeta />}
29
+ {tab === SettingsTabs.Prompt && <AgentPrompt modal />}
30
+ {tab === SettingsTabs.Chat && <AgentChat />}
31
+ {tab === SettingsTabs.Modal && <AgentModal />}
32
+ {tab === SettingsTabs.TTS && <AgentTTS />}
33
+ {tab === SettingsTabs.Plugin && <AgentPlugin />}
34
+ </>
35
+ );
36
+ };
37
+
38
+ Page.displayName = 'AgentSettingModal';
39
+
40
+ export default Page;
@@ -0,0 +1 @@
1
+ export default () => null;
@@ -0,0 +1,30 @@
1
+ 'use client';
2
+
3
+ import { Modal } from '@lobehub/ui';
4
+ import { useRouter } from 'next/navigation';
5
+ import { PropsWithChildren, useState } from 'react';
6
+
7
+ const SessionSettingsModal = ({ children }: PropsWithChildren) => {
8
+ const [open, setOpen] = useState(true);
9
+ const router = useRouter();
10
+
11
+ return (
12
+ <Modal
13
+ footer={null}
14
+ onCancel={() => {
15
+ setOpen(false);
16
+ setTimeout(() => router.back(), 250);
17
+ }}
18
+ open={open}
19
+ styles={{
20
+ body: { display: 'flex', minHeight: 'min(75vh, 750px)', overflow: 'hidden', padding: 0 },
21
+ }}
22
+ title={false}
23
+ width={1024}
24
+ >
25
+ {children}
26
+ </Modal>
27
+ );
28
+ };
29
+
30
+ export default SessionSettingsModal;
@@ -0,0 +1,5 @@
1
+ import { Skeleton } from 'antd';
2
+
3
+ export default () => {
4
+ return <Skeleton paragraph={{ rows: 6 }} style={{ padding: 56 }} />;
5
+ };
@@ -1,7 +1,7 @@
1
1
  import { SpeedInsights } from '@vercel/speed-insights/next';
2
2
  import { ResolvingViewport } from 'next';
3
3
  import { cookies } from 'next/headers';
4
- import { PropsWithChildren } from 'react';
4
+ import { ReactNode } from 'react';
5
5
  import { isRtlLang } from 'rtl-detect';
6
6
 
7
7
  import Analytics from '@/components/Analytics';
@@ -10,7 +10,12 @@ import AuthProvider from '@/layout/AuthProvider';
10
10
  import GlobalProvider from '@/layout/GlobalProvider';
11
11
  import { isMobileDevice } from '@/utils/responsive';
12
12
 
13
- const RootLayout = async ({ children }: PropsWithChildren) => {
13
+ type RootLayoutProps = {
14
+ children: ReactNode;
15
+ modal: ReactNode;
16
+ };
17
+
18
+ const RootLayout = async ({ children, modal }: RootLayoutProps) => {
14
19
  const cookieStore = cookies();
15
20
 
16
21
  const lang = cookieStore.get(LOBE_LOCALE_COOKIE);
@@ -20,7 +25,10 @@ const RootLayout = async ({ children }: PropsWithChildren) => {
20
25
  <html dir={direction} lang={lang?.value || DEFAULT_LANG} suppressHydrationWarning>
21
26
  <body>
22
27
  <GlobalProvider>
23
- <AuthProvider>{children}</AuthProvider>
28
+ <AuthProvider>
29
+ {children}
30
+ {modal}
31
+ </AuthProvider>
24
32
  </GlobalProvider>
25
33
  <Analytics />
26
34
  <SpeedInsights />
@@ -0,0 +1,39 @@
1
+ 'use client';
2
+
3
+ import { Logo } from '@lobehub/ui';
4
+ import { createStyles } from 'antd-style';
5
+ import Link from 'next/link';
6
+ import { memo } from 'react';
7
+ import { Flexbox, FlexboxProps } from 'react-layout-kit';
8
+
9
+ const useStyles = createStyles(({ token, css }) => ({
10
+ logoLink: css`
11
+ height: 20px;
12
+ color: inherit;
13
+
14
+ &:hover {
15
+ color: ${token.colorLink};
16
+ }
17
+ `,
18
+ }));
19
+
20
+ const BrandWatermark = memo<Omit<FlexboxProps, 'children'>>(({ style, ...rest }) => {
21
+ const { styles, theme } = useStyles();
22
+ return (
23
+ <Flexbox
24
+ align={'center'}
25
+ flex={'none'}
26
+ gap={4}
27
+ horizontal
28
+ style={{ color: theme.colorTextDescription, fontSize: 12, ...style }}
29
+ {...rest}
30
+ >
31
+ <span>Powered by</span>
32
+ <Link className={styles.logoLink} href={'https://lobehub.com'} target={'_blank'}>
33
+ <Logo size={20} type={'text'} />
34
+ </Link>
35
+ </Flexbox>
36
+ );
37
+ });
38
+
39
+ export default BrandWatermark;
@@ -0,0 +1,19 @@
1
+ 'use client';
2
+
3
+ import { createStyles } from 'antd-style';
4
+ import { memo } from 'react';
5
+
6
+ const useStyles = createStyles(
7
+ ({ css, token }) => css`
8
+ height: 6px;
9
+ background: ${token.colorBgLayout};
10
+ `,
11
+ );
12
+
13
+ const Divider = memo(() => {
14
+ const { styles } = useStyles();
15
+
16
+ return <div className={styles} />;
17
+ });
18
+
19
+ export default Divider;
@@ -0,0 +1,38 @@
1
+ import { Icon, List } from '@lobehub/ui';
2
+ import { createStyles } from 'antd-style';
3
+ import { ChevronRight } from 'lucide-react';
4
+ import { ReactNode, memo } from 'react';
5
+
6
+ const { Item } = List;
7
+
8
+ const useStyles = createStyles(({ css }) => ({
9
+ container: css`
10
+ position: relative;
11
+ padding-block: 16px !important;
12
+ border-radius: 0;
13
+ `,
14
+ }));
15
+
16
+ export interface CellProps {
17
+ icon: ReactNode;
18
+ label: string | ReactNode;
19
+ onClick?: () => void;
20
+ }
21
+
22
+ const Cell = memo<CellProps>(({ label, icon, onClick }) => {
23
+ const { cx, styles } = useStyles();
24
+
25
+ return (
26
+ <Item
27
+ active={false}
28
+ avatar={icon}
29
+ className={cx(styles.container)}
30
+ onClick={onClick}
31
+ title={label as string}
32
+ >
33
+ <Icon icon={ChevronRight} size={{ fontSize: 16 }} />
34
+ </Item>
35
+ );
36
+ });
37
+
38
+ export default Cell;
@@ -0,0 +1,97 @@
1
+ import { Menu as AntdMenu, MenuProps as AntdMenuProps, ConfigProvider } from 'antd';
2
+ import { createStyles } from 'antd-style';
3
+ import { memo } from 'react';
4
+
5
+ const useStyles = createStyles(({ css, token, prefixCls }) => ({
6
+ compact: css`
7
+ display: flex;
8
+ flex-direction: column;
9
+ gap: 0.125rem;
10
+ `,
11
+ menu: css`
12
+ flex: 1;
13
+ background: transparent;
14
+ border: none !important;
15
+
16
+ .${prefixCls}-menu-item-divider {
17
+ margin-block: 0.125rem;
18
+ border-color: ${token.colorFillTertiary};
19
+
20
+ &:first-child {
21
+ margin-top: 0;
22
+ }
23
+
24
+ &:last-child {
25
+ margin-bottom: 0;
26
+ }
27
+ }
28
+
29
+ .${prefixCls}-menu-item, .${prefixCls}-menu-submenu-title {
30
+ display: flex;
31
+ gap: 0.75rem;
32
+ align-items: center;
33
+
34
+ height: unset;
35
+ min-height: 2rem;
36
+ padding: 0.375rem 0.75rem;
37
+
38
+ line-height: 2;
39
+
40
+ .anticon + .${prefixCls}-menu-title-content {
41
+ margin-inline-start: 0;
42
+ }
43
+ }
44
+
45
+ .${prefixCls}-menu-item-selected {
46
+ .${prefixCls}-menu-item-icon svg {
47
+ color: ${token.colorText};
48
+ }
49
+ }
50
+
51
+ .${prefixCls}-menu-item-icon svg {
52
+ color: ${token.colorTextSecondary};
53
+ }
54
+
55
+ .${prefixCls}-menu-title-content {
56
+ flex: 1;
57
+ }
58
+ `,
59
+ }));
60
+
61
+ export interface MenuProps extends AntdMenuProps {
62
+ variant?: 'default' | 'compact';
63
+ }
64
+
65
+ const Menu = memo<MenuProps>(({ className, selectable = false, variant, ...rest }) => {
66
+ const isCompact = variant === 'compact';
67
+ const { cx, styles, theme } = useStyles();
68
+ return (
69
+ <ConfigProvider
70
+ theme={{
71
+ components: {
72
+ Menu: {
73
+ controlHeightLG: 36,
74
+ iconMarginInlineEnd: 8,
75
+ iconSize: 16,
76
+ itemBorderRadius: theme.borderRadius,
77
+ itemColor: selectable ? theme.colorTextSecondary : theme.colorText,
78
+ itemHoverBg: theme.colorFillTertiary,
79
+ itemMarginBlock: isCompact ? 0 : 4,
80
+ itemMarginInline: isCompact ? 0 : 4,
81
+ itemSelectedBg: theme.colorFillSecondary,
82
+ paddingXS: -8,
83
+ },
84
+ },
85
+ }}
86
+ >
87
+ <AntdMenu
88
+ className={cx(styles.menu, isCompact && styles.compact, className)}
89
+ mode="vertical"
90
+ selectable={selectable}
91
+ {...rest}
92
+ />
93
+ </ConfigProvider>
94
+ );
95
+ });
96
+
97
+ export default Menu;
@@ -0,0 +1,21 @@
1
+ 'use client';
2
+
3
+ import { Skeleton, SkeletonProps } from 'antd';
4
+ import { createStyles } from 'antd-style';
5
+ import { memo } from 'react';
6
+
7
+ const useStyles = createStyles(
8
+ ({ css, responsive }) => css`
9
+ ${responsive.mobile} {
10
+ padding: 16px;
11
+ }
12
+ `,
13
+ );
14
+
15
+ const SkeletonLoading = memo<SkeletonProps>(({ className, ...rest }) => {
16
+ const { cx, styles } = useStyles();
17
+
18
+ return <Skeleton className={cx(styles, className)} paragraph={{ rows: 8 }} {...rest} />;
19
+ });
20
+
21
+ export default SkeletonLoading;
package/src/const/url.ts CHANGED
@@ -29,6 +29,7 @@ export const ABOUT = OFFICIAL_SITE;
29
29
  export const FEEDBACK = pkg.bugs.url;
30
30
  export const DISCORD = 'https://discord.gg/AYFPHvv2jT';
31
31
  export const PRIVACY_URL = urlJoin(OFFICIAL_SITE, '/privacy');
32
+ export const TERMS_URL = urlJoin(OFFICIAL_SITE, '/terms');
32
33
 
33
34
  export const PLUGINS_INDEX_URL = 'https://chat-plugins.lobehub.com';
34
35