@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
@@ -3,8 +3,6 @@ import { createStyles } from 'antd-style';
3
3
  import { memo } from 'react';
4
4
  import { Flexbox } from 'react-layout-kit';
5
5
 
6
- import { MetaData } from '@/types/meta';
7
-
8
6
  export const useStyles = createStyles(({ css, token }) => ({
9
7
  banner: css`
10
8
  position: relative;
@@ -15,25 +13,22 @@ export const useStyles = createStyles(({ css, token }) => ({
15
13
  margin-bottom: -56px;
16
14
 
17
15
  background: ${token.colorFillSecondary};
18
-
19
- mask-image: linear-gradient(to bottom, #fff, transparent);
20
16
  `,
21
17
  bannerImg: css`
22
18
  position: absolute;
23
- top: -50%;
24
- filter: blur(50px) saturate(2);
19
+ filter: blur(40px) saturate(1.5);
25
20
  `,
26
21
  }));
27
22
 
28
23
  interface AgentCardBannerProps extends DivProps {
24
+ avatar?: string;
29
25
  mask?: boolean;
30
26
  maskColor?: string;
31
- meta: MetaData;
32
27
  size?: number;
33
28
  }
34
29
 
35
30
  const AgentCardBanner = memo<AgentCardBannerProps>(
36
- ({ meta, className, size = 200, children, ...props }) => {
31
+ ({ avatar, className, size = 600, children, ...props }) => {
37
32
  const { styles, cx } = useStyles();
38
33
 
39
34
  return (
@@ -43,7 +38,13 @@ const AgentCardBanner = memo<AgentCardBannerProps>(
43
38
  justify={'center'}
44
39
  {...props}
45
40
  >
46
- <Avatar alt={'banner'} avatar={meta.avatar} className={styles.bannerImg} size={size} />
41
+ <Avatar
42
+ alt={'banner'}
43
+ avatar={avatar}
44
+ className={styles.bannerImg}
45
+ shape={'square'}
46
+ size={size}
47
+ />
47
48
  {children}
48
49
  </Flexbox>
49
50
  );
@@ -1,62 +1,137 @@
1
- import { SpotlightCardProps } from '@lobehub/ui';
2
- import isEqual from 'fast-deep-equal';
3
- import { FC, memo, useCallback } from 'react';
4
- import { useTranslation } from 'react-i18next';
5
- import { Flexbox } from 'react-layout-kit';
6
- import LazyLoad from 'react-lazy-load';
7
-
8
- import { agentMarketSelectors, useMarketStore } from '@/store/market';
9
-
10
- import Loading from '../../components/Loading';
11
- import TagList from '../TagList';
12
- import AgentCardItem from './AgentCardItem';
13
- import { useStyles } from './style';
14
-
15
- export interface AgentCardProps {
16
- CardRender: FC<SpotlightCardProps>;
17
- mobile?: boolean;
1
+ import { Avatar, Tag } from '@lobehub/ui';
2
+ import { Typography } from 'antd';
3
+ import { createStyles } from 'antd-style';
4
+ import { startCase } from 'lodash-es';
5
+ import Link from 'next/link';
6
+ import { memo } from 'react';
7
+ import { Center, Flexbox } from 'react-layout-kit';
8
+
9
+ import { useMarketStore } from '@/store/market';
10
+ import { AgentsMarketIndexItem } from '@/types/market';
11
+
12
+ import AgentCardBanner from './AgentCardBanner';
13
+
14
+ const { Paragraph, Title } = Typography;
15
+
16
+ const useStyles = createStyles(({ css, token, isDarkMode }) => ({
17
+ banner: css`
18
+ opacity: ${isDarkMode ? 0.9 : 0.4};
19
+ `,
20
+ container: css`
21
+ cursor: pointer;
22
+
23
+ position: relative;
24
+
25
+ overflow: hidden;
26
+
27
+ height: 100%;
28
+
29
+ background: ${token.colorBgContainer};
30
+ border-radius: ${token.borderRadiusLG}px;
31
+ box-shadow: 0 0 1px 1px ${token.colorFillQuaternary} inset;
32
+
33
+ transition: box-shadow 0.2s ${token.motionEaseInOut};
34
+
35
+ &:hover {
36
+ box-shadow: 0 0 1px 1px ${token.colorFillSecondary} inset;
37
+ }
38
+ `,
39
+ desc: css`
40
+ min-height: 44px;
41
+ margin-bottom: 0 !important;
42
+ color: ${token.colorTextDescription};
43
+ `,
44
+ inner: css`
45
+ padding: 16px;
46
+ `,
47
+ time: css`
48
+ color: ${token.colorTextDescription};
49
+ `,
50
+ title: css`
51
+ margin-bottom: 0 !important;
52
+ font-size: 18px !important;
53
+ `,
54
+ }));
55
+
56
+ interface AgentCardProps extends AgentsMarketIndexItem {
57
+ variant?: 'default' | 'compact';
18
58
  }
19
59
 
20
- const AgentCard = memo<AgentCardProps>(({ CardRender, mobile }) => {
21
- const { t } = useTranslation('market');
22
- const [useFetchAgentList, keywords] = useMarketStore((s) => [
23
- s.useFetchAgentList,
24
- s.searchKeywords,
25
- ]);
26
- const { isLoading } = useFetchAgentList();
27
- const agentList = useMarketStore(agentMarketSelectors.getAgentList, isEqual);
28
- const { styles } = useStyles();
29
-
30
- const GridRender: SpotlightCardProps['renderItem'] = useCallback(
31
- (props: any) => (
32
- <LazyLoad className={styles.lazy}>
33
- <AgentCardItem {...props} />
34
- </LazyLoad>
35
- ),
36
- [styles.lazy],
37
- );
38
-
39
- if (isLoading) return <Loading />;
40
-
41
- return (
42
- <Flexbox gap={mobile ? 16 : 24}>
43
- <TagList />
44
- {keywords ? (
45
- <CardRender
46
- items={agentList}
47
- renderItem={GridRender}
48
- spotlight={mobile ? undefined : false}
49
- />
50
- ) : (
51
- <>
52
- <div className={styles.subTitle}>{t('title.recentSubmits')}</div>
53
- <CardRender items={agentList.slice(0, 3)} renderItem={GridRender} />
54
- <div className={styles.subTitle}>{t('title.allAgents')}</div>
55
- <CardRender items={agentList.slice(3)} renderItem={GridRender} />
56
- </>
57
- )}
58
- </Flexbox>
59
- );
60
- });
60
+ const AgentCard = memo<AgentCardProps>(
61
+ ({ meta, createAt, author, homepage, identifier, variant }) => {
62
+ const { avatar, title, description, tags } = meta;
63
+
64
+ const onAgentCardClick = useMarketStore((s) => s.activateAgent);
65
+ const { styles, theme } = useStyles();
66
+ const isCompact = variant === 'compact';
67
+
68
+ return (
69
+ <Flexbox
70
+ className={styles.container}
71
+ gap={24}
72
+ key={identifier}
73
+ onClick={() => onAgentCardClick(identifier)}
74
+ >
75
+ {!isCompact && <AgentCardBanner avatar={avatar} />}
76
+ <Flexbox className={styles.inner} gap={12}>
77
+ <Flexbox align={'flex-end'} gap={16} horizontal justify={'space-between'} width={'100%'}>
78
+ <Title className={styles.title} ellipsis={{ rows: 1, tooltip: title }} level={3}>
79
+ {title}
80
+ </Title>
81
+ {isCompact ? (
82
+ <Avatar
83
+ alt={title}
84
+ avatar={avatar}
85
+ size={40}
86
+ style={{ alignSelf: 'flex-end' }}
87
+ title={title}
88
+ />
89
+ ) : (
90
+ <Center
91
+ flex={'none'}
92
+ height={64}
93
+ style={{
94
+ background: theme.colorBgContainer,
95
+ borderRadius: '50%',
96
+ marginTop: -6,
97
+ overflow: 'hidden',
98
+ zIndex: 2,
99
+ }}
100
+ width={64}
101
+ >
102
+ <Avatar alt={title} avatar={avatar} size={56} title={title} />
103
+ </Center>
104
+ )}
105
+ </Flexbox>
106
+ {!isCompact && (
107
+ <Flexbox gap={12} horizontal style={{ fontSize: 12 }}>
108
+ <Link aria-label={author} href={homepage} target={'_blank'}>
109
+ @{author}
110
+ </Link>
111
+ <time className={styles.time} dateTime={new Date(createAt).toISOString()}>
112
+ {createAt}
113
+ </time>
114
+ </Flexbox>
115
+ )}
116
+ <Paragraph className={styles.desc} ellipsis={{ rows: 2 }}>
117
+ {description}
118
+ </Paragraph>
119
+ <Flexbox gap={6} horizontal style={{ flexWrap: 'wrap' }}>
120
+ {(tags as string[])
121
+ .slice(0, 4)
122
+ .filter(Boolean)
123
+ .map((tag: string, index) => (
124
+ <Tag key={index} style={{ margin: 0 }}>
125
+ {startCase(tag).trim()}
126
+ </Tag>
127
+ ))}
128
+ </Flexbox>
129
+ </Flexbox>
130
+ </Flexbox>
131
+ );
132
+ },
133
+ );
134
+
135
+ AgentCard.displayName = 'AgentCard';
61
136
 
62
137
  export default AgentCard;
@@ -0,0 +1,94 @@
1
+ 'use client';
2
+
3
+ import { Grid, SpotlightCardProps } from '@lobehub/ui';
4
+ import { Empty, Skeleton } from 'antd';
5
+ import { createStyles } from 'antd-style';
6
+ import isEqual from 'fast-deep-equal';
7
+ import { memo, useCallback, useLayoutEffect } from 'react';
8
+ import { useTranslation } from 'react-i18next';
9
+ import LazyLoad from 'react-lazy-load';
10
+
11
+ import { agentMarketSelectors, useMarketStore } from '@/store/market';
12
+
13
+ import AgentCard from './AgentCard';
14
+
15
+ const useStyles = createStyles(({ css, responsive }) => ({
16
+ compactLazy: css`
17
+ min-height: 120px;
18
+ `,
19
+ lazy: css`
20
+ min-height: 332px;
21
+ `,
22
+ title: css`
23
+ margin-top: 0.5em;
24
+ font-size: 24px;
25
+ font-weight: 600;
26
+ ${responsive.mobile} {
27
+ font-size: 20px;
28
+ }
29
+ `,
30
+ }));
31
+
32
+ export interface AgentListProps {
33
+ mobile?: boolean;
34
+ }
35
+
36
+ const AgentList = memo<AgentListProps>(({ mobile }) => {
37
+ const { t } = useTranslation('market');
38
+ const [searchKeywords, useFetchAgentList] = useMarketStore((s) => [
39
+ s.searchKeywords,
40
+ s.useFetchAgentList,
41
+ ]);
42
+ const { isLoading } = useFetchAgentList();
43
+ const agentList = useMarketStore(agentMarketSelectors.getAgentList, isEqual);
44
+ const { styles } = useStyles();
45
+ const recentLength = mobile ? 3 : 6;
46
+
47
+ useLayoutEffect(() => {
48
+ // refs: https://github.com/pmndrs/zustand/blob/main/docs/integrations/persisting-store-data.md#hashydrated
49
+ useMarketStore.persist.rehydrate();
50
+ }, []);
51
+
52
+ const GridCompactRender: SpotlightCardProps['renderItem'] = useCallback(
53
+ (props: any) => (
54
+ <LazyLoad className={styles.compactLazy} offset={332}>
55
+ <AgentCard variant={'compact'} {...props} />
56
+ </LazyLoad>
57
+ ),
58
+ [],
59
+ );
60
+
61
+ if (isLoading) return <Skeleton paragraph={{ rows: 8 }} title={false} />;
62
+
63
+ if (searchKeywords) {
64
+ if (agentList.length === 0) return <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />;
65
+ return (
66
+ <Grid rows={3}>
67
+ {agentList.map((item) => (
68
+ <GridCompactRender key={item.identifier} {...item} />
69
+ ))}
70
+ </Grid>
71
+ );
72
+ }
73
+
74
+ return (
75
+ <>
76
+ <h2 className={styles.title}>{t('title.recentSubmits')}</h2>
77
+ <Grid rows={3}>
78
+ {agentList.slice(0, recentLength).map((item) => (
79
+ <AgentCard key={item.identifier} {...item} />
80
+ ))}
81
+ </Grid>
82
+ <h2 className={styles.title}>{t('title.allAgents')}</h2>
83
+ <Grid rows={3}>
84
+ {agentList.slice(recentLength).map((item) => (
85
+ <GridCompactRender key={item.identifier} {...item} />
86
+ ))}
87
+ </Grid>
88
+ </>
89
+ );
90
+ });
91
+
92
+ AgentList.displayName = 'AgentList';
93
+
94
+ export default AgentList;
@@ -0,0 +1,42 @@
1
+ 'use client';
2
+
3
+ import { SearchBar } from '@lobehub/ui';
4
+ import { memo } from 'react';
5
+ import { useTranslation } from 'react-i18next';
6
+ import useControlledState from 'use-merge-value';
7
+
8
+ import { useMarketStore } from '@/store/market';
9
+
10
+ interface AgentSearchBarProps {
11
+ mobile?: boolean;
12
+ }
13
+
14
+ const AgentSearchBar = memo<AgentSearchBarProps>(({ mobile }) => {
15
+ const { t } = useTranslation('market');
16
+ const [searchKeywords, setSearchKeywords] = useMarketStore((s) => [
17
+ s.searchKeywords,
18
+ s.setSearchKeywords,
19
+ ]);
20
+
21
+ const [keyword, setKeyword] = useControlledState(searchKeywords, {
22
+ onChange: setSearchKeywords,
23
+ value: searchKeywords,
24
+ });
25
+
26
+ return (
27
+ <SearchBar
28
+ allowClear
29
+ enableShortKey={!mobile}
30
+ onChange={(e) => {
31
+ setKeyword(e.target.value);
32
+ }}
33
+ placeholder={t('search.placeholder')}
34
+ shortKey={'k'}
35
+ spotlight={!mobile}
36
+ type={mobile ? 'block' : 'ghost'}
37
+ value={keyword}
38
+ />
39
+ );
40
+ });
41
+
42
+ export default AgentSearchBar;
@@ -1,4 +1,4 @@
1
- import { Icon } from '@lobehub/ui';
1
+ import { Icon, Typography } from '@lobehub/ui';
2
2
  import { Button, Divider, Tag } from 'antd';
3
3
  import { Github, Settings, Share2 } from 'lucide-react';
4
4
  import Image from 'next/image';
@@ -10,7 +10,7 @@ import { AGENTS_INDEX_GITHUB, imageUrl } from '@/const/url';
10
10
  const Inner = memo(() => {
11
11
  const { t } = useTranslation('market');
12
12
  return (
13
- <>
13
+ <Typography fontSize={14} headerMultiple={0.5} marginMultiple={0.4}>
14
14
  <Image
15
15
  alt={'banner'}
16
16
  height={602}
@@ -23,12 +23,14 @@ const Inner = memo(() => {
23
23
  <span>{t('guide.func1.title')}</span>
24
24
  </h3>
25
25
  <p>
26
- <Icon icon={Settings} />
27
- {' - '}
26
+ <kbd>
27
+ <Icon icon={Settings} />
28
+ </kbd>
28
29
  {t('guide.func1.desc1')}
29
30
  <br />
30
- <Icon icon={Share2} />
31
- {' - '}
31
+ <kbd>
32
+ <Icon icon={Share2} />
33
+ </kbd>
32
34
  {t('guide.func1.desc2')}
33
35
  </p>
34
36
  <Divider />
@@ -45,7 +47,7 @@ const Inner = memo(() => {
45
47
  >
46
48
  {t('guide.func2.button')}
47
49
  </Button>
48
- </>
50
+ </Typography>
49
51
  );
50
52
  });
51
53
 
@@ -1,34 +1,41 @@
1
1
  import { ActionIcon, Icon, Modal } from '@lobehub/ui';
2
- import { Button } from 'antd';
3
- import { Rss } from 'lucide-react';
2
+ import { Button, Skeleton } from 'antd';
3
+ import { useResponsive } from 'antd-style';
4
+ import { Upload } from 'lucide-react';
5
+ import dynamic from 'next/dynamic';
4
6
  import { memo, useState } from 'react';
5
7
  import { useTranslation } from 'react-i18next';
6
8
 
7
9
  import { MOBILE_HEADER_ICON_SIZE } from '@/const/layoutTokens';
8
10
 
9
- import Inner from './Inner';
11
+ const Inner = dynamic(() => import('./Inner'), {
12
+ loading: () => <Skeleton paragraph={{ rows: 8 }} title={false} />,
13
+ });
10
14
 
11
15
  const ShareAgentButton = memo<{ mobile?: boolean }>(({ mobile }) => {
16
+ const { mobile: resMobile } = useResponsive();
12
17
  const { t } = useTranslation('market');
13
18
  const [isModalOpen, setIsModalOpen] = useState(false);
14
19
 
15
- const buttonContent = mobile ? (
16
- <ActionIcon
17
- icon={Rss}
18
- onClick={() => setIsModalOpen(true)}
19
- size={MOBILE_HEADER_ICON_SIZE}
20
- title={t('submitAgent')}
21
- />
22
- ) : (
23
- <Button icon={<Icon icon={Rss} />} onClick={() => setIsModalOpen(true)}>
24
- {t('submitAgent')}
25
- </Button>
26
- );
20
+ const buttonContent =
21
+ mobile || resMobile ? (
22
+ <ActionIcon
23
+ icon={Upload}
24
+ onClick={() => setIsModalOpen(true)}
25
+ size={MOBILE_HEADER_ICON_SIZE}
26
+ title={t('submitAgent')}
27
+ />
28
+ ) : (
29
+ <Button icon={<Icon icon={Upload} />} onClick={() => setIsModalOpen(true)}>
30
+ {t('submitAgent')}
31
+ </Button>
32
+ );
27
33
 
28
34
  return (
29
35
  <>
30
36
  {buttonContent}
31
37
  <Modal
38
+ allowFullscreen
32
39
  footer={null}
33
40
  onCancel={() => setIsModalOpen(false)}
34
41
  open={isModalOpen}
@@ -0,0 +1,65 @@
1
+ 'use client';
2
+
3
+ import { Button } from 'antd';
4
+ import { createStyles, useResponsive } from 'antd-style';
5
+ import isEqual from 'fast-deep-equal';
6
+ import { startCase } from 'lodash-es';
7
+ import { memo } from 'react';
8
+ import { Flexbox } from 'react-layout-kit';
9
+
10
+ import { agentMarketSelectors, useMarketStore } from '@/store/market';
11
+
12
+ const useStyles = createStyles(({ css, token }) => ({
13
+ active: css`
14
+ color: ${token.colorBgLayout};
15
+ background: ${token.colorPrimary};
16
+
17
+ &:hover {
18
+ color: ${token.colorBgLayout} !important;
19
+ background: ${token.colorPrimary} !important;
20
+ }
21
+ `,
22
+ tag: css`
23
+ background: ${token.colorBgContainer};
24
+ border: none;
25
+
26
+ &:hover {
27
+ background: ${token.colorBgElevated} !important;
28
+ }
29
+ `,
30
+ }));
31
+
32
+ const TagList = memo(() => {
33
+ const { cx, styles } = useStyles();
34
+ const { md = true } = useResponsive();
35
+ const [searchKeywords, setSearchKeywords] = useMarketStore((s) => [
36
+ s.searchKeywords,
37
+ s.setSearchKeywords,
38
+ ]);
39
+ const agentTagList = useMarketStore(agentMarketSelectors.getAgentTagList, isEqual);
40
+
41
+ const list = md ? agentTagList : agentTagList.slice(0, 20);
42
+
43
+ return (
44
+ <Flexbox gap={6} horizontal style={{ flexWrap: 'wrap' }}>
45
+ {list.map((item) => {
46
+ const isActive = searchKeywords === item;
47
+ return (
48
+ <Button
49
+ className={cx(styles.tag, isActive && styles.active)}
50
+ key={item}
51
+ onClick={() => {
52
+ setSearchKeywords(isActive ? '' : item);
53
+ }}
54
+ shape={'round'}
55
+ size={'small'}
56
+ >
57
+ {startCase(item)}
58
+ </Button>
59
+ );
60
+ })}
61
+ </Flexbox>
62
+ );
63
+ });
64
+
65
+ export default TagList;
@@ -0,0 +1,11 @@
1
+ import ServerLayout from '@/components/server/ServerLayout';
2
+
3
+ import Desktop from './_layout/Desktop';
4
+ import Mobile from './_layout/Mobile';
5
+ import { LayoutProps } from './_layout/type';
6
+
7
+ const MainLayout = ServerLayout<LayoutProps>({ Desktop, Mobile });
8
+
9
+ MainLayout.displayName = 'MarketLayout';
10
+
11
+ export default MainLayout;
@@ -1,3 +1,3 @@
1
- import Load from './components/Loading';
1
+ import { Skeleton } from 'antd';
2
2
 
3
- export default () => <Load />;
3
+ export default () => <Skeleton paragraph={{ rows: 8 }} style={{ marginBlock: 24 }} title={false} />;
@@ -1,25 +1,35 @@
1
- import { Metadata } from 'next';
1
+ import { Flexbox } from 'react-layout-kit';
2
2
 
3
3
  import { getCanonicalUrl } from '@/const/url';
4
+ import { translation } from '@/server/translation';
4
5
  import { isMobileDevice } from '@/utils/responsive';
5
6
 
6
- import DesktopPage from './(desktop)';
7
- import MobilePage from './(mobile)';
8
- import PageTitle from './features/PageTitle';
7
+ import AgentList from './features/AgentList';
8
+ import AgentSearchBar from './features/AgentSearchBar';
9
+ import TagList from './features/TagList';
9
10
 
10
- export default () => {
11
- const mobile = isMobileDevice();
11
+ export const generateMetadata = async () => {
12
+ const { t } = await translation('common');
13
+ return {
14
+ alternates: { canonical: getCanonicalUrl('/market') },
15
+ title: t('tab.market'),
16
+ };
17
+ };
12
18
 
13
- const Page = mobile ? MobilePage : DesktopPage;
19
+ const Page = () => {
20
+ const mobile = isMobileDevice();
14
21
 
15
22
  return (
16
23
  <>
17
- <PageTitle />
18
- <Page />
24
+ <AgentSearchBar mobile={mobile} />
25
+ <Flexbox gap={mobile ? 16 : 24}>
26
+ <TagList />
27
+ <AgentList mobile={mobile} />
28
+ </Flexbox>
19
29
  </>
20
30
  );
21
31
  };
22
32
 
23
- export const metadata: Metadata = {
24
- alternates: { canonical: getCanonicalUrl('/market') },
25
- };
33
+ Page.DisplayName = 'Market';
34
+
35
+ export default Page;
@@ -0,0 +1,16 @@
1
+ import UpgradeAlert from '@/app/(main)/settings//features/UpgradeAlert';
2
+
3
+ import CategoryContent from './features/CategoryContent';
4
+
5
+ const Category = () => {
6
+ return (
7
+ <>
8
+ <CategoryContent />
9
+ <UpgradeAlert />
10
+ </>
11
+ );
12
+ };
13
+
14
+ Category.displayName = 'SettingCategory';
15
+
16
+ export default Category;
@@ -0,0 +1,35 @@
1
+ 'use client';
2
+
3
+ import { memo } from 'react';
4
+ import urlJoin from 'url-join';
5
+
6
+ import Menu from '@/components/Menu';
7
+ import { useActiveSettingsKey } from '@/hooks/useActiveSettingsKey';
8
+ import { useQueryRoute } from '@/hooks/useQueryRoute';
9
+
10
+ import { useCategory } from '../../hooks/useCategory';
11
+
12
+ const CategoryContent = memo<{ modal?: boolean }>(({ modal }) => {
13
+ const activeTab = useActiveSettingsKey();
14
+ const cateItems = useCategory();
15
+ const router = useQueryRoute();
16
+
17
+ return (
18
+ <Menu
19
+ items={cateItems}
20
+ onClick={({ key }) => {
21
+ const path = urlJoin('/settings', key);
22
+ if (modal) {
23
+ router.replace(path);
24
+ } else {
25
+ router.push(path);
26
+ }
27
+ }}
28
+ selectable
29
+ selectedKeys={[activeTab as any]}
30
+ variant={'compact'}
31
+ />
32
+ );
33
+ });
34
+
35
+ export default CategoryContent;