@lobehub/chat 0.152.1 → 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 (214) hide show
  1. package/CHANGELOG.md +25 -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 +1 -10
  76. package/src/app/(main)/market/@detail/loading.tsx +1 -0
  77. package/src/app/(main)/market/{@detail/_layout/Desktop.tsx → _layout/Desktop/DetailSidebar.tsx} +2 -2
  78. package/src/app/(main)/market/_layout/Desktop/index.tsx +2 -1
  79. package/src/app/(main)/market/{@detail/_layout/Mobile.tsx → _layout/Mobile/DetailModal.tsx} +2 -2
  80. package/src/app/(main)/market/_layout/Mobile/index.tsx +3 -1
  81. package/src/app/(main)/settings/@category/default.tsx +16 -0
  82. package/src/app/(main)/settings/@category/features/CategoryContent.tsx +35 -0
  83. package/src/app/(main)/settings/@category/features/UpgradeAlert.tsx +38 -0
  84. package/src/app/(main)/settings/_layout/Desktop/Header.tsx +78 -23
  85. package/src/app/(main)/settings/_layout/Desktop/SideBar.tsx +39 -27
  86. package/src/app/(main)/settings/_layout/Desktop/index.tsx +41 -17
  87. package/src/app/(main)/settings/_layout/Mobile/{SubSettingHeader.tsx → Header.tsx} +3 -1
  88. package/src/app/(main)/settings/_layout/Mobile/index.tsx +7 -18
  89. package/src/app/(main)/settings/_layout/type.ts +6 -0
  90. package/src/app/(main)/settings/about/features/AboutList.tsx +122 -0
  91. package/src/app/(main)/settings/about/features/Analytics.tsx +42 -0
  92. package/src/app/(main)/settings/about/layout.tsx +26 -0
  93. package/src/app/(main)/settings/about/loading.tsx +5 -0
  94. package/src/app/(main)/settings/about/page.tsx +20 -25
  95. package/src/app/(main)/settings/agent/layout.tsx +35 -0
  96. package/src/app/(main)/settings/agent/loading.tsx +4 -2
  97. package/src/app/(main)/settings/agent/page.tsx +25 -12
  98. package/src/app/(main)/settings/common/{Common.tsx → features/Common.tsx} +7 -5
  99. package/src/app/(main)/settings/common/{Theme.tsx → features/Theme/index.tsx} +8 -6
  100. package/src/app/(main)/settings/common/page.tsx +21 -4
  101. package/src/app/(main)/settings/error.tsx +5 -0
  102. package/src/app/(main)/settings/features/Footer.tsx +2 -0
  103. package/src/app/(main)/settings/features/UpgradeAlert.tsx +21 -13
  104. package/src/app/(main)/settings/hooks/useCategory.tsx +54 -0
  105. package/src/app/(main)/settings/hooks/useSyncSettings.ts +2 -2
  106. package/src/app/(main)/settings/layout.ts +4 -1
  107. package/src/app/(main)/settings/llm/Anthropic/index.tsx +4 -10
  108. package/src/app/(main)/settings/llm/Azure/index.tsx +3 -1
  109. package/src/app/(main)/settings/llm/Bedrock/index.tsx +3 -1
  110. package/src/app/(main)/settings/llm/Google/index.tsx +4 -2
  111. package/src/app/(main)/settings/llm/Groq/index.tsx +3 -1
  112. package/src/app/(main)/settings/llm/Minimax/index.tsx +3 -9
  113. package/src/app/(main)/settings/llm/Mistral/index.tsx +3 -9
  114. package/src/app/(main)/settings/llm/Moonshot/index.tsx +3 -1
  115. package/src/app/(main)/settings/llm/Ollama/index.tsx +3 -1
  116. package/src/app/(main)/settings/llm/OpenAI/index.tsx +2 -0
  117. package/src/app/(main)/settings/llm/OpenRouter/index.tsx +3 -9
  118. package/src/app/(main)/settings/llm/Perplexity/index.tsx +3 -9
  119. package/src/app/(main)/settings/llm/TogetherAI/index.tsx +3 -9
  120. package/src/app/(main)/settings/llm/ZeroOne/index.tsx +3 -9
  121. package/src/app/(main)/settings/llm/Zhipu/index.tsx +3 -10
  122. package/src/app/(main)/settings/llm/components/Checker.tsx +2 -0
  123. package/src/app/(main)/settings/llm/components/Footer.tsx +26 -0
  124. package/src/app/(main)/settings/llm/components/ProviderConfig/index.tsx +16 -1
  125. package/src/app/(main)/settings/llm/page.tsx +57 -3
  126. package/src/app/(main)/settings/loading.tsx +9 -0
  127. package/src/app/(main)/settings/not-found.tsx +3 -0
  128. package/src/app/(main)/settings/page.tsx +2 -14
  129. package/src/app/(main)/settings/sync/{DeviceInfo → features/DeviceInfo}/Card.tsx +6 -5
  130. package/src/app/(main)/settings/sync/features/DeviceInfo/DeviceName.tsx +63 -0
  131. package/src/app/(main)/settings/sync/{components → features/DeviceInfo}/SystemIcon.tsx +6 -14
  132. package/src/app/(main)/settings/sync/{DeviceInfo → features/DeviceInfo}/index.tsx +22 -36
  133. package/src/app/(main)/settings/sync/{WebRTC → features/WebRTC}/ChannelNameInput.tsx +3 -3
  134. package/src/app/(main)/settings/sync/{WebRTC → features/WebRTC}/index.tsx +10 -9
  135. package/src/app/(main)/settings/sync/page.tsx +19 -11
  136. package/src/app/(main)/settings/tts/features/OpenAI.tsx +54 -0
  137. package/src/app/(main)/settings/tts/{TTS/index.tsx → features/STT.tsx} +11 -27
  138. package/src/app/(main)/settings/tts/page.tsx +17 -11
  139. package/src/app/@modal/(.)settings/about/layout.tsx +1 -0
  140. package/src/app/@modal/(.)settings/about/page.tsx +1 -0
  141. package/src/app/@modal/(.)settings/agent/layout.tsx +1 -0
  142. package/src/app/@modal/(.)settings/agent/page.tsx +1 -0
  143. package/src/app/@modal/(.)settings/common/page.tsx +1 -0
  144. package/src/app/@modal/(.)settings/layout.tsx +28 -0
  145. package/src/app/@modal/(.)settings/llm/page.tsx +1 -0
  146. package/src/app/@modal/(.)settings/loading.tsx +5 -0
  147. package/src/app/@modal/(.)settings/sync/page.tsx +1 -0
  148. package/src/app/@modal/(.)settings/tts/page.tsx +1 -0
  149. package/src/app/@modal/_layout/SettingModalLayout.tsx +59 -0
  150. package/src/app/@modal/chat/(.)settings/features/CategoryContent.tsx +36 -0
  151. package/src/app/@modal/chat/(.)settings/features/useCategory.tsx +62 -0
  152. package/src/app/@modal/chat/(.)settings/layout.tsx +55 -0
  153. package/src/app/@modal/chat/(.)settings/loading.tsx +5 -0
  154. package/src/app/@modal/chat/(.)settings/page.tsx +40 -0
  155. package/src/app/@modal/default.tsx +1 -0
  156. package/src/app/@modal/layout.tsx +30 -0
  157. package/src/app/@modal/loading.tsx +5 -0
  158. package/src/app/layout.tsx +11 -3
  159. package/src/components/BrandWatermark/index.tsx +39 -0
  160. package/src/components/Cell/Divider.tsx +19 -0
  161. package/src/components/Cell/index.tsx +38 -0
  162. package/src/components/Menu/index.tsx +97 -0
  163. package/src/components/SkeletonLoading/index.tsx +21 -0
  164. package/src/const/url.ts +1 -0
  165. package/src/features/AgentSetting/AgentChat/index.tsx +135 -0
  166. package/src/features/AgentSetting/AgentMeta/index.tsx +4 -3
  167. package/src/features/AgentSetting/AgentModal/index.tsx +95 -0
  168. package/src/features/AgentSetting/AgentPlugin/index.tsx +65 -66
  169. package/src/features/AgentSetting/AgentPrompt/index.tsx +101 -47
  170. package/src/features/AgentSetting/AgentTTS/index.tsx +4 -0
  171. package/src/features/AgentSetting/StoreUpdater.tsx +2 -0
  172. package/src/features/AgentSetting/index.tsx +6 -6
  173. package/src/features/AgentSetting/store/index.ts +2 -0
  174. package/src/features/AvatarWithUpload/index.tsx +2 -0
  175. package/src/hooks/useQuery.ts +7 -0
  176. package/src/hooks/useQueryRoute.ts +16 -0
  177. package/src/locales/default/common.ts +14 -0
  178. package/src/locales/default/setting.ts +3 -0
  179. package/src/server/redirectHard.ts +9 -0
  180. package/src/store/global/initialState.ts +1 -0
  181. package/src/app/(main)/@nav/_layout/Desktop/Avatar.tsx +0 -11
  182. package/src/app/(main)/chat/settings/(desktop)/index.tsx +0 -23
  183. package/src/app/(main)/chat/settings/(mobile)/index.tsx +0 -16
  184. package/src/app/(main)/settings/(desktop)/index.tsx +0 -23
  185. package/src/app/(main)/settings/(mobile)/features/AvatarBanner.tsx +0 -68
  186. package/src/app/(main)/settings/(mobile)/features/ExtraList.tsx +0 -65
  187. package/src/app/(main)/settings/(mobile)/index.tsx +0 -53
  188. package/src/app/(main)/settings/about/AboutList.tsx +0 -53
  189. package/src/app/(main)/settings/about/Analytics.tsx +0 -40
  190. package/src/app/(main)/settings/about/style.ts +0 -22
  191. package/src/app/(main)/settings/agent/Agent.tsx +0 -29
  192. package/src/app/(main)/settings/common/index.tsx +0 -24
  193. package/src/app/(main)/settings/common/loading.tsx +0 -3
  194. package/src/app/(main)/settings/features/SettingList/index.tsx +0 -47
  195. package/src/app/(main)/settings/llm/index.tsx +0 -59
  196. package/src/app/(main)/settings/llm/layout.tsx +0 -11
  197. package/src/app/(main)/settings/llm/loading.tsx +0 -3
  198. package/src/app/(main)/settings/sync/DeviceInfo/DeviceName.tsx +0 -66
  199. package/src/app/(main)/settings/sync/PageTitle.tsx +0 -11
  200. package/src/app/(main)/settings/sync/layout.tsx +0 -12
  201. package/src/app/(main)/settings/sync/loading.tsx +0 -3
  202. package/src/app/(main)/settings/tts/loading.tsx +0 -3
  203. package/src/features/AgentSetting/AgentConfig/index.tsx +0 -202
  204. package/src/features/AgentSetting/AgentConfig/useSyncConfig.ts +0 -23
  205. /package/src/app/(main)/settings/{features/SettingList → about/features}/Item.tsx +0 -0
  206. /package/src/app/(main)/settings/{features → common/features/Theme}/ThemeSwatches/ThemeSwatchesNeutral.tsx +0 -0
  207. /package/src/app/(main)/settings/{features → common/features/Theme}/ThemeSwatches/ThemeSwatchesPrimary.tsx +0 -0
  208. /package/src/app/(main)/settings/{features → common/features/Theme}/ThemeSwatches/index.ts +0 -0
  209. /package/src/app/(main)/settings/sync/{Alert.tsx → features/Alert.tsx} +0 -0
  210. /package/src/app/(main)/settings/sync/{components → features/WebRTC}/SyncSwitch/index.css +0 -0
  211. /package/src/app/(main)/settings/sync/{components → features/WebRTC}/SyncSwitch/index.tsx +0 -0
  212. /package/src/app/(main)/settings/sync/{util.ts → features/WebRTC/generateRandomRoomName.ts} +0 -0
  213. /package/src/app/(main)/settings/tts/{TTS/options.ts → features/const.ts} +0 -0
  214. /package/src/features/AgentSetting/{AgentConfig → AgentModal}/ModelSelect.tsx +0 -0
@@ -1,7 +1,9 @@
1
- import { Avatar, Form, Icon, Tooltip } from '@lobehub/ui';
1
+ 'use client';
2
+
3
+ import { Avatar, Form, Icon, ItemGroup, Tooltip } from '@lobehub/ui';
2
4
  import { Button, Empty, Space, Switch, Tag, Typography } from 'antd';
3
5
  import isEqual from 'fast-deep-equal';
4
- import { LucideToyBrick, LucideTrash2, Store } from 'lucide-react';
6
+ import { LucideTrash2, Store } from 'lucide-react';
5
7
  import { memo, useState } from 'react';
6
8
  import { Trans, useTranslation } from 'react-i18next';
7
9
  import { Center, Flexbox } from 'react-layout-kit';
@@ -90,73 +92,70 @@ const AgentPlugin = memo(() => {
90
92
  const hasDeprecated = deprecatedList.length > 0;
91
93
 
92
94
  const loadingSkeleton = LoadingList();
95
+
96
+ const extra = (
97
+ <Space.Compact style={{ width: 'auto' }}>
98
+ <AddPluginButton />
99
+ {hasDeprecated ? (
100
+ <Tooltip title={t('plugin.clearDeprecated')}>
101
+ <Button
102
+ icon={<Icon icon={LucideTrash2} />}
103
+ onClick={(e) => {
104
+ e.stopPropagation();
105
+ for (const i of deprecatedList) {
106
+ toggleAgentPlugin(i.tag as string);
107
+ }
108
+ }}
109
+ size={'small'}
110
+ />
111
+ </Tooltip>
112
+ ) : null}
113
+ <Tooltip title={t('plugin.store')}>
114
+ <Button
115
+ icon={<Icon icon={Store} />}
116
+ onClick={(e) => {
117
+ e.stopPropagation();
118
+ setShowStore(true);
119
+ }}
120
+ size={'small'}
121
+ />
122
+ </Tooltip>
123
+ </Space.Compact>
124
+ );
125
+
126
+ const empty = (
127
+ <Center padding={40}>
128
+ <Empty
129
+ description={
130
+ <Trans i18nKey={'plugin.empty'} ns={'setting'}>
131
+ 暂无安装插件,
132
+ <Typography.Link
133
+ href={'/'}
134
+ onClick={(e) => {
135
+ e.preventDefault();
136
+ setShowStore(true);
137
+ }}
138
+ >
139
+ 前往插件市场
140
+ </Typography.Link>
141
+ 安装
142
+ </Trans>
143
+ }
144
+ image={Empty.PRESENTED_IMAGE_SIMPLE}
145
+ />
146
+ </Center>
147
+ );
148
+
149
+ const plugin: ItemGroup = {
150
+ children: isLoading ? loadingSkeleton : isEmpty ? empty : [...deprecatedList, ...list],
151
+ extra,
152
+ title: t('settingPlugin.title'),
153
+ };
154
+
93
155
  return (
94
156
  <>
95
157
  <PluginStore open={showStore} setOpen={setShowStore} />
96
- <Form
97
- items={[
98
- {
99
- children: isLoading ? (
100
- loadingSkeleton
101
- ) : isEmpty ? (
102
- <Center padding={40}>
103
- <Empty
104
- description={
105
- <Trans i18nKey={'plugin.empty'} ns={'setting'}>
106
- 暂无安装插件,
107
- <Typography.Link
108
- href={'/'}
109
- onClick={(e) => {
110
- e.preventDefault();
111
- setShowStore(true);
112
- }}
113
- >
114
- 前往插件市场
115
- </Typography.Link>
116
- 安装
117
- </Trans>
118
- }
119
- image={Empty.PRESENTED_IMAGE_SIMPLE}
120
- />
121
- </Center>
122
- ) : (
123
- [...deprecatedList, ...list]
124
- ),
125
- extra: (
126
- <Space.Compact style={{ width: 'auto' }}>
127
- <AddPluginButton />
128
- {hasDeprecated ? (
129
- <Tooltip title={t('plugin.clearDeprecated')}>
130
- <Button
131
- icon={<Icon icon={LucideTrash2} />}
132
- onClick={(e) => {
133
- e.stopPropagation();
134
- for (const i of deprecatedList) {
135
- toggleAgentPlugin(i.tag as string);
136
- }
137
- }}
138
- size={'small'}
139
- />
140
- </Tooltip>
141
- ) : null}
142
- <Tooltip title={t('plugin.store')}>
143
- <Button
144
- icon={<Icon icon={Store} />}
145
- onClick={(e) => {
146
- e.stopPropagation();
147
- setShowStore(true);
148
- }}
149
- size={'small'}
150
- />
151
- </Tooltip>
152
- </Space.Compact>
153
- ),
154
- icon: LucideToyBrick,
155
- title: t('settingPlugin.title'),
156
- },
157
- ]}
158
- {...FORM_STYLE}
159
- />
158
+ <Form items={[plugin]} itemsType={'group'} variant={'pure'} {...FORM_STYLE} />
160
159
  </>
161
160
  );
162
161
  });
@@ -1,7 +1,8 @@
1
- import { EditableMessage, FormGroup } from '@lobehub/ui';
1
+ 'use client';
2
+
3
+ import { EditableMessage, Form } from '@lobehub/ui';
2
4
  import { Button } from 'antd';
3
5
  import { createStyles } from 'antd-style';
4
- import { Bot } from 'lucide-react';
5
6
  import { memo, useState } from 'react';
6
7
  import { useTranslation } from 'react-i18next';
7
8
  import { Flexbox } from 'react-layout-kit';
@@ -9,65 +10,118 @@ import { Flexbox } from 'react-layout-kit';
9
10
  import { FORM_STYLE } from '@/const/layoutTokens';
10
11
 
11
12
  import { useStore } from '../store';
12
- import TokenTag from './TokenTag';
13
13
 
14
- export const useStyles = createStyles(({ css, token }) => ({
14
+ export const useStyles = createStyles(({ css, token, responsive }) => ({
15
+ container: css`
16
+ position: relative;
17
+ width: 100%;
18
+ background: ${token.colorFillSecondary};
19
+ border-radius: ${token.borderRadiusLG}px;
20
+ `,
21
+ content: css`
22
+ z-index: 2;
23
+ padding: 8px;
24
+ background: ${token.colorBgContainer};
25
+ border-radius: ${token.borderRadiusLG - 1}px;
26
+ `,
15
27
  markdown: css`
16
28
  border: unset;
17
29
  `,
18
- textarea: css`
19
- background: ${token.colorFillTertiary};
30
+ wrapper: css`
31
+ width: 100%;
32
+ ${responsive.mobile} {
33
+ padding-block: 8px;
34
+ padding-inline: 4px;
35
+ }
20
36
  `,
21
37
  }));
22
38
 
23
- const AgentPrompt = memo(() => {
39
+ const AgentPrompt = memo<{ modal?: boolean }>(({ modal }) => {
24
40
  const { t } = useTranslation('setting');
25
41
  const { styles } = useStyles();
26
42
  const [editing, setEditing] = useState(false);
27
43
  const [systemRole, updateConfig] = useStore((s) => [s.config.systemRole, s.setAgentConfig]);
28
44
 
29
- return (
30
- <FormGroup
31
- extra={<TokenTag />}
32
- icon={Bot}
33
- style={FORM_STYLE.style}
34
- title={t('settingAgent.prompt.title')}
45
+ const content = (
46
+ <EditableMessage
47
+ classNames={{
48
+ markdown: styles.markdown,
49
+ }}
50
+ editButtonSize={'small'}
51
+ editing={editing}
52
+ height={'auto'}
53
+ inputType={'pure'}
54
+ onChange={(e) => {
55
+ updateConfig({ systemRole: e });
56
+ }}
57
+ onEditingChange={setEditing}
58
+ placeholder={t('settingAgent.prompt.placeholder')}
59
+ showEditWhenEmpty
60
+ text={{
61
+ cancel: t('cancel', { ns: 'common' }),
62
+ confirm: t('ok', { ns: 'common' }),
63
+ }}
64
+ value={systemRole}
65
+ />
66
+ );
67
+
68
+ const editButton = !editing && !!systemRole && (
69
+ <Button
70
+ onClick={(e) => {
71
+ e.stopPropagation();
72
+ setEditing(true);
73
+ }}
74
+ size={'small'}
75
+ type={'primary'}
35
76
  >
36
- <Flexbox gap={16} paddingBlock={16}>
37
- <EditableMessage
38
- classNames={styles}
39
- editButtonSize={'small'}
40
- editing={editing}
41
- height={'auto'}
42
- inputType={'ghost'}
43
- onChange={(e) => {
44
- updateConfig({ systemRole: e });
45
- }}
46
- onEditingChange={setEditing}
47
- placeholder={t('settingAgent.prompt.placeholder')}
48
- showEditWhenEmpty
49
- text={{
50
- cancel: t('cancel', { ns: 'common' }),
51
- confirm: t('ok', { ns: 'common' }),
52
- }}
53
- value={systemRole}
54
- />
55
- {!editing && !!systemRole && (
56
- <Flexbox direction={'horizontal-reverse'}>
57
- <Button
58
- onClick={(e) => {
59
- e.stopPropagation();
60
- setEditing(true);
61
- }}
62
- size={'small'}
63
- type={'primary'}
64
- >
65
- {t('edit', { ns: 'common' })}
66
- </Button>
67
- </Flexbox>
68
- )}
77
+ {t('edit', { ns: 'common' })}
78
+ </Button>
79
+ );
80
+
81
+ if (modal)
82
+ return (
83
+ <Form
84
+ items={[
85
+ {
86
+ children: (
87
+ <>
88
+ <div style={{ height: 24 }} />
89
+ {content}
90
+ </>
91
+ ),
92
+ extra: editButton,
93
+ title: t('settingAgent.prompt.title'),
94
+ },
95
+ ]}
96
+ itemsType={'group'}
97
+ variant={'pure'}
98
+ {...FORM_STYLE}
99
+ />
100
+ );
101
+
102
+ return (
103
+ <div className={styles.wrapper}>
104
+ <Flexbox className={styles.container} padding={4}>
105
+ <Flexbox horizontal justify={'space-between'} paddingBlock={8} paddingInline={12}>
106
+ <h1 style={{ fontSize: 18, fontWeight: 'bold', marginBottom: 4 }}>
107
+ {t('settingAgent.prompt.title')}
108
+ </h1>
109
+ {editButton}
110
+ </Flexbox>
111
+ <Flexbox
112
+ align={'center'}
113
+ className={styles.content}
114
+ flex={1}
115
+ gap={16}
116
+ horizontal
117
+ justify={'space-between'}
118
+ padding={12}
119
+ wrap={'wrap'}
120
+ >
121
+ {content}
122
+ </Flexbox>
69
123
  </Flexbox>
70
- </FormGroup>
124
+ </div>
71
125
  );
72
126
  });
73
127
 
@@ -1,3 +1,5 @@
1
+ 'use client';
2
+
1
3
  import { VoiceList } from '@lobehub/tts';
2
4
  import { Form, ItemGroup } from '@lobehub/ui';
3
5
  import { Form as AFrom, Select, Switch } from 'antd';
@@ -107,7 +109,9 @@ const AgentTTS = memo(() => {
107
109
  },
108
110
  }}
109
111
  items={[tts]}
112
+ itemsType={'group'}
110
113
  onValuesChange={debounce(updateConfig, 100)}
114
+ variant={'pure'}
111
115
  {...FORM_STYLE}
112
116
  />
113
117
  );
@@ -1,3 +1,5 @@
1
+ 'use client';
2
+
1
3
  import { memo } from 'react';
2
4
  import { createStoreUpdater } from 'zustand-utils';
3
5
 
@@ -1,7 +1,6 @@
1
- import { memo } from 'react';
2
-
3
- import AgentConfig from './AgentConfig';
1
+ import AgentChat from './AgentChat';
4
2
  import AgentMeta from './AgentMeta';
3
+ import AgentModal from './AgentModal';
5
4
  import AgentPlugin from './AgentPlugin';
6
5
  import AgentPrompt from './AgentPrompt';
7
6
  import AgentTTS from './AgentTTS';
@@ -10,17 +9,18 @@ import { Provider, createStore } from './store';
10
9
 
11
10
  type AgentSettingsProps = StoreUpdaterProps;
12
11
 
13
- const AgentSettings = memo<AgentSettingsProps>((props) => {
12
+ const AgentSettings = (props: AgentSettingsProps) => {
14
13
  return (
15
14
  <Provider createStore={createStore}>
16
15
  <StoreUpdater {...props} />
17
16
  <AgentPrompt />
18
17
  <AgentMeta />
19
- <AgentConfig />
18
+ <AgentChat />
19
+ <AgentModal />
20
20
  <AgentTTS />
21
21
  <AgentPlugin />
22
22
  </Provider>
23
23
  );
24
- });
24
+ };
25
25
 
26
26
  export default AgentSettings;
@@ -1,3 +1,5 @@
1
+ 'use client';
2
+
1
3
  import { createContext } from 'zustand-utils';
2
4
  import { subscribeWithSelector } from 'zustand/middleware';
3
5
  import { shallow } from 'zustand/shallow';
@@ -1,3 +1,5 @@
1
+ 'use client';
2
+
1
3
  import { Upload } from 'antd';
2
4
  import { createStyles } from 'antd-style';
3
5
  import NextImage from 'next/image';
@@ -0,0 +1,7 @@
1
+ import { useSearchParams } from 'next/navigation';
2
+ import qs from 'query-string';
3
+
4
+ export const useQuery = () => {
5
+ const rawQuery = useSearchParams();
6
+ return qs.parse(rawQuery.toString());
7
+ };
@@ -0,0 +1,16 @@
1
+ import { useRouter } from 'next/navigation';
2
+ import qs, { type ParsedQuery } from 'query-string';
3
+
4
+ import { useQuery } from '@/hooks/useQuery';
5
+
6
+ export const useQueryRoute = () => {
7
+ const router = useRouter();
8
+ const parseQuery = useQuery();
9
+
10
+ return {
11
+ push: (url: string, query?: ParsedQuery) =>
12
+ router.push(qs.stringifyUrl({ query: { ...parseQuery, ...query }, url })),
13
+ replace: (url: string, query?: ParsedQuery) =>
14
+ router.replace(qs.stringifyUrl({ query: { ...parseQuery, ...query }, url })),
15
+ };
16
+ };
@@ -133,6 +133,7 @@ export default {
133
133
  tab: {
134
134
  chat: '会话',
135
135
  market: '发现',
136
+ me: '我',
136
137
  setting: '设置',
137
138
  },
138
139
  telemetry: {
@@ -151,4 +152,17 @@ export default {
151
152
  hasNew: '有可用更新',
152
153
  newVersion: '有新版本可用:{{version}}',
153
154
  },
155
+ userPanel: {
156
+ billing: '账单管理',
157
+ discord: '社区支持',
158
+ docs: '使用文档',
159
+ email: '邮件支持',
160
+ feedback: '反馈与建议',
161
+ help: '帮助中心',
162
+ plans: '订阅方案',
163
+ profile: '账户管理',
164
+ setting: '应用设置',
165
+ usages: '用量统计',
166
+ warn: '此入口即将下线,后续请从左上角头像唤起本菜单',
167
+ },
154
168
  };
@@ -27,9 +27,12 @@ export default {
27
27
  },
28
28
  },
29
29
  header: {
30
+ desc: '偏好与模型设置。',
30
31
  global: '全局设置',
31
32
  session: '会话设置',
33
+ sessionDesc: '角色设定与会话偏好。',
32
34
  sessionWithName: '会话设置 · {{name}}',
35
+ title: '设置',
33
36
  },
34
37
  llm: {
35
38
  checker: {
@@ -0,0 +1,9 @@
1
+ 'use server';
2
+
3
+ import { redirect } from 'next/navigation';
4
+
5
+ // 当不想被路由拦截时请使用此方法绕过
6
+
7
+ export default async function redirectHard(uri: string) {
8
+ redirect(uri);
9
+ }
@@ -6,6 +6,7 @@ import { AsyncLocalStorage } from '@/utils/localStorage';
6
6
  export enum SidebarTabKey {
7
7
  Chat = 'chat',
8
8
  Market = 'market',
9
+ Me = 'me',
9
10
  Setting = 'settings',
10
11
  }
11
12
 
@@ -1,11 +0,0 @@
1
- import { memo } from 'react';
2
-
3
- import AvatarWithUpload from '@/features/AvatarWithUpload';
4
-
5
- const Avatar = memo(() => {
6
- return <AvatarWithUpload id={'avatar'} />;
7
- });
8
-
9
- Avatar.displayName = 'Avatar';
10
-
11
- export default Avatar;
@@ -1,23 +0,0 @@
1
- 'use client';
2
-
3
- import { memo } from 'react';
4
- import { Flexbox } from 'react-layout-kit';
5
-
6
- import SafeSpacing from '@/components/SafeSpacing';
7
- import ClientResponsiveContent from '@/components/client/ClientResponsiveContent';
8
- import { HEADER_HEIGHT } from '@/const/layoutTokens';
9
-
10
- import EditPage from '../features/EditPage';
11
- import Header from './Header';
12
-
13
- const Desktop = memo(() => (
14
- <>
15
- <Header />
16
- <Flexbox align={'center'} flex={1} gap={16} padding={24} style={{ overflow: 'scroll' }}>
17
- <SafeSpacing height={HEADER_HEIGHT - 16} />
18
- <EditPage />
19
- </Flexbox>
20
- </>
21
- ));
22
-
23
- export default ClientResponsiveContent({ Desktop, Mobile: () => import('../(mobile)') });
@@ -1,16 +0,0 @@
1
- 'use client';
2
-
3
- import { memo } from 'react';
4
-
5
- import MobileContentLayout from '@/components/server/MobileNavLayout';
6
-
7
- import EditPage from '../features/EditPage';
8
- import Header from './Header';
9
-
10
- const ChatSettings = memo(() => (
11
- <MobileContentLayout header={<Header />} withNav={false}>
12
- <EditPage />
13
- </MobileContentLayout>
14
- ));
15
-
16
- export default ChatSettings;
@@ -1,23 +0,0 @@
1
- 'use client';
2
-
3
- import dynamic from 'next/dynamic';
4
- import { FC, memo } from 'react';
5
-
6
- import MobileSwitchLoading from '@/features/MobileSwitchLoading';
7
- import { useIsMobile } from '@/hooks/useIsMobile';
8
-
9
- import Common from '../common';
10
- import { SettingsCommonProps } from '../common/Common';
11
-
12
- const Mobile: FC = dynamic(() => import('../(mobile)'), {
13
- loading: MobileSwitchLoading,
14
- ssr: false,
15
- }) as FC;
16
-
17
- const Desktop = memo<SettingsCommonProps>((props) => {
18
- const mobile = useIsMobile();
19
-
20
- return mobile ? <Mobile /> : <Common {...props} />;
21
- });
22
-
23
- export default Desktop;
@@ -1,68 +0,0 @@
1
- import { DivProps } from '@lobehub/ui';
2
- import { createStyles } from 'antd-style';
3
- import Image from 'next/image';
4
- import { memo } from 'react';
5
- import { Flexbox } from 'react-layout-kit';
6
-
7
- import { DEFAULT_USER_AVATAR_URL } from '@/const/meta';
8
-
9
- export const useStyles = createStyles(({ css, token }) => ({
10
- banner: css`
11
- position: relative;
12
-
13
- overflow: hidden;
14
-
15
- height: 172px;
16
- min-height: 172px;
17
- max-height: 172px;
18
- `,
19
- bannerBox: css`
20
- position: relative;
21
-
22
- width: 100%;
23
- height: 100%;
24
-
25
- background: ${token.colorBgLayout};
26
-
27
- mask-image: linear-gradient(to bottom, #fff, transparent);
28
- `,
29
- bannerImg: css`
30
- position: absolute;
31
- top: -50%;
32
- filter: blur(100px) saturate(2);
33
- `,
34
- }));
35
-
36
- interface AgentCardBannerProps extends DivProps {
37
- avatar: string;
38
- size?: number;
39
- }
40
-
41
- const AvatarBanner = memo<AgentCardBannerProps>(
42
- ({ avatar, className, size = 200, children, ...props }) => {
43
- const { styles, cx } = useStyles();
44
-
45
- return (
46
- <Flexbox
47
- align={'center'}
48
- className={cx(styles.banner, className)}
49
- justify={'center'}
50
- {...props}
51
- >
52
- <Flexbox align={'center'} className={styles.bannerBox} justify={'center'}>
53
- <Image
54
- alt={'banner'}
55
- className={styles.bannerImg}
56
- height={size}
57
- src={avatar || DEFAULT_USER_AVATAR_URL}
58
- unoptimized
59
- width={size}
60
- />
61
- </Flexbox>
62
- {children}
63
- </Flexbox>
64
- );
65
- },
66
- );
67
-
68
- export default AvatarBanner;