@lobehub/chat 1.17.7 → 1.18.0

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.

Potentially problematic release.


This version of @lobehub/chat might be problematic. Click here for more details.

Files changed (336) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/locales/ar/common.json +1 -1
  3. package/locales/ar/discover.json +204 -0
  4. package/locales/ar/metadata.json +20 -3
  5. package/locales/ar/models.json +845 -0
  6. package/locales/ar/providers.json +80 -0
  7. package/locales/bg-BG/common.json +1 -1
  8. package/locales/bg-BG/discover.json +204 -0
  9. package/locales/bg-BG/metadata.json +20 -3
  10. package/locales/bg-BG/models.json +845 -0
  11. package/locales/bg-BG/providers.json +80 -0
  12. package/locales/de-DE/common.json +1 -1
  13. package/locales/de-DE/discover.json +204 -0
  14. package/locales/de-DE/metadata.json +20 -3
  15. package/locales/de-DE/models.json +845 -0
  16. package/locales/de-DE/providers.json +80 -0
  17. package/locales/en-US/common.json +1 -1
  18. package/locales/en-US/discover.json +204 -0
  19. package/locales/en-US/metadata.json +20 -3
  20. package/locales/en-US/models.json +845 -0
  21. package/locales/en-US/providers.json +80 -0
  22. package/locales/es-ES/common.json +1 -1
  23. package/locales/es-ES/discover.json +204 -0
  24. package/locales/es-ES/metadata.json +20 -3
  25. package/locales/es-ES/models.json +845 -0
  26. package/locales/es-ES/providers.json +80 -0
  27. package/locales/fr-FR/common.json +1 -1
  28. package/locales/fr-FR/discover.json +204 -0
  29. package/locales/fr-FR/metadata.json +20 -3
  30. package/locales/fr-FR/models.json +845 -0
  31. package/locales/fr-FR/providers.json +80 -0
  32. package/locales/it-IT/common.json +1 -1
  33. package/locales/it-IT/discover.json +204 -0
  34. package/locales/it-IT/metadata.json +20 -3
  35. package/locales/it-IT/models.json +845 -0
  36. package/locales/it-IT/providers.json +80 -0
  37. package/locales/ja-JP/common.json +1 -1
  38. package/locales/ja-JP/discover.json +204 -0
  39. package/locales/ja-JP/metadata.json +20 -3
  40. package/locales/ja-JP/models.json +845 -0
  41. package/locales/ja-JP/providers.json +80 -0
  42. package/locales/ko-KR/common.json +1 -1
  43. package/locales/ko-KR/discover.json +204 -0
  44. package/locales/ko-KR/metadata.json +20 -3
  45. package/locales/ko-KR/models.json +845 -0
  46. package/locales/ko-KR/providers.json +80 -0
  47. package/locales/nl-NL/common.json +1 -1
  48. package/locales/nl-NL/discover.json +204 -0
  49. package/locales/nl-NL/metadata.json +20 -3
  50. package/locales/nl-NL/models.json +845 -0
  51. package/locales/nl-NL/providers.json +80 -0
  52. package/locales/pl-PL/common.json +1 -1
  53. package/locales/pl-PL/discover.json +204 -0
  54. package/locales/pl-PL/metadata.json +20 -3
  55. package/locales/pl-PL/models.json +845 -0
  56. package/locales/pl-PL/providers.json +80 -0
  57. package/locales/pt-BR/common.json +1 -1
  58. package/locales/pt-BR/discover.json +204 -0
  59. package/locales/pt-BR/metadata.json +20 -3
  60. package/locales/pt-BR/models.json +845 -0
  61. package/locales/pt-BR/providers.json +80 -0
  62. package/locales/ru-RU/common.json +1 -1
  63. package/locales/ru-RU/discover.json +204 -0
  64. package/locales/ru-RU/metadata.json +20 -3
  65. package/locales/ru-RU/models.json +845 -0
  66. package/locales/ru-RU/providers.json +80 -0
  67. package/locales/tr-TR/common.json +1 -1
  68. package/locales/tr-TR/discover.json +204 -0
  69. package/locales/tr-TR/metadata.json +20 -3
  70. package/locales/tr-TR/models.json +845 -0
  71. package/locales/tr-TR/providers.json +80 -0
  72. package/locales/vi-VN/common.json +1 -1
  73. package/locales/vi-VN/discover.json +204 -0
  74. package/locales/vi-VN/metadata.json +20 -3
  75. package/locales/vi-VN/models.json +845 -0
  76. package/locales/vi-VN/providers.json +80 -0
  77. package/locales/zh-CN/common.json +1 -1
  78. package/locales/zh-CN/discover.json +204 -0
  79. package/locales/zh-CN/metadata.json +20 -3
  80. package/locales/zh-CN/models.json +845 -0
  81. package/locales/zh-CN/providers.json +80 -0
  82. package/locales/zh-CN/welcome.json +1 -1
  83. package/locales/zh-TW/common.json +1 -1
  84. package/locales/zh-TW/discover.json +204 -0
  85. package/locales/zh-TW/metadata.json +20 -3
  86. package/locales/zh-TW/models.json +845 -0
  87. package/locales/zh-TW/providers.json +80 -0
  88. package/package.json +3 -2
  89. package/src/app/(main)/@nav/_layout/Desktop/TopActions.test.tsx +3 -3
  90. package/src/app/(main)/@nav/_layout/Desktop/TopActions.tsx +3 -3
  91. package/src/app/(main)/@nav/_layout/Mobile.tsx +3 -3
  92. package/src/app/(main)/_layout/Mobile.tsx +9 -1
  93. package/src/app/(main)/discover/(detail)/_layout/Desktop.tsx +24 -0
  94. package/src/app/(main)/discover/(detail)/_layout/Mobile/Header.tsx +25 -0
  95. package/src/app/(main)/discover/(detail)/_layout/Mobile/index.tsx +17 -0
  96. package/src/app/(main)/discover/(detail)/assistant/[slug]/features/Actions.tsx +35 -0
  97. package/src/app/(main)/discover/(detail)/assistant/[slug]/features/AddAgent.tsx +86 -0
  98. package/src/app/(main)/discover/(detail)/assistant/[slug]/features/ConversationExample/TopicList.tsx +74 -0
  99. package/src/app/(main)/discover/(detail)/assistant/[slug]/features/ConversationExample/index.tsx +100 -0
  100. package/src/app/(main)/discover/(detail)/assistant/[slug]/features/Header.tsx +118 -0
  101. package/src/app/(main)/discover/(detail)/assistant/[slug]/features/InfoSidebar/SuggestionItem.tsx +62 -0
  102. package/src/app/(main)/discover/(detail)/assistant/[slug]/features/InfoSidebar/ToolItem.tsx +19 -0
  103. package/src/app/(main)/discover/(detail)/assistant/[slug]/features/InfoSidebar/index.tsx +64 -0
  104. package/src/app/(main)/discover/(detail)/assistant/[slug]/features/SystemRole.tsx +35 -0
  105. package/src/app/(main)/discover/(detail)/assistant/[slug]/features/Temp.tsx +44 -0
  106. package/src/app/(main)/discover/(detail)/assistant/[slug]/page.tsx +121 -0
  107. package/src/app/(main)/discover/(detail)/error.tsx +5 -0
  108. package/src/app/(main)/discover/(detail)/features/Back.tsx +42 -0
  109. package/src/app/(main)/discover/(detail)/features/Block.tsx +50 -0
  110. package/src/app/(main)/discover/(detail)/features/DetailLayout.tsx +91 -0
  111. package/src/app/(main)/discover/(detail)/features/HighlightBlock.tsx +82 -0
  112. package/src/app/(main)/discover/(detail)/features/ShareButton.tsx +160 -0
  113. package/src/app/(main)/discover/(detail)/features/SidebarContainer.tsx +19 -0
  114. package/src/app/(main)/discover/(detail)/layout.tsx +12 -0
  115. package/src/app/(main)/discover/(detail)/loading.tsx +38 -0
  116. package/src/app/(main)/discover/(detail)/model/[...slugs]/features/Actions.tsx +46 -0
  117. package/src/app/(main)/discover/(detail)/model/[...slugs]/features/ChatWithModel.tsx +93 -0
  118. package/src/app/(main)/discover/(detail)/model/[...slugs]/features/Header.tsx +85 -0
  119. package/src/app/(main)/discover/(detail)/model/[...slugs]/features/InfoSidebar/SuggestionItem.tsx +75 -0
  120. package/src/app/(main)/discover/(detail)/model/[...slugs]/features/InfoSidebar/index.tsx +49 -0
  121. package/src/app/(main)/discover/(detail)/model/[...slugs]/features/ParameterList/ParameterItem.tsx +71 -0
  122. package/src/app/(main)/discover/(detail)/model/[...slugs]/features/ParameterList/index.tsx +110 -0
  123. package/src/app/(main)/discover/(detail)/model/[...slugs]/features/ProviderList/ProviderItem.tsx +152 -0
  124. package/src/app/(main)/discover/(detail)/model/[...slugs]/features/ProviderList/index.tsx +45 -0
  125. package/src/app/(main)/discover/(detail)/model/[...slugs]/page.tsx +114 -0
  126. package/src/app/(main)/discover/(detail)/not-found.tsx +3 -0
  127. package/src/app/(main)/discover/(detail)/plugin/[slug]/features/Actions.tsx +35 -0
  128. package/src/app/(main)/discover/(detail)/plugin/[slug]/features/Header.tsx +114 -0
  129. package/src/app/(main)/discover/(detail)/plugin/[slug]/features/InfoSidebar/SuggestionItem.tsx +62 -0
  130. package/src/app/(main)/discover/(detail)/plugin/[slug]/features/InfoSidebar/index.tsx +49 -0
  131. package/src/app/(main)/discover/(detail)/plugin/[slug]/features/InstallPlugin.tsx +87 -0
  132. package/src/app/(main)/discover/(detail)/plugin/[slug]/features/ParameterList.tsx +95 -0
  133. package/src/app/(main)/discover/(detail)/plugin/[slug]/features/Schema.tsx +23 -0
  134. package/src/app/(main)/discover/(detail)/plugin/[slug]/page.tsx +103 -0
  135. package/src/app/(main)/discover/(detail)/provider/[slug]/features/Actions.tsx +49 -0
  136. package/src/app/(main)/discover/(detail)/provider/[slug]/features/Header.tsx +73 -0
  137. package/src/app/(main)/discover/(detail)/provider/[slug]/features/InfoSidebar/SuggestionItem.tsx +75 -0
  138. package/src/app/(main)/discover/(detail)/provider/[slug]/features/InfoSidebar/index.tsx +49 -0
  139. package/src/app/(main)/discover/(detail)/provider/[slug]/features/ModelList/ModelItem.tsx +148 -0
  140. package/src/app/(main)/discover/(detail)/provider/[slug]/features/ModelList/index.tsx +60 -0
  141. package/src/app/(main)/discover/(detail)/provider/[slug]/features/ProviderConfig.tsx +80 -0
  142. package/src/app/(main)/discover/(detail)/provider/[slug]/page.tsx +116 -0
  143. package/src/app/(main)/discover/(list)/(home)/Client.tsx +42 -0
  144. package/src/app/(main)/discover/(list)/(home)/features/AssistantList.tsx +33 -0
  145. package/src/app/(main)/discover/(list)/(home)/features/ModelList.tsx +22 -0
  146. package/src/app/(main)/discover/(list)/(home)/features/PluginList.tsx +25 -0
  147. package/src/app/(main)/discover/(list)/(home)/loading.tsx +1 -0
  148. package/src/app/(main)/discover/(list)/(home)/page.tsx +54 -0
  149. package/src/app/(main)/discover/(list)/_layout/Desktop/Nav.tsx +118 -0
  150. package/src/app/(main)/discover/(list)/_layout/Desktop/index.tsx +37 -0
  151. package/src/app/(main)/discover/(list)/_layout/Desktop/useScroll.ts +33 -0
  152. package/src/app/(main)/discover/(list)/_layout/Mobile/Header.tsx +62 -0
  153. package/src/app/(main)/discover/(list)/_layout/Mobile/Nav.tsx +94 -0
  154. package/src/app/(main)/discover/(list)/_layout/Mobile/index.tsx +27 -0
  155. package/src/app/(main)/discover/(list)/assistants/[slug]/page.tsx +64 -0
  156. package/src/app/(main)/discover/(list)/assistants/_layout/Desktop.tsx +22 -0
  157. package/src/app/(main)/discover/(list)/assistants/_layout/Mobile.tsx +9 -0
  158. package/src/app/(main)/discover/(list)/assistants/features/Card.tsx +176 -0
  159. package/src/app/(main)/discover/(list)/assistants/features/Category.tsx +48 -0
  160. package/src/app/(main)/discover/(list)/assistants/features/List.tsx +97 -0
  161. package/src/app/(main)/discover/(list)/assistants/features/useCategory.tsx +116 -0
  162. package/src/app/(main)/discover/(list)/assistants/layout.tsx +12 -0
  163. package/src/app/(main)/discover/(list)/assistants/loading.tsx +1 -0
  164. package/src/app/(main)/discover/(list)/assistants/page.tsx +51 -0
  165. package/src/app/(main)/discover/(list)/error.tsx +5 -0
  166. package/src/app/(main)/{market → discover/(list)}/layout.tsx +4 -3
  167. package/src/app/(main)/discover/(list)/loading.tsx +39 -0
  168. package/src/app/(main)/discover/(list)/models/[slug]/page.tsx +70 -0
  169. package/src/app/(main)/discover/(list)/models/_layout/Desktop.tsx +28 -0
  170. package/src/app/(main)/discover/(list)/models/_layout/Mobile.tsx +9 -0
  171. package/src/app/(main)/discover/(list)/models/features/Card.tsx +116 -0
  172. package/src/app/(main)/discover/(list)/models/features/Category.tsx +67 -0
  173. package/src/app/(main)/discover/(list)/models/features/List.tsx +72 -0
  174. package/src/app/(main)/discover/(list)/models/features/const.ts +9 -0
  175. package/src/app/(main)/discover/(list)/models/layout.tsx +12 -0
  176. package/src/app/(main)/discover/(list)/models/loading.tsx +1 -0
  177. package/src/app/(main)/discover/(list)/models/page.tsx +61 -0
  178. package/src/app/(main)/discover/(list)/not-found.tsx +3 -0
  179. package/src/app/(main)/discover/(list)/plugins/[slug]/page.tsx +64 -0
  180. package/src/app/(main)/discover/(list)/plugins/_layout/Desktop.tsx +22 -0
  181. package/src/app/(main)/discover/(list)/plugins/_layout/Mobile.tsx +9 -0
  182. package/src/app/(main)/discover/(list)/plugins/features/Card.tsx +154 -0
  183. package/src/app/(main)/discover/(list)/plugins/features/Category.tsx +45 -0
  184. package/src/app/(main)/discover/(list)/plugins/features/List.tsx +96 -0
  185. package/src/app/(main)/discover/(list)/plugins/features/useCategory.tsx +80 -0
  186. package/src/app/(main)/discover/(list)/plugins/layout.tsx +12 -0
  187. package/src/app/(main)/discover/(list)/plugins/loading.tsx +1 -0
  188. package/src/app/(main)/discover/(list)/plugins/page.tsx +52 -0
  189. package/src/app/(main)/discover/(list)/providers/features/Card.tsx +117 -0
  190. package/src/app/(main)/discover/(list)/providers/features/List.tsx +71 -0
  191. package/src/app/(main)/discover/(list)/providers/loading.tsx +1 -0
  192. package/src/app/(main)/discover/(list)/providers/page.tsx +52 -0
  193. package/src/app/(main)/discover/_layout/Desktop/Header.tsx +36 -0
  194. package/src/app/(main)/discover/_layout/Desktop/index.tsx +21 -0
  195. package/src/app/(main)/discover/_layout/Mobile/index.tsx +9 -0
  196. package/src/app/(main)/{market/features/AgentCard/AgentCardBanner.tsx → discover/components/CardBanner.tsx} +5 -5
  197. package/src/app/(main)/discover/components/CategoryContainer.tsx +18 -0
  198. package/src/app/(main)/discover/components/CategoryMenu.tsx +39 -0
  199. package/src/app/(main)/discover/components/GitHubAvatar.tsx +19 -0
  200. package/src/app/(main)/discover/components/GridLoadingCard.tsx +69 -0
  201. package/src/app/(main)/discover/components/ListLoading.tsx +66 -0
  202. package/src/app/(main)/discover/components/Loading.tsx +17 -0
  203. package/src/app/(main)/discover/components/SearchResultCount.tsx +37 -0
  204. package/src/app/(main)/discover/components/Statistic.tsx +92 -0
  205. package/src/app/(main)/discover/components/Title.tsx +76 -0
  206. package/src/app/(main)/discover/components/VirtuosoGridList/index.tsx +52 -0
  207. package/src/app/(main)/discover/components/VirtuosoGridList/useScrollParent.ts +19 -0
  208. package/src/app/(main)/discover/error.tsx +5 -0
  209. package/src/app/(main)/{market/features/ShareAgentButton → discover/features/CreateButton}/Inner.tsx +9 -10
  210. package/src/app/(main)/{market/features/ShareAgentButton → discover/features/CreateButton}/index.tsx +9 -9
  211. package/src/app/(main)/discover/features/LikeButton.tsx +73 -0
  212. package/src/app/(main)/discover/features/ModelFeatureTags.tsx +77 -0
  213. package/src/app/(main)/discover/features/StoreSearchBar.tsx +84 -0
  214. package/src/app/(main)/discover/features/const.ts +2 -0
  215. package/src/app/(main)/discover/features/useNav.tsx +71 -0
  216. package/src/app/(main)/discover/layout.tsx +12 -0
  217. package/src/app/(main)/discover/loading.tsx +9 -0
  218. package/src/app/(main)/discover/not-found.tsx +3 -0
  219. package/src/app/(main)/discover/search/_layout/Desktop.tsx +42 -0
  220. package/src/app/(main)/discover/search/_layout/Mobile/Header.tsx +31 -0
  221. package/src/app/(main)/discover/search/_layout/Mobile/Nav.tsx +56 -0
  222. package/src/app/(main)/discover/search/_layout/Mobile/index.tsx +32 -0
  223. package/src/app/(main)/discover/search/features/AssistantsResult.tsx +27 -0
  224. package/src/app/(main)/discover/search/features/Category.tsx +41 -0
  225. package/src/app/(main)/discover/search/features/ModelsResult.tsx +27 -0
  226. package/src/app/(main)/discover/search/features/PluginsResult.tsx +27 -0
  227. package/src/app/(main)/discover/search/features/ProvidersResult.tsx +26 -0
  228. package/src/app/(main)/discover/search/layout.tsx +12 -0
  229. package/src/app/(main)/discover/search/loading.tsx +1 -0
  230. package/src/app/(main)/discover/search/page.tsx +78 -0
  231. package/src/app/(main)/settings/llm/components/ProviderConfig/index.tsx +0 -6
  232. package/src/app/(main)/welcome/features/Actions.tsx +1 -1
  233. package/src/app/@modal/(.)discover/assistant/[slug]/page.tsx +1 -0
  234. package/src/app/@modal/(.)discover/layout.tsx +29 -0
  235. package/src/app/@modal/(.)discover/loading.tsx +3 -0
  236. package/src/app/@modal/(.)discover/model/[...slugs]/page.tsx +1 -0
  237. package/src/app/@modal/(.)discover/plugin/[slug]/page.tsx +1 -0
  238. package/src/app/@modal/(.)discover/provider/[slug]/page.tsx +1 -0
  239. package/src/app/@modal/features/InterceptingContext.tsx +9 -0
  240. package/src/app/@modal/layout.tsx +58 -21
  241. package/src/app/api/{market → assistant}/[id]/route.ts +2 -3
  242. package/src/app/api/{market → assistant/store}/route.ts +2 -5
  243. package/src/app/api/plugin/store/route.ts +1 -4
  244. package/src/app/metadata.ts +3 -0
  245. package/src/app/redirect/page.tsx +15 -0
  246. package/src/components/FetchErrorNotification/Description.tsx +2 -0
  247. package/src/components/InterceptingLink/index.tsx +27 -0
  248. package/src/components/mdx/CodeBlock.tsx +46 -0
  249. package/src/components/mdx/Link.tsx +21 -0
  250. package/src/components/mdx/index.tsx +51 -0
  251. package/src/const/discover.ts +63 -1
  252. package/src/features/Conversation/Error/PluginSettings.tsx +1 -1
  253. package/src/features/Conversation/Messages/Tool/Inspector/Settings.tsx +1 -1
  254. package/src/features/Conversation/components/InboxWelcome/AgentsSuggest.tsx +41 -24
  255. package/src/features/MobileTabBar/index.tsx +3 -3
  256. package/src/features/PluginDetailModal/APIs.tsx +1 -1
  257. package/src/features/PluginDevModal/UrlManifestForm.tsx +1 -1
  258. package/src/features/PluginStore/PluginItem/Action.tsx +1 -1
  259. package/src/features/PluginsUI/Render/DefaultType/index.tsx +1 -1
  260. package/src/features/PluginsUI/Render/StandaloneType/index.tsx +1 -1
  261. package/src/hooks/useInterceptingRoutes.ts +21 -1
  262. package/src/hooks/useShare.tsx +191 -0
  263. package/src/locales/create.ts +1 -1
  264. package/src/locales/default/common.ts +1 -1
  265. package/src/locales/default/discover.ts +205 -0
  266. package/src/locales/default/index.ts +6 -2
  267. package/src/locales/default/metadata.ts +23 -3
  268. package/src/locales/default/models.ts +15 -0
  269. package/src/locales/default/providers.ts +15 -0
  270. package/src/locales/default/welcome.ts +1 -1
  271. package/src/locales/resources.ts +2 -0
  272. package/src/server/ld.ts +85 -11
  273. package/src/server/metadata.ts +41 -3
  274. package/src/{app/api/market/AgentMarket.test.ts → server/modules/AssistantStore/index.test.ts} +15 -15
  275. package/src/{app/api/market/AgentMarket.ts → server/modules/AssistantStore/index.ts} +7 -3
  276. package/src/{app/api/plugin/store/Store.test.ts → server/modules/PluginStore/index.test.ts} +1 -1
  277. package/src/server/services/discover/index.ts +352 -0
  278. package/src/server/services/doc/index.tsx +40 -0
  279. package/src/server/translation.ts +11 -5
  280. package/src/services/__tests__/__snapshots__/tool.test.ts.snap +1 -1
  281. package/src/services/{_auth.test.ts → __tests__/_auth.test.ts} +1 -1
  282. package/src/services/__tests__/assistant.test.ts +82 -0
  283. package/src/services/__tests__/tool.test.ts +13 -13
  284. package/src/services/_url.ts +2 -2
  285. package/src/services/assistant.ts +30 -0
  286. package/src/services/chat.ts +1 -1
  287. package/src/services/tool.ts +7 -129
  288. package/src/store/chat/slices/plugin/action.test.ts +112 -0
  289. package/src/store/chat/slices/plugin/action.ts +1 -3
  290. package/src/store/global/initialState.ts +1 -1
  291. package/src/store/tool/selectors/tool.test.ts +1 -1
  292. package/src/store/tool/slices/customPlugin/action.test.ts +1 -1
  293. package/src/store/tool/slices/customPlugin/action.ts +1 -1
  294. package/src/store/tool/slices/plugin/action.ts +1 -1
  295. package/src/store/tool/slices/plugin/selectors.test.ts +3 -3
  296. package/src/store/tool/slices/plugin/selectors.ts +3 -3
  297. package/src/store/tool/slices/store/action.test.ts +16 -22
  298. package/src/store/tool/slices/store/action.ts +8 -8
  299. package/src/types/discover.ts +152 -0
  300. package/src/types/llm.ts +4 -2
  301. package/src/types/meta.ts +1 -0
  302. package/src/utils/format.test.ts +191 -112
  303. package/src/utils/format.ts +36 -0
  304. package/src/utils/toolManifest.ts +124 -0
  305. package/src/app/(main)/market/@detail/default.tsx +0 -12
  306. package/src/app/(main)/market/@detail/features/AgentDetailContent.tsx +0 -73
  307. package/src/app/(main)/market/@detail/features/Banner.tsx +0 -46
  308. package/src/app/(main)/market/@detail/features/Comment.tsx +0 -16
  309. package/src/app/(main)/market/@detail/features/Header.tsx +0 -81
  310. package/src/app/(main)/market/@detail/features/Loading.tsx +0 -63
  311. package/src/app/(main)/market/@detail/features/TokenTag.tsx +0 -27
  312. package/src/app/(main)/market/@detail/features/style.ts +0 -32
  313. package/src/app/(main)/market/_layout/Desktop/DetailSidebar.tsx +0 -84
  314. package/src/app/(main)/market/_layout/Desktop/Header.tsx +0 -29
  315. package/src/app/(main)/market/_layout/Desktop/Hero.tsx +0 -40
  316. package/src/app/(main)/market/_layout/Desktop/index.tsx +0 -46
  317. package/src/app/(main)/market/_layout/Mobile/DetailModal.tsx +0 -32
  318. package/src/app/(main)/market/_layout/Mobile/Header.tsx +0 -20
  319. package/src/app/(main)/market/_layout/Mobile/index.tsx +0 -25
  320. package/src/app/(main)/market/_layout/type.ts +0 -6
  321. package/src/app/(main)/market/features/AgentCard/index.tsx +0 -139
  322. package/src/app/(main)/market/features/AgentList.tsx +0 -103
  323. package/src/app/(main)/market/features/AgentSearchBar.tsx +0 -42
  324. package/src/app/(main)/market/features/TagList.tsx +0 -69
  325. package/src/app/(main)/market/loading.tsx +0 -15
  326. package/src/app/(main)/market/page.tsx +0 -44
  327. package/src/const/market.ts +0 -15
  328. package/src/locales/default/market.ts +0 -32
  329. package/src/services/market.ts +0 -22
  330. package/src/store/market/action.ts +0 -82
  331. package/src/store/market/index.ts +0 -3
  332. package/src/store/market/initialState.ts +0 -19
  333. package/src/store/market/selectors.ts +0 -38
  334. package/src/store/market/store.ts +0 -48
  335. package/src/types/market.ts +0 -20
  336. /package/src/{app/api/plugin/store/Store.ts → server/modules/PluginStore/index.ts} +0 -0
@@ -0,0 +1,118 @@
1
+ 'use client';
2
+
3
+ import { ChatHeader } from '@lobehub/ui';
4
+ import { Button } from 'antd';
5
+ import { createStyles } from 'antd-style';
6
+ import Link from 'next/link';
7
+ import { usePathname } from 'next/navigation';
8
+ import { memo, useState } from 'react';
9
+ import { Flexbox } from 'react-layout-kit';
10
+ import urlJoin from 'url-join';
11
+
12
+ import { useQueryRoute } from '@/hooks/useQueryRoute';
13
+ import { DiscoverTab } from '@/types/discover';
14
+
15
+ import { MAX_WIDTH } from '../../../features/const';
16
+ import { useNav } from '../../../features/useNav';
17
+ import { useScroll } from './useScroll';
18
+
19
+ export const useStyles = createStyles(({ css, token }) => ({
20
+ activeNavItem: css`
21
+ background: ${token.colorFillTertiary};
22
+ `,
23
+ container: css`
24
+ position: absolute;
25
+ z-index: 9;
26
+ inset-block-start: 64px;
27
+ inset-inline: 0 0;
28
+
29
+ height: auto;
30
+ padding-block: 4px;
31
+
32
+ border-color: transparent;
33
+
34
+ transition: all 0.3s ${token.motionEaseInOut};
35
+ `,
36
+ hide: css`
37
+ transform: translateY(-150%);
38
+ `,
39
+ navItem: css`
40
+ font-weight: 500;
41
+ `,
42
+ }));
43
+
44
+ const Nav = memo(() => {
45
+ const [hide, setHide] = useState(false);
46
+ const pathname = usePathname();
47
+ const { cx, styles } = useStyles();
48
+ const { items, activeKey } = useNav();
49
+ const router = useQueryRoute();
50
+
51
+ useScroll((scroll, delta) => {
52
+ if (delta < 0) {
53
+ setHide(false);
54
+ return;
55
+ }
56
+ if (scroll > 600 && delta > 0) {
57
+ setHide(true);
58
+ }
59
+ });
60
+
61
+ const isHome = pathname === '/discover';
62
+ const isProviders = pathname === '/discover/providers';
63
+
64
+ const navBar = items
65
+ .map((item: any) => {
66
+ const isActive = item.key === activeKey;
67
+
68
+ const href = item.key === DiscoverTab.Home ? '/discover' : urlJoin('/discover', item.key);
69
+
70
+ return (
71
+ <Link
72
+ href={href}
73
+ key={item.key}
74
+ onClick={(e) => {
75
+ e.preventDefault();
76
+ router.push(href);
77
+ }}
78
+ >
79
+ <Button
80
+ className={cx(styles.navItem, isActive && styles.activeNavItem)}
81
+ icon={item.icon}
82
+ type={'text'}
83
+ >
84
+ {item.label}
85
+ </Button>
86
+ </Link>
87
+ );
88
+ })
89
+ .filter(Boolean);
90
+
91
+ return (
92
+ <ChatHeader
93
+ className={cx(styles.container, hide && styles.hide)}
94
+ styles={{
95
+ center: {
96
+ flex: 'none',
97
+ justifyContent: 'space-between',
98
+ maxWidth: MAX_WIDTH,
99
+ width: '100%',
100
+ },
101
+ left: { flex: 1 },
102
+ right: { flex: 1 },
103
+ }}
104
+ >
105
+ <Flexbox align={'center'} gap={4} horizontal>
106
+ {navBar}
107
+ </Flexbox>
108
+ {!isHome && !isProviders && (
109
+ <Flexbox align={'center'} gap={4} horizontal>
110
+ {/* ↓ cloud slot ↓ */}
111
+ {/* ↑ cloud slot ↑ */}
112
+ </Flexbox>
113
+ )}
114
+ </ChatHeader>
115
+ );
116
+ });
117
+
118
+ export default Nav;
@@ -0,0 +1,37 @@
1
+ import { PropsWithChildren } from 'react';
2
+ import { Flexbox } from 'react-layout-kit';
3
+
4
+ import Footer from '@/features/Setting/Footer';
5
+
6
+ import { MAX_WIDTH, SCROLL_PARENT_ID } from '../../../features/const';
7
+ import Nav from './Nav';
8
+
9
+ const Layout = ({ children }: PropsWithChildren) => {
10
+ return (
11
+ <>
12
+ <Nav />
13
+ <Flexbox
14
+ align={'center'}
15
+ flex={1}
16
+ id={SCROLL_PARENT_ID}
17
+ padding={16}
18
+ style={{ overflowX: 'hidden', overflowY: 'scroll', position: 'relative' }}
19
+ width={'100%'}
20
+ >
21
+ <Flexbox
22
+ gap={16}
23
+ style={{ maxWidth: MAX_WIDTH, paddingTop: 64, position: 'relative' }}
24
+ width={'100%'}
25
+ >
26
+ {children}
27
+ <div />
28
+ <Footer />
29
+ </Flexbox>
30
+ </Flexbox>
31
+ </>
32
+ );
33
+ };
34
+
35
+ Layout.displayName = 'DesktopDiscoverStoreLayout';
36
+
37
+ export default Layout;
@@ -0,0 +1,33 @@
1
+ import { throttle } from 'lodash-es';
2
+ import { useEffect, useRef } from 'react';
3
+
4
+ import { isOnServerSide } from '@/utils/env';
5
+
6
+ import { SCROLL_PARENT_ID } from '../../../features/const';
7
+
8
+ export const useScroll = (onScroll: (scroll: number, delta: number) => void) => {
9
+ const lastScrollTop = useRef(0);
10
+
11
+ useEffect(() => {
12
+ if (isOnServerSide) return;
13
+
14
+ const element = document.querySelector(`#${SCROLL_PARENT_ID}`);
15
+
16
+ if (!element) return;
17
+
18
+ const handleScroll = throttle(() => {
19
+ const currentScroll = element.scrollTop;
20
+ const delta = currentScroll - lastScrollTop.current;
21
+
22
+ onScroll?.(currentScroll, delta);
23
+
24
+ lastScrollTop.current = currentScroll;
25
+ });
26
+
27
+ element.addEventListener('scroll', handleScroll, { passive: true });
28
+
29
+ return () => {
30
+ element.removeEventListener('scroll', handleScroll);
31
+ };
32
+ }, []);
33
+ };
@@ -0,0 +1,62 @@
1
+ 'use client';
2
+
3
+ import { ActionIcon, MobileNavBar } from '@lobehub/ui';
4
+ import { createStyles } from 'antd-style';
5
+ import { SearchIcon } from 'lucide-react';
6
+ import { memo, useState } from 'react';
7
+ import { Flexbox } from 'react-layout-kit';
8
+
9
+ import { MOBILE_HEADER_ICON_SIZE } from '@/const/layoutTokens';
10
+ import { mobileHeaderSticky } from '@/styles/mobileHeader';
11
+
12
+ import StoreSearchBar from '../../../features/StoreSearchBar';
13
+ import Nav from './Nav';
14
+
15
+ const useStyles = createStyles(({ css, token }) => ({
16
+ search: css`
17
+ position: absolute;
18
+ z-index: 10;
19
+ inset-block-start: 0;
20
+ inset-inline: 0 0;
21
+
22
+ background: ${token.colorBgLayout};
23
+ `,
24
+ }));
25
+
26
+ const Header = memo(() => {
27
+ const { styles } = useStyles();
28
+ const [showSearch, setShowSearch] = useState(false);
29
+
30
+ return (
31
+ <MobileNavBar
32
+ center={
33
+ showSearch && (
34
+ <Flexbox align={'center'} className={styles.search} paddingBlock={8} paddingInline={16}>
35
+ <StoreSearchBar mobile onBlur={() => setShowSearch(false)} />
36
+ </Flexbox>
37
+ )
38
+ }
39
+ contentStyles={{ center: { display: 'none' } }}
40
+ left={<Nav />}
41
+ right={
42
+ showSearch ? (
43
+ <Flexbox align={'center'} className={styles.search} paddingBlock={8} paddingInline={16}>
44
+ <StoreSearchBar mobile onBlur={() => setShowSearch(false)} />
45
+ </Flexbox>
46
+ ) : (
47
+ <ActionIcon
48
+ icon={SearchIcon}
49
+ onClick={() => setShowSearch(true)}
50
+ size={MOBILE_HEADER_ICON_SIZE}
51
+ />
52
+ )
53
+ }
54
+ style={{
55
+ ...mobileHeaderSticky,
56
+ overflow: 'unset',
57
+ }}
58
+ />
59
+ );
60
+ });
61
+
62
+ export default Header;
@@ -0,0 +1,94 @@
1
+ 'use client';
2
+
3
+ import { ActionIcon } from '@lobehub/ui';
4
+ import { Drawer } from 'antd';
5
+ import { createStyles } from 'antd-style';
6
+ import { MenuIcon } from 'lucide-react';
7
+ import { memo, useState } from 'react';
8
+ import { Flexbox } from 'react-layout-kit';
9
+ import urlJoin from 'url-join';
10
+
11
+ import Menu from '@/components/Menu';
12
+ import { useQueryRoute } from '@/hooks/useQueryRoute';
13
+ import { DiscoverTab } from '@/types/discover';
14
+
15
+ import { useNav } from '../../../features/useNav';
16
+
17
+ export const useStyles = createStyles(({ css, token }) => ({
18
+ activeNavItem: css`
19
+ background: ${token.colorFillTertiary};
20
+ `,
21
+ container: css`
22
+ height: auto;
23
+ padding-block: 4px;
24
+ background: ${token.colorBgLayout};
25
+ `,
26
+ navItem: css`
27
+ font-weight: 500;
28
+ `,
29
+ title: css`
30
+ font-size: 18px;
31
+ font-weight: 700;
32
+ line-height: 1.2;
33
+ `,
34
+ }));
35
+
36
+ const Nav = memo(() => {
37
+ const [open, setOpen] = useState(false);
38
+ const { styles, theme } = useStyles();
39
+ const { items, activeKey, activeItem } = useNav();
40
+ const router = useQueryRoute();
41
+
42
+ return (
43
+ <>
44
+ <Flexbox align={'center'} className={styles.title} gap={4} horizontal>
45
+ <ActionIcon
46
+ color={theme.colorText}
47
+ icon={MenuIcon}
48
+ onClick={() => setOpen(true)}
49
+ size={{ blockSize: 32, fontSize: 18 }}
50
+ />
51
+ {activeItem?.label}
52
+ </Flexbox>
53
+
54
+ <Drawer
55
+ bodyStyle={{
56
+ display: 'flex',
57
+ flexDirection: 'column',
58
+ gap: 20,
59
+ justifyContent: 'space-between',
60
+ padding: 16,
61
+ }}
62
+ headerStyle={{ display: 'none' }}
63
+ onClick={() => setOpen(false)}
64
+ onClose={() => setOpen(false)}
65
+ open={open}
66
+ placement={'left'}
67
+ rootStyle={{ position: 'absolute' }}
68
+ style={{
69
+ background: theme.colorBgLayout,
70
+ borderRight: `1px solid ${theme.colorSplit}`,
71
+ paddingTop: 44,
72
+ }}
73
+ width={260}
74
+ zIndex={10}
75
+ >
76
+ <Menu
77
+ items={items}
78
+ onClick={({ key }) => {
79
+ if (key === DiscoverTab.Home) {
80
+ router.push('/discover');
81
+ } else {
82
+ router.push(urlJoin('/discover', key));
83
+ }
84
+ }}
85
+ selectable
86
+ selectedKeys={[activeKey]}
87
+ variant={'compact'}
88
+ />
89
+ </Drawer>
90
+ </>
91
+ );
92
+ });
93
+
94
+ export default Nav;
@@ -0,0 +1,27 @@
1
+ import { PropsWithChildren } from 'react';
2
+
3
+ import MobileContentLayout from '@/components/server/MobileNavLayout';
4
+ import Footer from '@/features/Setting/Footer';
5
+
6
+ import { SCROLL_PARENT_ID } from '../../../features/const';
7
+ import Header from './Header';
8
+
9
+ const Layout = ({ children }: PropsWithChildren) => {
10
+ return (
11
+ <MobileContentLayout
12
+ gap={16}
13
+ header={<Header />}
14
+ id={SCROLL_PARENT_ID}
15
+ style={{ paddingInline: 16, paddingTop: 8 }}
16
+ withNav
17
+ >
18
+ {children}
19
+ <div />
20
+ <Footer />
21
+ </MobileContentLayout>
22
+ );
23
+ };
24
+
25
+ Layout.displayName = 'MobileDiscoverLayout';
26
+
27
+ export default Layout;
@@ -0,0 +1,64 @@
1
+ import urlJoin from 'url-join';
2
+
3
+ import StructuredData from '@/components/StructuredData';
4
+ import { Locales } from '@/locales/resources';
5
+ import { ldModule } from '@/server/ld';
6
+ import { metadataModule } from '@/server/metadata';
7
+ import { DiscoverService } from '@/server/services/discover';
8
+ import { translation } from '@/server/translation';
9
+ import { AssistantCategory } from '@/types/discover';
10
+ import { isMobileDevice } from '@/utils/responsive';
11
+
12
+ import List from '../features/List';
13
+
14
+ type Props = { params: { slug: AssistantCategory }; searchParams: { hl?: Locales } };
15
+
16
+ export const generateMetadata = async ({ params, searchParams }: Props) => {
17
+ const { t, locale } = await translation('metadata', searchParams?.hl);
18
+ const { t: td } = await translation('discover', searchParams?.hl);
19
+
20
+ return metadataModule.generate({
21
+ alternate: true,
22
+ description: t('discover.assistants.description'),
23
+ locale,
24
+ title: [td(`category.assistant.${params.slug}`), t('discover.assistants.title')].join(' · '),
25
+ url: urlJoin('/discover/assistants', params.slug),
26
+ });
27
+ };
28
+
29
+ const Page = async ({ params, searchParams }: Props) => {
30
+ const { t, locale } = await translation('metadata', searchParams?.hl);
31
+ const { t: td } = await translation('discover', searchParams?.hl);
32
+ const mobile = isMobileDevice();
33
+
34
+ const discoverService = new DiscoverService();
35
+ const items = await discoverService.getAssistantCategory(locale, params.slug);
36
+
37
+ const ld = ldModule.generate({
38
+ description: t('discover.assistants.description'),
39
+ title: [td(`category.assistant.${params.slug}`), t('discover.assistants.title')].join(' · '),
40
+ url: urlJoin('/discover/assistants', params.slug),
41
+ webpage: {
42
+ enable: true,
43
+ search: '/discover/search',
44
+ },
45
+ });
46
+
47
+ return (
48
+ <>
49
+ <StructuredData ld={ld} />
50
+ <List category={params.slug} items={items} mobile={mobile} />
51
+ </>
52
+ );
53
+ };
54
+
55
+ export const generateStaticParams = async () => {
56
+ const cates = Object.values(AssistantCategory);
57
+ return cates.map((cate) => ({
58
+ slug: cate,
59
+ }));
60
+ };
61
+
62
+ Page.DisplayName = 'DiscoverAssistantsCategory';
63
+
64
+ export default Page;
@@ -0,0 +1,22 @@
1
+ import { PropsWithChildren } from 'react';
2
+ import { Flexbox } from 'react-layout-kit';
3
+
4
+ import CategoryContainer from '../../../components/CategoryContainer';
5
+ import Category from '../features/Category';
6
+
7
+ const Layout = ({ children }: PropsWithChildren) => {
8
+ return (
9
+ <Flexbox gap={24} horizontal style={{ position: 'relative' }} width={'100%'}>
10
+ <CategoryContainer>
11
+ <Category />
12
+ </CategoryContainer>
13
+ <Flexbox flex={1} gap={16}>
14
+ {children}
15
+ </Flexbox>
16
+ </Flexbox>
17
+ );
18
+ };
19
+
20
+ Layout.displayName = 'DesktopDiscoverAssistantsLayout';
21
+
22
+ export default Layout;
@@ -0,0 +1,9 @@
1
+ import { PropsWithChildren } from 'react';
2
+
3
+ const Layout = ({ children }: PropsWithChildren) => {
4
+ return children;
5
+ };
6
+
7
+ Layout.displayName = 'MobileDiscoverAssistantsLayout';
8
+
9
+ export default Layout;
@@ -0,0 +1,176 @@
1
+ import { Avatar, Tag } from '@lobehub/ui';
2
+ import { Skeleton, Typography } from 'antd';
3
+ import { createStyles } from 'antd-style';
4
+ import { startCase } from 'lodash-es';
5
+ import dynamic from 'next/dynamic';
6
+ import qs from 'query-string';
7
+ import { memo } from 'react';
8
+ import { Center, Flexbox, FlexboxProps } from 'react-layout-kit';
9
+ import urlJoin from 'url-join';
10
+
11
+ import { DiscoverAssistantItem } from '@/types/discover';
12
+
13
+ import CardBanner from '../../../components/CardBanner';
14
+ import GitHubAvatar from '../../../components/GitHubAvatar';
15
+ import { useCategoryItem } from '../../assistants/features/useCategory';
16
+
17
+ const Link = dynamic(() => import('next/link'), {
18
+ loading: () => <Skeleton.Button size={'small'} style={{ height: 22 }} />,
19
+ ssr: false,
20
+ });
21
+
22
+ const { Paragraph, Title } = Typography;
23
+
24
+ const useStyles = createStyles(({ css, token, isDarkMode }) => ({
25
+ banner: css`
26
+ opacity: ${isDarkMode ? 0.9 : 0.4};
27
+ `,
28
+ container: css`
29
+ cursor: pointer;
30
+
31
+ position: relative;
32
+
33
+ overflow: hidden;
34
+
35
+ height: 100%;
36
+ min-height: 162px;
37
+
38
+ background: ${token.colorBgContainer};
39
+ border-radius: ${token.borderRadiusLG}px;
40
+ box-shadow: 0 0 1px 1px ${isDarkMode ? token.colorFillQuaternary : token.colorFillSecondary}
41
+ inset;
42
+
43
+ transition: box-shadow 0.2s ${token.motionEaseInOut};
44
+
45
+ &:hover {
46
+ box-shadow: 0 0 1px 1px ${isDarkMode ? token.colorFillSecondary : token.colorFill} inset;
47
+ }
48
+ `,
49
+ desc: css`
50
+ min-height: 44px;
51
+ margin-block-end: 0 !important;
52
+ color: ${token.colorTextDescription};
53
+ `,
54
+
55
+ time: css`
56
+ color: ${token.colorTextDescription};
57
+ `,
58
+ title: css`
59
+ margin-block-end: 0 !important;
60
+ font-weight: bold;
61
+ `,
62
+ }));
63
+
64
+ export interface AssistantCardProps
65
+ extends Omit<DiscoverAssistantItem, 'suggestions' | 'socialData' | 'config'>,
66
+ Omit<FlexboxProps, 'children'> {
67
+ showCategory?: boolean;
68
+ variant?: 'default' | 'compact';
69
+ }
70
+
71
+ const AssistantCard = memo<AssistantCardProps>(
72
+ ({ showCategory, className, meta, createdAt, author, variant, ...rest }) => {
73
+ const { avatar, title, description, tags = [], category } = meta;
74
+ const { cx, styles, theme } = useStyles();
75
+ const categoryItem = useCategoryItem(category, 12);
76
+ const isCompact = variant === 'compact';
77
+
78
+ const user = (
79
+ <Flexbox
80
+ align={'center'}
81
+ gap={6}
82
+ horizontal
83
+ style={{ color: theme.colorTextSecondary, fontSize: 12 }}
84
+ >
85
+ <GitHubAvatar size={18} username={author} />
86
+ <span>{author}</span>
87
+ </Flexbox>
88
+ );
89
+
90
+ return (
91
+ <Flexbox className={cx(styles.container, className)} gap={24} {...rest}>
92
+ {!isCompact && <CardBanner avatar={avatar} />}
93
+ <Flexbox gap={12} padding={16}>
94
+ <Flexbox
95
+ align={isCompact ? 'flex-start' : 'flex-end'}
96
+ gap={16}
97
+ horizontal
98
+ justify={'space-between'}
99
+ style={{ position: 'relative' }}
100
+ width={'100%'}
101
+ >
102
+ <Flexbox
103
+ gap={8}
104
+ style={{ overflow: 'hidden', paddingTop: isCompact ? 4 : 0, position: 'relative' }}
105
+ >
106
+ <Title
107
+ className={styles.title}
108
+ ellipsis={{ rows: 1, tooltip: title }}
109
+ level={3}
110
+ style={{ fontSize: isCompact ? 16 : 18 }}
111
+ >
112
+ {title}
113
+ </Title>
114
+ {isCompact && user}
115
+ </Flexbox>
116
+ {isCompact ? (
117
+ <Avatar avatar={avatar} size={40} style={{ display: 'block' }} title={title} />
118
+ ) : (
119
+ <Center
120
+ flex={'none'}
121
+ height={64}
122
+ style={{
123
+ background: theme.colorBgContainer,
124
+ borderRadius: '50%',
125
+ marginTop: -6,
126
+ overflow: 'hidden',
127
+ zIndex: 2,
128
+ }}
129
+ width={64}
130
+ >
131
+ <Avatar avatar={avatar} size={56} style={{ display: 'block' }} title={title} />
132
+ </Center>
133
+ )}
134
+ </Flexbox>
135
+ {!isCompact && (
136
+ <Flexbox gap={8} horizontal style={{ fontSize: 12 }}>
137
+ {user}
138
+ <time className={styles.time} dateTime={new Date(createdAt).toISOString()}>
139
+ {createdAt}
140
+ </time>
141
+ </Flexbox>
142
+ )}
143
+ <Paragraph className={styles.desc} ellipsis={{ rows: 2 }}>
144
+ {description}
145
+ </Paragraph>
146
+ <Flexbox gap={6} horizontal style={{ flexWrap: 'wrap' }}>
147
+ {showCategory && categoryItem ? (
148
+ <Link href={urlJoin('/discover/assistants', categoryItem.key)}>
149
+ <Tag icon={categoryItem.icon} style={{ margin: 0 }}>
150
+ {categoryItem.label}
151
+ </Tag>
152
+ </Link>
153
+ ) : (
154
+ tags
155
+ .slice(0, 4)
156
+ .filter(Boolean)
157
+ .map((tag: string, index) => {
158
+ const url = qs.stringifyUrl({
159
+ query: { q: tag, type: 'assistants' },
160
+ url: '/discover/search',
161
+ });
162
+ return (
163
+ <Link href={url} key={index}>
164
+ <Tag style={{ margin: 0 }}>{startCase(tag).trim()}</Tag>
165
+ </Link>
166
+ );
167
+ })
168
+ )}
169
+ </Flexbox>
170
+ </Flexbox>
171
+ </Flexbox>
172
+ );
173
+ },
174
+ );
175
+
176
+ export default AssistantCard;
@@ -0,0 +1,48 @@
1
+ 'use client';
2
+
3
+ import Link from 'next/link';
4
+ import { usePathname } from 'next/navigation';
5
+ import { memo, useMemo } from 'react';
6
+ import urlJoin from 'url-join';
7
+
8
+ import { useQueryRoute } from '@/hooks/useQueryRoute';
9
+ import { AssistantCategory } from '@/types/discover';
10
+
11
+ import CategoryMenu from '../../../components/CategoryMenu';
12
+ import { useCategory } from './useCategory';
13
+
14
+ const Category = memo(() => {
15
+ const items = useCategory();
16
+ const pathname = usePathname();
17
+ const selectedKey = useMemo(() => {
18
+ if (pathname.includes('/discover/assistants/')) {
19
+ return pathname.split('/')[3]?.split('?')[0];
20
+ }
21
+ return 'all';
22
+ }, [pathname]);
23
+ const router = useQueryRoute();
24
+
25
+ return (
26
+ <CategoryMenu
27
+ items={items.map((item: any) => ({
28
+ ...item,
29
+ label: (
30
+ <Link
31
+ href={urlJoin(
32
+ '/discover/assistants',
33
+ item.key === AssistantCategory.All ? '' : item.key,
34
+ )}
35
+ >
36
+ {item.label}
37
+ </Link>
38
+ ),
39
+ }))}
40
+ onSelect={({ key }) => {
41
+ router.push(urlJoin('/discover/assistants', key === AssistantCategory.All ? '' : key));
42
+ }}
43
+ selectedKeys={[selectedKey || 'all']}
44
+ />
45
+ );
46
+ });
47
+
48
+ export default Category;