@lobehub/chat 1.17.6 → 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 (339) hide show
  1. package/CHANGELOG.md +58 -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/config/modelProviders/ollama.ts +0 -8
  252. package/src/const/discover.ts +63 -1
  253. package/src/features/Conversation/Error/PluginSettings.tsx +1 -1
  254. package/src/features/Conversation/Messages/Tool/Inspector/Settings.tsx +1 -1
  255. package/src/features/Conversation/components/InboxWelcome/AgentsSuggest.tsx +41 -24
  256. package/src/features/MobileTabBar/index.tsx +3 -3
  257. package/src/features/PluginDetailModal/APIs.tsx +1 -1
  258. package/src/features/PluginDevModal/UrlManifestForm.tsx +1 -1
  259. package/src/features/PluginStore/PluginItem/Action.tsx +1 -1
  260. package/src/features/PluginsUI/Render/DefaultType/index.tsx +1 -1
  261. package/src/features/PluginsUI/Render/StandaloneType/index.tsx +1 -1
  262. package/src/hooks/useInterceptingRoutes.ts +21 -1
  263. package/src/hooks/useShare.tsx +191 -0
  264. package/src/libs/agent-runtime/utils/streams/openai.test.ts +43 -0
  265. package/src/libs/agent-runtime/utils/streams/openai.ts +1 -1
  266. package/src/locales/create.ts +1 -1
  267. package/src/locales/default/common.ts +1 -1
  268. package/src/locales/default/discover.ts +205 -0
  269. package/src/locales/default/index.ts +6 -2
  270. package/src/locales/default/metadata.ts +23 -3
  271. package/src/locales/default/models.ts +15 -0
  272. package/src/locales/default/providers.ts +15 -0
  273. package/src/locales/default/welcome.ts +1 -1
  274. package/src/locales/resources.ts +2 -0
  275. package/src/server/ld.ts +85 -11
  276. package/src/server/metadata.ts +41 -3
  277. package/src/{app/api/market/AgentMarket.test.ts → server/modules/AssistantStore/index.test.ts} +15 -15
  278. package/src/{app/api/market/AgentMarket.ts → server/modules/AssistantStore/index.ts} +7 -3
  279. package/src/{app/api/plugin/store/Store.test.ts → server/modules/PluginStore/index.test.ts} +1 -1
  280. package/src/server/services/discover/index.ts +352 -0
  281. package/src/server/services/doc/index.tsx +40 -0
  282. package/src/server/translation.ts +11 -5
  283. package/src/services/__tests__/__snapshots__/tool.test.ts.snap +1 -1
  284. package/src/services/{_auth.test.ts → __tests__/_auth.test.ts} +1 -1
  285. package/src/services/__tests__/assistant.test.ts +82 -0
  286. package/src/services/__tests__/tool.test.ts +13 -13
  287. package/src/services/_url.ts +2 -2
  288. package/src/services/assistant.ts +30 -0
  289. package/src/services/chat.ts +1 -1
  290. package/src/services/tool.ts +7 -129
  291. package/src/store/chat/slices/plugin/action.test.ts +112 -0
  292. package/src/store/chat/slices/plugin/action.ts +1 -3
  293. package/src/store/global/initialState.ts +1 -1
  294. package/src/store/tool/selectors/tool.test.ts +1 -1
  295. package/src/store/tool/slices/customPlugin/action.test.ts +1 -1
  296. package/src/store/tool/slices/customPlugin/action.ts +1 -1
  297. package/src/store/tool/slices/plugin/action.ts +1 -1
  298. package/src/store/tool/slices/plugin/selectors.test.ts +3 -3
  299. package/src/store/tool/slices/plugin/selectors.ts +3 -3
  300. package/src/store/tool/slices/store/action.test.ts +16 -22
  301. package/src/store/tool/slices/store/action.ts +8 -8
  302. package/src/types/discover.ts +152 -0
  303. package/src/types/llm.ts +4 -2
  304. package/src/types/meta.ts +1 -0
  305. package/src/utils/format.test.ts +191 -112
  306. package/src/utils/format.ts +36 -0
  307. package/src/utils/toolManifest.ts +124 -0
  308. package/src/app/(main)/market/@detail/default.tsx +0 -12
  309. package/src/app/(main)/market/@detail/features/AgentDetailContent.tsx +0 -73
  310. package/src/app/(main)/market/@detail/features/Banner.tsx +0 -46
  311. package/src/app/(main)/market/@detail/features/Comment.tsx +0 -16
  312. package/src/app/(main)/market/@detail/features/Header.tsx +0 -81
  313. package/src/app/(main)/market/@detail/features/Loading.tsx +0 -63
  314. package/src/app/(main)/market/@detail/features/TokenTag.tsx +0 -27
  315. package/src/app/(main)/market/@detail/features/style.ts +0 -32
  316. package/src/app/(main)/market/_layout/Desktop/DetailSidebar.tsx +0 -84
  317. package/src/app/(main)/market/_layout/Desktop/Header.tsx +0 -29
  318. package/src/app/(main)/market/_layout/Desktop/Hero.tsx +0 -40
  319. package/src/app/(main)/market/_layout/Desktop/index.tsx +0 -46
  320. package/src/app/(main)/market/_layout/Mobile/DetailModal.tsx +0 -32
  321. package/src/app/(main)/market/_layout/Mobile/Header.tsx +0 -20
  322. package/src/app/(main)/market/_layout/Mobile/index.tsx +0 -25
  323. package/src/app/(main)/market/_layout/type.ts +0 -6
  324. package/src/app/(main)/market/features/AgentCard/index.tsx +0 -139
  325. package/src/app/(main)/market/features/AgentList.tsx +0 -103
  326. package/src/app/(main)/market/features/AgentSearchBar.tsx +0 -42
  327. package/src/app/(main)/market/features/TagList.tsx +0 -69
  328. package/src/app/(main)/market/loading.tsx +0 -15
  329. package/src/app/(main)/market/page.tsx +0 -44
  330. package/src/const/market.ts +0 -15
  331. package/src/locales/default/market.ts +0 -32
  332. package/src/services/market.ts +0 -22
  333. package/src/store/market/action.ts +0 -82
  334. package/src/store/market/index.ts +0 -3
  335. package/src/store/market/initialState.ts +0 -19
  336. package/src/store/market/selectors.ts +0 -38
  337. package/src/store/market/store.ts +0 -48
  338. package/src/types/market.ts +0 -20
  339. /package/src/{app/api/plugin/store/Store.ts → server/modules/PluginStore/index.ts} +0 -0
@@ -1,103 +0,0 @@
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-block-start: 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 || (!searchKeywords && agentList?.length === 0)) {
62
- return (
63
- <>
64
- <h2 className={styles.title}>{t('title.recentSubmits')}</h2>
65
- <Skeleton paragraph={{ rows: 8 }} title={false} />
66
- <h2 className={styles.title}>{t('title.allAgents')}</h2>
67
- <Skeleton paragraph={{ rows: 8 }} title={false} />
68
- </>
69
- );
70
- }
71
-
72
- if (searchKeywords) {
73
- if (agentList.length === 0) return <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />;
74
- return (
75
- <Grid rows={3}>
76
- {agentList.map((item) => (
77
- <GridCompactRender key={item.identifier} {...item} />
78
- ))}
79
- </Grid>
80
- );
81
- }
82
-
83
- return (
84
- <>
85
- <h2 className={styles.title}>{t('title.recentSubmits')}</h2>
86
- <Grid rows={3}>
87
- {agentList.slice(0, recentLength).map((item) => (
88
- <AgentCard key={item.identifier} {...item} />
89
- ))}
90
- </Grid>
91
- <h2 className={styles.title}>{t('title.allAgents')}</h2>
92
- <Grid rows={3}>
93
- {agentList.slice(recentLength).map((item) => (
94
- <GridCompactRender key={item.identifier} {...item} />
95
- ))}
96
- </Grid>
97
- </>
98
- );
99
- });
100
-
101
- AgentList.displayName = 'AgentList';
102
-
103
- export default AgentList;
@@ -1,42 +0,0 @@
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,69 +0,0 @@
1
- 'use client';
2
-
3
- import { Button, Skeleton } 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, isDarkMode }) => ({
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: ${isDarkMode ? token.colorBgContainer : token.colorFillTertiary};
24
- border: none;
25
-
26
- &:hover {
27
- background: ${isDarkMode ? token.colorBgElevated : token.colorFill} !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
- if (agentTagList?.length === 0) {
42
- return <Skeleton paragraph={{ rows: 4 }} title={false} />;
43
- }
44
-
45
- const list = md ? agentTagList : agentTagList.slice(0, 20);
46
-
47
- return (
48
- <Flexbox gap={6} horizontal style={{ flexWrap: 'wrap' }}>
49
- {list.map((item) => {
50
- const isActive = searchKeywords === item;
51
- return (
52
- <Button
53
- className={cx(styles.tag, isActive && styles.active)}
54
- key={item}
55
- onClick={() => {
56
- setSearchKeywords(isActive ? '' : item);
57
- }}
58
- shape={'round'}
59
- size={'small'}
60
- >
61
- {startCase(item)}
62
- </Button>
63
- );
64
- })}
65
- </Flexbox>
66
- );
67
- });
68
-
69
- export default TagList;
@@ -1,15 +0,0 @@
1
- 'use client';
2
-
3
- import { Skeleton } from 'antd';
4
- import { Flexbox } from 'react-layout-kit';
5
-
6
- export default () => (
7
- <Flexbox gap={16}>
8
- <Skeleton.Input active block />
9
- <Skeleton paragraph={{ rows: 8 }} style={{ marginBlock: 24 }} title={false} />
10
- <Skeleton.Button active />
11
- <Skeleton paragraph={{ rows: 8 }} style={{ marginBlock: 24 }} title={false} />
12
- <Skeleton.Button active />
13
- <Skeleton paragraph={{ rows: 8 }} style={{ marginBlock: 24 }} title={false} />
14
- </Flexbox>
15
- );
@@ -1,44 +0,0 @@
1
- import { Flexbox } from 'react-layout-kit';
2
-
3
- import StructuredData from '@/components/StructuredData';
4
- import { ldModule } from '@/server/ld';
5
- import { metadataModule } from '@/server/metadata';
6
- import { translation } from '@/server/translation';
7
- import { isMobileDevice } from '@/utils/responsive';
8
-
9
- import AgentList from './features/AgentList';
10
- import AgentSearchBar from './features/AgentSearchBar';
11
- import TagList from './features/TagList';
12
-
13
- export const generateMetadata = async () => {
14
- const { t } = await translation('metadata');
15
- return metadataModule.generate({
16
- description: t('market.description'),
17
- title: t('market.title'),
18
- url: '/market',
19
- });
20
- };
21
-
22
- const Page = async () => {
23
- const mobile = isMobileDevice();
24
- const { t } = await translation('metadata');
25
- const ld = ldModule.generate({
26
- description: t('market.description'),
27
- title: t('market.title'),
28
- url: '/market',
29
- });
30
- return (
31
- <>
32
- <StructuredData ld={ld} />
33
- <AgentSearchBar mobile={mobile} />
34
- <Flexbox gap={mobile ? 16 : 24}>
35
- <TagList />
36
- <AgentList mobile={mobile} />
37
- </Flexbox>
38
- </>
39
- );
40
- };
41
-
42
- Page.DisplayName = 'Market';
43
-
44
- export default Page;
@@ -1,15 +0,0 @@
1
- import { DEFAULT_AGENT_CONFIG } from '@/const/settings';
2
- import { AgentsMarketItem } from '@/types/market';
3
-
4
- import { DEFAULT_AGENT_META } from './meta';
5
-
6
- export const DEFAULT_AGENTS_MARKET_ITEM: AgentsMarketItem = {
7
- author: '',
8
- config: DEFAULT_AGENT_CONFIG,
9
- createAt: Date.now().toString(),
10
- homepage: '',
11
- identifier: '',
12
- manifest: '',
13
- meta: DEFAULT_AGENT_META,
14
- schemaVersion: 1,
15
- };
@@ -1,32 +0,0 @@
1
- export default {
2
- addAgent: '添加助手',
3
- addAgentAndConverse: '添加助手并会话',
4
- addAgentSuccess: '添加成功',
5
- guide: {
6
- func1: {
7
- desc1: '在会话窗口中通过右上角设置进入你想提交助手的设置页面;',
8
- desc2: '点击右上角提交到助手市场按钮。',
9
- tag: '方法一',
10
- title: '通过 {{appName}} 提交',
11
- },
12
- func2: {
13
- button: '前往 Github 助手仓库',
14
- desc: '如果您想将助手添加到索引中,请使用 agent-template.json 或 agent-template-full.json 在 plugins 目录中创建一个条目,编写简短的描述并适当标记,然后创建一个拉取请求。',
15
- tag: '方法二',
16
- title: '通过 Github 提交',
17
- },
18
- },
19
- search: {
20
- placeholder: '搜索助手名称介绍或关键词...',
21
- },
22
- sidebar: {
23
- comment: '讨论区',
24
- prompt: '提示词',
25
- title: '助手详情',
26
- },
27
- submitAgent: '提交助手',
28
- title: {
29
- allAgents: '全部助手',
30
- recentSubmits: '最近新增',
31
- },
32
- };
@@ -1,22 +0,0 @@
1
- import { LobeChatAgentsMarketIndex } from '@/types/market';
2
-
3
- import { API_ENDPOINTS } from './_url';
4
-
5
- class MarketService {
6
- getAgentList = async (locale: string): Promise<LobeChatAgentsMarketIndex> => {
7
- const res = await fetch(`${API_ENDPOINTS.market}?locale=${locale}`);
8
-
9
- return res.json();
10
- };
11
-
12
- /**
13
- * 请求助手 manifest
14
- */
15
- getAgentManifest = async (identifier: string, locale: string) => {
16
- if (!identifier) return;
17
- const res = await fetch(`${API_ENDPOINTS.marketItem(identifier)}?locale=${locale}`);
18
-
19
- return res.json();
20
- };
21
- }
22
- export const marketService = new MarketService();
@@ -1,82 +0,0 @@
1
- import isEqual from 'fast-deep-equal';
2
- import { produce } from 'immer';
3
- import useSWR, { SWRResponse } from 'swr';
4
- import type { StateCreator } from 'zustand/vanilla';
5
-
6
- import { marketService } from '@/services/market';
7
- import { globalHelpers } from '@/store/user/helpers';
8
- import { AgentsMarketItem, LobeChatAgentsMarketIndex } from '@/types/market';
9
-
10
- import type { Store } from './store';
11
-
12
- export interface StoreAction {
13
- activateAgent: (identifier: string) => void;
14
- deactivateAgent: () => void;
15
- getAgentById: (identifiers: string) => Promise<AgentsMarketItem>;
16
- setSearchKeywords: (keywords: string) => void;
17
- updateAgentMap: (key: string, value: AgentsMarketItem) => void;
18
- useFetchAgent: (identifier: string) => SWRResponse<AgentsMarketItem>;
19
- useFetchAgentList: () => SWRResponse<LobeChatAgentsMarketIndex>;
20
- }
21
-
22
- export const createMarketAction: StateCreator<
23
- Store,
24
- [['zustand/devtools', never]],
25
- [],
26
- StoreAction
27
- > = (set, get) => ({
28
- activateAgent: (identifier) => {
29
- set({ currentIdentifier: identifier });
30
- },
31
- deactivateAgent: () => {
32
- set({ currentIdentifier: '' }, false, 'deactivateAgent');
33
- },
34
-
35
- getAgentById: async (identifier) => {
36
- const locale = globalHelpers.getCurrentLanguage();
37
- return marketService.getAgentManifest(identifier, locale as string);
38
- },
39
-
40
- setSearchKeywords: (keywords) => {
41
- set({ searchKeywords: keywords });
42
- },
43
- updateAgentMap: (key, value) => {
44
- const { agentMap } = get();
45
-
46
- const nextAgentMap = produce(agentMap, (draft) => {
47
- draft[key] = value;
48
- });
49
-
50
- if (isEqual(nextAgentMap, agentMap)) return;
51
-
52
- set({ agentMap: nextAgentMap }, false, `setAgentMap/${key}`);
53
- },
54
- useFetchAgent: (identifier) =>
55
- useSWR<AgentsMarketItem>(
56
- [identifier, globalHelpers.getCurrentLanguage()],
57
- ([id, locale]) => marketService.getAgentManifest(id, locale as string),
58
- {
59
- onError: () => {
60
- get().deactivateAgent();
61
- },
62
- onSuccess: (data) => {
63
- get().updateAgentMap(identifier, data);
64
- },
65
- },
66
- ),
67
- useFetchAgentList: () =>
68
- useSWR<LobeChatAgentsMarketIndex>(
69
- globalHelpers.getCurrentLanguage(),
70
- marketService.getAgentList,
71
- {
72
- onSuccess: (agentMarketIndex) => {
73
- set(
74
- { agentList: agentMarketIndex.agents, tagList: agentMarketIndex.tags },
75
- false,
76
- 'useFetchAgentList',
77
- );
78
- },
79
- revalidateOnFocus: false,
80
- },
81
- ),
82
- });
@@ -1,3 +0,0 @@
1
- export { agentMarketSelectors } from './selectors';
2
- export { useMarketStore } from './store';
3
- export { type Store } from './store';
@@ -1,19 +0,0 @@
1
- import { AgentsMarketIndexItem, AgentsMarketItem } from '@/types/market';
2
-
3
- export type MarketAgentMap = Record<string, AgentsMarketItem>;
4
-
5
- export interface StoreState {
6
- agentList: AgentsMarketIndexItem[];
7
- agentMap: MarketAgentMap;
8
- currentIdentifier: string;
9
- searchKeywords: string;
10
- tagList: string[];
11
- }
12
-
13
- export const initialState: StoreState = {
14
- agentList: [],
15
- agentMap: {},
16
- currentIdentifier: '',
17
- searchKeywords: '',
18
- tagList: [],
19
- };
@@ -1,38 +0,0 @@
1
- import { DEFAULT_AGENTS_MARKET_ITEM } from '@/const/market';
2
- import { AgentsMarketItem } from '@/types/market';
3
-
4
- import type { Store } from './store';
5
-
6
- const getAgentList = (s: Store) => {
7
- const { searchKeywords, agentList } = s;
8
- if (!searchKeywords) return agentList;
9
- return agentList.filter(({ meta }) => {
10
- const checkMeta: string = [meta.tags, meta.title, meta.description, meta.avatar]
11
- .filter(Boolean)
12
- .join('');
13
- return checkMeta.toLowerCase().includes(searchKeywords.toLowerCase());
14
- });
15
- };
16
- const getAgentTagList = (s: Store) => s.tagList;
17
-
18
- const getAgentItemById = (d: string) => (s: Store) => s.agentMap[d];
19
-
20
- const currentAgentItem = (s: Store) => getAgentItemById(s.currentIdentifier)(s);
21
-
22
- const currentAgentItemSafe = (s: Store): AgentsMarketItem => {
23
- const item = getAgentItemById(s.currentIdentifier)(s);
24
- if (!item) return DEFAULT_AGENTS_MARKET_ITEM;
25
-
26
- return item;
27
- };
28
-
29
- const showSideBar = (s: Store) => !!s.currentIdentifier;
30
-
31
- export const agentMarketSelectors = {
32
- currentAgentItem,
33
- currentAgentItemSafe,
34
- getAgentItemById,
35
- getAgentList,
36
- getAgentTagList,
37
- showSideBar,
38
- };
@@ -1,48 +0,0 @@
1
- import { PersistOptions, persist } from 'zustand/middleware';
2
- import { shallow } from 'zustand/shallow';
3
- import { createWithEqualityFn } from 'zustand/traditional';
4
- import type { StateCreator } from 'zustand/vanilla';
5
-
6
- import { createHyperStorage } from '@/store/middleware/createHyperStorage';
7
-
8
- import { createDevtools } from '../middleware/createDevtools';
9
- import { type StoreAction, createMarketAction } from './action';
10
- import { type StoreState, initialState } from './initialState';
11
-
12
- export type Store = StoreAction & StoreState;
13
-
14
- const LOBE_AGENT_MARKET = 'LOBE_AGENT_MARKET';
15
-
16
- const persistOptions: PersistOptions<Store> = {
17
- name: LOBE_AGENT_MARKET,
18
-
19
- skipHydration: true,
20
-
21
- storage: createHyperStorage({
22
- localStorage: {
23
- dbName: 'LobeHub',
24
- selectors: ['agentMap'],
25
- },
26
- url: {
27
- mode: 'search',
28
- selectors: [
29
- // map state key to storage key
30
- { currentIdentifier: 'agent' },
31
- ],
32
- },
33
- }),
34
-
35
- version: 0,
36
- };
37
-
38
- const createStore: StateCreator<Store, [['zustand/devtools', never]]> = (...parameters) => ({
39
- ...initialState,
40
- ...createMarketAction(...parameters),
41
- });
42
-
43
- const devtools = createDevtools('market');
44
-
45
- export const useMarketStore = createWithEqualityFn<Store>()(
46
- persist(devtools(createStore), persistOptions),
47
- shallow,
48
- );
@@ -1,20 +0,0 @@
1
- import { MetaData } from '@/types/meta';
2
- import { LobeAgentSettings } from '@/types/session';
3
-
4
- export interface AgentsMarketIndexItem {
5
- author: string;
6
- createAt: string;
7
- homepage: string;
8
- identifier: string;
9
- manifest: string;
10
- meta: MetaData;
11
- schemaVersion: 1;
12
- }
13
-
14
- export type AgentsMarketItem = AgentsMarketIndexItem & LobeAgentSettings;
15
-
16
- export interface LobeChatAgentsMarketIndex {
17
- agents: AgentsMarketIndexItem[];
18
- schemaVersion: 1;
19
- tags: string[];
20
- }