@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.
- package/CHANGELOG.md +58 -0
- package/locales/ar/common.json +1 -1
- package/locales/ar/discover.json +204 -0
- package/locales/ar/metadata.json +20 -3
- package/locales/ar/models.json +845 -0
- package/locales/ar/providers.json +80 -0
- package/locales/bg-BG/common.json +1 -1
- package/locales/bg-BG/discover.json +204 -0
- package/locales/bg-BG/metadata.json +20 -3
- package/locales/bg-BG/models.json +845 -0
- package/locales/bg-BG/providers.json +80 -0
- package/locales/de-DE/common.json +1 -1
- package/locales/de-DE/discover.json +204 -0
- package/locales/de-DE/metadata.json +20 -3
- package/locales/de-DE/models.json +845 -0
- package/locales/de-DE/providers.json +80 -0
- package/locales/en-US/common.json +1 -1
- package/locales/en-US/discover.json +204 -0
- package/locales/en-US/metadata.json +20 -3
- package/locales/en-US/models.json +845 -0
- package/locales/en-US/providers.json +80 -0
- package/locales/es-ES/common.json +1 -1
- package/locales/es-ES/discover.json +204 -0
- package/locales/es-ES/metadata.json +20 -3
- package/locales/es-ES/models.json +845 -0
- package/locales/es-ES/providers.json +80 -0
- package/locales/fr-FR/common.json +1 -1
- package/locales/fr-FR/discover.json +204 -0
- package/locales/fr-FR/metadata.json +20 -3
- package/locales/fr-FR/models.json +845 -0
- package/locales/fr-FR/providers.json +80 -0
- package/locales/it-IT/common.json +1 -1
- package/locales/it-IT/discover.json +204 -0
- package/locales/it-IT/metadata.json +20 -3
- package/locales/it-IT/models.json +845 -0
- package/locales/it-IT/providers.json +80 -0
- package/locales/ja-JP/common.json +1 -1
- package/locales/ja-JP/discover.json +204 -0
- package/locales/ja-JP/metadata.json +20 -3
- package/locales/ja-JP/models.json +845 -0
- package/locales/ja-JP/providers.json +80 -0
- package/locales/ko-KR/common.json +1 -1
- package/locales/ko-KR/discover.json +204 -0
- package/locales/ko-KR/metadata.json +20 -3
- package/locales/ko-KR/models.json +845 -0
- package/locales/ko-KR/providers.json +80 -0
- package/locales/nl-NL/common.json +1 -1
- package/locales/nl-NL/discover.json +204 -0
- package/locales/nl-NL/metadata.json +20 -3
- package/locales/nl-NL/models.json +845 -0
- package/locales/nl-NL/providers.json +80 -0
- package/locales/pl-PL/common.json +1 -1
- package/locales/pl-PL/discover.json +204 -0
- package/locales/pl-PL/metadata.json +20 -3
- package/locales/pl-PL/models.json +845 -0
- package/locales/pl-PL/providers.json +80 -0
- package/locales/pt-BR/common.json +1 -1
- package/locales/pt-BR/discover.json +204 -0
- package/locales/pt-BR/metadata.json +20 -3
- package/locales/pt-BR/models.json +845 -0
- package/locales/pt-BR/providers.json +80 -0
- package/locales/ru-RU/common.json +1 -1
- package/locales/ru-RU/discover.json +204 -0
- package/locales/ru-RU/metadata.json +20 -3
- package/locales/ru-RU/models.json +845 -0
- package/locales/ru-RU/providers.json +80 -0
- package/locales/tr-TR/common.json +1 -1
- package/locales/tr-TR/discover.json +204 -0
- package/locales/tr-TR/metadata.json +20 -3
- package/locales/tr-TR/models.json +845 -0
- package/locales/tr-TR/providers.json +80 -0
- package/locales/vi-VN/common.json +1 -1
- package/locales/vi-VN/discover.json +204 -0
- package/locales/vi-VN/metadata.json +20 -3
- package/locales/vi-VN/models.json +845 -0
- package/locales/vi-VN/providers.json +80 -0
- package/locales/zh-CN/common.json +1 -1
- package/locales/zh-CN/discover.json +204 -0
- package/locales/zh-CN/metadata.json +20 -3
- package/locales/zh-CN/models.json +845 -0
- package/locales/zh-CN/providers.json +80 -0
- package/locales/zh-CN/welcome.json +1 -1
- package/locales/zh-TW/common.json +1 -1
- package/locales/zh-TW/discover.json +204 -0
- package/locales/zh-TW/metadata.json +20 -3
- package/locales/zh-TW/models.json +845 -0
- package/locales/zh-TW/providers.json +80 -0
- package/package.json +3 -2
- package/src/app/(main)/@nav/_layout/Desktop/TopActions.test.tsx +3 -3
- package/src/app/(main)/@nav/_layout/Desktop/TopActions.tsx +3 -3
- package/src/app/(main)/@nav/_layout/Mobile.tsx +3 -3
- package/src/app/(main)/_layout/Mobile.tsx +9 -1
- package/src/app/(main)/discover/(detail)/_layout/Desktop.tsx +24 -0
- package/src/app/(main)/discover/(detail)/_layout/Mobile/Header.tsx +25 -0
- package/src/app/(main)/discover/(detail)/_layout/Mobile/index.tsx +17 -0
- package/src/app/(main)/discover/(detail)/assistant/[slug]/features/Actions.tsx +35 -0
- package/src/app/(main)/discover/(detail)/assistant/[slug]/features/AddAgent.tsx +86 -0
- package/src/app/(main)/discover/(detail)/assistant/[slug]/features/ConversationExample/TopicList.tsx +74 -0
- package/src/app/(main)/discover/(detail)/assistant/[slug]/features/ConversationExample/index.tsx +100 -0
- package/src/app/(main)/discover/(detail)/assistant/[slug]/features/Header.tsx +118 -0
- package/src/app/(main)/discover/(detail)/assistant/[slug]/features/InfoSidebar/SuggestionItem.tsx +62 -0
- package/src/app/(main)/discover/(detail)/assistant/[slug]/features/InfoSidebar/ToolItem.tsx +19 -0
- package/src/app/(main)/discover/(detail)/assistant/[slug]/features/InfoSidebar/index.tsx +64 -0
- package/src/app/(main)/discover/(detail)/assistant/[slug]/features/SystemRole.tsx +35 -0
- package/src/app/(main)/discover/(detail)/assistant/[slug]/features/Temp.tsx +44 -0
- package/src/app/(main)/discover/(detail)/assistant/[slug]/page.tsx +121 -0
- package/src/app/(main)/discover/(detail)/error.tsx +5 -0
- package/src/app/(main)/discover/(detail)/features/Back.tsx +42 -0
- package/src/app/(main)/discover/(detail)/features/Block.tsx +50 -0
- package/src/app/(main)/discover/(detail)/features/DetailLayout.tsx +91 -0
- package/src/app/(main)/discover/(detail)/features/HighlightBlock.tsx +82 -0
- package/src/app/(main)/discover/(detail)/features/ShareButton.tsx +160 -0
- package/src/app/(main)/discover/(detail)/features/SidebarContainer.tsx +19 -0
- package/src/app/(main)/discover/(detail)/layout.tsx +12 -0
- package/src/app/(main)/discover/(detail)/loading.tsx +38 -0
- package/src/app/(main)/discover/(detail)/model/[...slugs]/features/Actions.tsx +46 -0
- package/src/app/(main)/discover/(detail)/model/[...slugs]/features/ChatWithModel.tsx +93 -0
- package/src/app/(main)/discover/(detail)/model/[...slugs]/features/Header.tsx +85 -0
- package/src/app/(main)/discover/(detail)/model/[...slugs]/features/InfoSidebar/SuggestionItem.tsx +75 -0
- package/src/app/(main)/discover/(detail)/model/[...slugs]/features/InfoSidebar/index.tsx +49 -0
- package/src/app/(main)/discover/(detail)/model/[...slugs]/features/ParameterList/ParameterItem.tsx +71 -0
- package/src/app/(main)/discover/(detail)/model/[...slugs]/features/ParameterList/index.tsx +110 -0
- package/src/app/(main)/discover/(detail)/model/[...slugs]/features/ProviderList/ProviderItem.tsx +152 -0
- package/src/app/(main)/discover/(detail)/model/[...slugs]/features/ProviderList/index.tsx +45 -0
- package/src/app/(main)/discover/(detail)/model/[...slugs]/page.tsx +114 -0
- package/src/app/(main)/discover/(detail)/not-found.tsx +3 -0
- package/src/app/(main)/discover/(detail)/plugin/[slug]/features/Actions.tsx +35 -0
- package/src/app/(main)/discover/(detail)/plugin/[slug]/features/Header.tsx +114 -0
- package/src/app/(main)/discover/(detail)/plugin/[slug]/features/InfoSidebar/SuggestionItem.tsx +62 -0
- package/src/app/(main)/discover/(detail)/plugin/[slug]/features/InfoSidebar/index.tsx +49 -0
- package/src/app/(main)/discover/(detail)/plugin/[slug]/features/InstallPlugin.tsx +87 -0
- package/src/app/(main)/discover/(detail)/plugin/[slug]/features/ParameterList.tsx +95 -0
- package/src/app/(main)/discover/(detail)/plugin/[slug]/features/Schema.tsx +23 -0
- package/src/app/(main)/discover/(detail)/plugin/[slug]/page.tsx +103 -0
- package/src/app/(main)/discover/(detail)/provider/[slug]/features/Actions.tsx +49 -0
- package/src/app/(main)/discover/(detail)/provider/[slug]/features/Header.tsx +73 -0
- package/src/app/(main)/discover/(detail)/provider/[slug]/features/InfoSidebar/SuggestionItem.tsx +75 -0
- package/src/app/(main)/discover/(detail)/provider/[slug]/features/InfoSidebar/index.tsx +49 -0
- package/src/app/(main)/discover/(detail)/provider/[slug]/features/ModelList/ModelItem.tsx +148 -0
- package/src/app/(main)/discover/(detail)/provider/[slug]/features/ModelList/index.tsx +60 -0
- package/src/app/(main)/discover/(detail)/provider/[slug]/features/ProviderConfig.tsx +80 -0
- package/src/app/(main)/discover/(detail)/provider/[slug]/page.tsx +116 -0
- package/src/app/(main)/discover/(list)/(home)/Client.tsx +42 -0
- package/src/app/(main)/discover/(list)/(home)/features/AssistantList.tsx +33 -0
- package/src/app/(main)/discover/(list)/(home)/features/ModelList.tsx +22 -0
- package/src/app/(main)/discover/(list)/(home)/features/PluginList.tsx +25 -0
- package/src/app/(main)/discover/(list)/(home)/loading.tsx +1 -0
- package/src/app/(main)/discover/(list)/(home)/page.tsx +54 -0
- package/src/app/(main)/discover/(list)/_layout/Desktop/Nav.tsx +118 -0
- package/src/app/(main)/discover/(list)/_layout/Desktop/index.tsx +37 -0
- package/src/app/(main)/discover/(list)/_layout/Desktop/useScroll.ts +33 -0
- package/src/app/(main)/discover/(list)/_layout/Mobile/Header.tsx +62 -0
- package/src/app/(main)/discover/(list)/_layout/Mobile/Nav.tsx +94 -0
- package/src/app/(main)/discover/(list)/_layout/Mobile/index.tsx +27 -0
- package/src/app/(main)/discover/(list)/assistants/[slug]/page.tsx +64 -0
- package/src/app/(main)/discover/(list)/assistants/_layout/Desktop.tsx +22 -0
- package/src/app/(main)/discover/(list)/assistants/_layout/Mobile.tsx +9 -0
- package/src/app/(main)/discover/(list)/assistants/features/Card.tsx +176 -0
- package/src/app/(main)/discover/(list)/assistants/features/Category.tsx +48 -0
- package/src/app/(main)/discover/(list)/assistants/features/List.tsx +97 -0
- package/src/app/(main)/discover/(list)/assistants/features/useCategory.tsx +116 -0
- package/src/app/(main)/discover/(list)/assistants/layout.tsx +12 -0
- package/src/app/(main)/discover/(list)/assistants/loading.tsx +1 -0
- package/src/app/(main)/discover/(list)/assistants/page.tsx +51 -0
- package/src/app/(main)/discover/(list)/error.tsx +5 -0
- package/src/app/(main)/{market → discover/(list)}/layout.tsx +4 -3
- package/src/app/(main)/discover/(list)/loading.tsx +39 -0
- package/src/app/(main)/discover/(list)/models/[slug]/page.tsx +70 -0
- package/src/app/(main)/discover/(list)/models/_layout/Desktop.tsx +28 -0
- package/src/app/(main)/discover/(list)/models/_layout/Mobile.tsx +9 -0
- package/src/app/(main)/discover/(list)/models/features/Card.tsx +116 -0
- package/src/app/(main)/discover/(list)/models/features/Category.tsx +67 -0
- package/src/app/(main)/discover/(list)/models/features/List.tsx +72 -0
- package/src/app/(main)/discover/(list)/models/features/const.ts +9 -0
- package/src/app/(main)/discover/(list)/models/layout.tsx +12 -0
- package/src/app/(main)/discover/(list)/models/loading.tsx +1 -0
- package/src/app/(main)/discover/(list)/models/page.tsx +61 -0
- package/src/app/(main)/discover/(list)/not-found.tsx +3 -0
- package/src/app/(main)/discover/(list)/plugins/[slug]/page.tsx +64 -0
- package/src/app/(main)/discover/(list)/plugins/_layout/Desktop.tsx +22 -0
- package/src/app/(main)/discover/(list)/plugins/_layout/Mobile.tsx +9 -0
- package/src/app/(main)/discover/(list)/plugins/features/Card.tsx +154 -0
- package/src/app/(main)/discover/(list)/plugins/features/Category.tsx +45 -0
- package/src/app/(main)/discover/(list)/plugins/features/List.tsx +96 -0
- package/src/app/(main)/discover/(list)/plugins/features/useCategory.tsx +80 -0
- package/src/app/(main)/discover/(list)/plugins/layout.tsx +12 -0
- package/src/app/(main)/discover/(list)/plugins/loading.tsx +1 -0
- package/src/app/(main)/discover/(list)/plugins/page.tsx +52 -0
- package/src/app/(main)/discover/(list)/providers/features/Card.tsx +117 -0
- package/src/app/(main)/discover/(list)/providers/features/List.tsx +71 -0
- package/src/app/(main)/discover/(list)/providers/loading.tsx +1 -0
- package/src/app/(main)/discover/(list)/providers/page.tsx +52 -0
- package/src/app/(main)/discover/_layout/Desktop/Header.tsx +36 -0
- package/src/app/(main)/discover/_layout/Desktop/index.tsx +21 -0
- package/src/app/(main)/discover/_layout/Mobile/index.tsx +9 -0
- package/src/app/(main)/{market/features/AgentCard/AgentCardBanner.tsx → discover/components/CardBanner.tsx} +5 -5
- package/src/app/(main)/discover/components/CategoryContainer.tsx +18 -0
- package/src/app/(main)/discover/components/CategoryMenu.tsx +39 -0
- package/src/app/(main)/discover/components/GitHubAvatar.tsx +19 -0
- package/src/app/(main)/discover/components/GridLoadingCard.tsx +69 -0
- package/src/app/(main)/discover/components/ListLoading.tsx +66 -0
- package/src/app/(main)/discover/components/Loading.tsx +17 -0
- package/src/app/(main)/discover/components/SearchResultCount.tsx +37 -0
- package/src/app/(main)/discover/components/Statistic.tsx +92 -0
- package/src/app/(main)/discover/components/Title.tsx +76 -0
- package/src/app/(main)/discover/components/VirtuosoGridList/index.tsx +52 -0
- package/src/app/(main)/discover/components/VirtuosoGridList/useScrollParent.ts +19 -0
- package/src/app/(main)/discover/error.tsx +5 -0
- package/src/app/(main)/{market/features/ShareAgentButton → discover/features/CreateButton}/Inner.tsx +9 -10
- package/src/app/(main)/{market/features/ShareAgentButton → discover/features/CreateButton}/index.tsx +9 -9
- package/src/app/(main)/discover/features/LikeButton.tsx +73 -0
- package/src/app/(main)/discover/features/ModelFeatureTags.tsx +77 -0
- package/src/app/(main)/discover/features/StoreSearchBar.tsx +84 -0
- package/src/app/(main)/discover/features/const.ts +2 -0
- package/src/app/(main)/discover/features/useNav.tsx +71 -0
- package/src/app/(main)/discover/layout.tsx +12 -0
- package/src/app/(main)/discover/loading.tsx +9 -0
- package/src/app/(main)/discover/not-found.tsx +3 -0
- package/src/app/(main)/discover/search/_layout/Desktop.tsx +42 -0
- package/src/app/(main)/discover/search/_layout/Mobile/Header.tsx +31 -0
- package/src/app/(main)/discover/search/_layout/Mobile/Nav.tsx +56 -0
- package/src/app/(main)/discover/search/_layout/Mobile/index.tsx +32 -0
- package/src/app/(main)/discover/search/features/AssistantsResult.tsx +27 -0
- package/src/app/(main)/discover/search/features/Category.tsx +41 -0
- package/src/app/(main)/discover/search/features/ModelsResult.tsx +27 -0
- package/src/app/(main)/discover/search/features/PluginsResult.tsx +27 -0
- package/src/app/(main)/discover/search/features/ProvidersResult.tsx +26 -0
- package/src/app/(main)/discover/search/layout.tsx +12 -0
- package/src/app/(main)/discover/search/loading.tsx +1 -0
- package/src/app/(main)/discover/search/page.tsx +78 -0
- package/src/app/(main)/settings/llm/components/ProviderConfig/index.tsx +0 -6
- package/src/app/(main)/welcome/features/Actions.tsx +1 -1
- package/src/app/@modal/(.)discover/assistant/[slug]/page.tsx +1 -0
- package/src/app/@modal/(.)discover/layout.tsx +29 -0
- package/src/app/@modal/(.)discover/loading.tsx +3 -0
- package/src/app/@modal/(.)discover/model/[...slugs]/page.tsx +1 -0
- package/src/app/@modal/(.)discover/plugin/[slug]/page.tsx +1 -0
- package/src/app/@modal/(.)discover/provider/[slug]/page.tsx +1 -0
- package/src/app/@modal/features/InterceptingContext.tsx +9 -0
- package/src/app/@modal/layout.tsx +58 -21
- package/src/app/api/{market → assistant}/[id]/route.ts +2 -3
- package/src/app/api/{market → assistant/store}/route.ts +2 -5
- package/src/app/api/plugin/store/route.ts +1 -4
- package/src/app/metadata.ts +3 -0
- package/src/app/redirect/page.tsx +15 -0
- package/src/components/FetchErrorNotification/Description.tsx +2 -0
- package/src/components/InterceptingLink/index.tsx +27 -0
- package/src/components/mdx/CodeBlock.tsx +46 -0
- package/src/components/mdx/Link.tsx +21 -0
- package/src/components/mdx/index.tsx +51 -0
- package/src/config/modelProviders/ollama.ts +0 -8
- package/src/const/discover.ts +63 -1
- package/src/features/Conversation/Error/PluginSettings.tsx +1 -1
- package/src/features/Conversation/Messages/Tool/Inspector/Settings.tsx +1 -1
- package/src/features/Conversation/components/InboxWelcome/AgentsSuggest.tsx +41 -24
- package/src/features/MobileTabBar/index.tsx +3 -3
- package/src/features/PluginDetailModal/APIs.tsx +1 -1
- package/src/features/PluginDevModal/UrlManifestForm.tsx +1 -1
- package/src/features/PluginStore/PluginItem/Action.tsx +1 -1
- package/src/features/PluginsUI/Render/DefaultType/index.tsx +1 -1
- package/src/features/PluginsUI/Render/StandaloneType/index.tsx +1 -1
- package/src/hooks/useInterceptingRoutes.ts +21 -1
- package/src/hooks/useShare.tsx +191 -0
- package/src/libs/agent-runtime/utils/streams/openai.test.ts +43 -0
- package/src/libs/agent-runtime/utils/streams/openai.ts +1 -1
- package/src/locales/create.ts +1 -1
- package/src/locales/default/common.ts +1 -1
- package/src/locales/default/discover.ts +205 -0
- package/src/locales/default/index.ts +6 -2
- package/src/locales/default/metadata.ts +23 -3
- package/src/locales/default/models.ts +15 -0
- package/src/locales/default/providers.ts +15 -0
- package/src/locales/default/welcome.ts +1 -1
- package/src/locales/resources.ts +2 -0
- package/src/server/ld.ts +85 -11
- package/src/server/metadata.ts +41 -3
- package/src/{app/api/market/AgentMarket.test.ts → server/modules/AssistantStore/index.test.ts} +15 -15
- package/src/{app/api/market/AgentMarket.ts → server/modules/AssistantStore/index.ts} +7 -3
- package/src/{app/api/plugin/store/Store.test.ts → server/modules/PluginStore/index.test.ts} +1 -1
- package/src/server/services/discover/index.ts +352 -0
- package/src/server/services/doc/index.tsx +40 -0
- package/src/server/translation.ts +11 -5
- package/src/services/__tests__/__snapshots__/tool.test.ts.snap +1 -1
- package/src/services/{_auth.test.ts → __tests__/_auth.test.ts} +1 -1
- package/src/services/__tests__/assistant.test.ts +82 -0
- package/src/services/__tests__/tool.test.ts +13 -13
- package/src/services/_url.ts +2 -2
- package/src/services/assistant.ts +30 -0
- package/src/services/chat.ts +1 -1
- package/src/services/tool.ts +7 -129
- package/src/store/chat/slices/plugin/action.test.ts +112 -0
- package/src/store/chat/slices/plugin/action.ts +1 -3
- package/src/store/global/initialState.ts +1 -1
- package/src/store/tool/selectors/tool.test.ts +1 -1
- package/src/store/tool/slices/customPlugin/action.test.ts +1 -1
- package/src/store/tool/slices/customPlugin/action.ts +1 -1
- package/src/store/tool/slices/plugin/action.ts +1 -1
- package/src/store/tool/slices/plugin/selectors.test.ts +3 -3
- package/src/store/tool/slices/plugin/selectors.ts +3 -3
- package/src/store/tool/slices/store/action.test.ts +16 -22
- package/src/store/tool/slices/store/action.ts +8 -8
- package/src/types/discover.ts +152 -0
- package/src/types/llm.ts +4 -2
- package/src/types/meta.ts +1 -0
- package/src/utils/format.test.ts +191 -112
- package/src/utils/format.ts +36 -0
- package/src/utils/toolManifest.ts +124 -0
- package/src/app/(main)/market/@detail/default.tsx +0 -12
- package/src/app/(main)/market/@detail/features/AgentDetailContent.tsx +0 -73
- package/src/app/(main)/market/@detail/features/Banner.tsx +0 -46
- package/src/app/(main)/market/@detail/features/Comment.tsx +0 -16
- package/src/app/(main)/market/@detail/features/Header.tsx +0 -81
- package/src/app/(main)/market/@detail/features/Loading.tsx +0 -63
- package/src/app/(main)/market/@detail/features/TokenTag.tsx +0 -27
- package/src/app/(main)/market/@detail/features/style.ts +0 -32
- package/src/app/(main)/market/_layout/Desktop/DetailSidebar.tsx +0 -84
- package/src/app/(main)/market/_layout/Desktop/Header.tsx +0 -29
- package/src/app/(main)/market/_layout/Desktop/Hero.tsx +0 -40
- package/src/app/(main)/market/_layout/Desktop/index.tsx +0 -46
- package/src/app/(main)/market/_layout/Mobile/DetailModal.tsx +0 -32
- package/src/app/(main)/market/_layout/Mobile/Header.tsx +0 -20
- package/src/app/(main)/market/_layout/Mobile/index.tsx +0 -25
- package/src/app/(main)/market/_layout/type.ts +0 -6
- package/src/app/(main)/market/features/AgentCard/index.tsx +0 -139
- package/src/app/(main)/market/features/AgentList.tsx +0 -103
- package/src/app/(main)/market/features/AgentSearchBar.tsx +0 -42
- package/src/app/(main)/market/features/TagList.tsx +0 -69
- package/src/app/(main)/market/loading.tsx +0 -15
- package/src/app/(main)/market/page.tsx +0 -44
- package/src/const/market.ts +0 -15
- package/src/locales/default/market.ts +0 -32
- package/src/services/market.ts +0 -22
- package/src/store/market/action.ts +0 -82
- package/src/store/market/index.ts +0 -3
- package/src/store/market/initialState.ts +0 -19
- package/src/store/market/selectors.ts +0 -38
- package/src/store/market/store.ts +0 -48
- package/src/types/market.ts +0 -20
- /package/src/{app/api/plugin/store/Store.ts → server/modules/PluginStore/index.ts} +0 -0
@@ -0,0 +1,110 @@
|
|
1
|
+
'use client';
|
2
|
+
|
3
|
+
import { Collapse, Icon, Tag } from '@lobehub/ui';
|
4
|
+
import {
|
5
|
+
ChartColumnBig,
|
6
|
+
Delete,
|
7
|
+
FileMinus,
|
8
|
+
LucideIcon,
|
9
|
+
MessageSquareText,
|
10
|
+
Thermometer,
|
11
|
+
} from 'lucide-react';
|
12
|
+
import { memo } from 'react';
|
13
|
+
import { useTranslation } from 'react-i18next';
|
14
|
+
import { Flexbox } from 'react-layout-kit';
|
15
|
+
|
16
|
+
import { DiscoverModelItem } from '@/types/discover';
|
17
|
+
import { formatTokenNumber } from '@/utils/format';
|
18
|
+
|
19
|
+
import Block from '../../../../features/Block';
|
20
|
+
import ParameterItem from './ParameterItem';
|
21
|
+
|
22
|
+
interface ParameterListProps {
|
23
|
+
data: DiscoverModelItem;
|
24
|
+
identifier: string;
|
25
|
+
}
|
26
|
+
|
27
|
+
interface Parameter {
|
28
|
+
defaultValue: string | number;
|
29
|
+
desc: string;
|
30
|
+
icon: LucideIcon;
|
31
|
+
key: string;
|
32
|
+
label: string;
|
33
|
+
range?: (string | number)[];
|
34
|
+
type: string;
|
35
|
+
}
|
36
|
+
|
37
|
+
const ParameterList = memo<ParameterListProps>(({ data }) => {
|
38
|
+
const { t } = useTranslation('discover');
|
39
|
+
|
40
|
+
const items: Parameter[] = [
|
41
|
+
{
|
42
|
+
defaultValue: 1,
|
43
|
+
desc: t('models.parameterList.temperature.desc'),
|
44
|
+
icon: Thermometer,
|
45
|
+
key: 'temperature',
|
46
|
+
label: t('models.parameterList.temperature.title'),
|
47
|
+
range: [0, 2],
|
48
|
+
type: 'float',
|
49
|
+
},
|
50
|
+
{
|
51
|
+
defaultValue: 1,
|
52
|
+
desc: t('models.parameterList.top_p.desc'),
|
53
|
+
icon: ChartColumnBig,
|
54
|
+
key: 'top_p',
|
55
|
+
label: t('models.parameterList.top_p.title'),
|
56
|
+
range: [0, 1],
|
57
|
+
type: 'float',
|
58
|
+
},
|
59
|
+
{
|
60
|
+
defaultValue: 0,
|
61
|
+
desc: t('models.parameterList.presence_penalty.desc'),
|
62
|
+
icon: Delete,
|
63
|
+
key: 'presence_penalty',
|
64
|
+
label: t('models.parameterList.presence_penalty.title'),
|
65
|
+
range: [-2, 2],
|
66
|
+
type: 'float',
|
67
|
+
},
|
68
|
+
{
|
69
|
+
defaultValue: 0,
|
70
|
+
desc: t('models.parameterList.frequency_penalty.desc'),
|
71
|
+
icon: FileMinus,
|
72
|
+
key: 'frequency_penalty',
|
73
|
+
label: t('models.parameterList.frequency_penalty.title'),
|
74
|
+
range: [-2, 2],
|
75
|
+
type: 'float',
|
76
|
+
},
|
77
|
+
{
|
78
|
+
defaultValue: '--',
|
79
|
+
desc: t('models.parameterList.max_tokens.desc'),
|
80
|
+
icon: MessageSquareText,
|
81
|
+
key: 'max_tokens',
|
82
|
+
label: t('models.parameterList.max_tokens.title'),
|
83
|
+
range: data?.meta?.maxOutput ? [0, formatTokenNumber(data.meta.maxOutput)] : undefined,
|
84
|
+
type: 'int',
|
85
|
+
},
|
86
|
+
];
|
87
|
+
|
88
|
+
return (
|
89
|
+
<Block title={t('models.parameterList.title')}>
|
90
|
+
<Collapse
|
91
|
+
defaultActiveKey={items.map((item) => item.key)}
|
92
|
+
expandIconPosition={'right'}
|
93
|
+
gap={16}
|
94
|
+
items={items.map((item) => ({
|
95
|
+
children: <ParameterItem {...item} />,
|
96
|
+
key: item.key,
|
97
|
+
label: (
|
98
|
+
<Flexbox align={'center'} gap={8} horizontal>
|
99
|
+
<Icon icon={item.icon} size={{ fontSize: 16 }} />
|
100
|
+
{item.label}
|
101
|
+
<Tag>{item.key}</Tag>
|
102
|
+
</Flexbox>
|
103
|
+
),
|
104
|
+
}))}
|
105
|
+
/>
|
106
|
+
</Block>
|
107
|
+
);
|
108
|
+
});
|
109
|
+
|
110
|
+
export default ParameterList;
|
package/src/app/(main)/discover/(detail)/model/[...slugs]/features/ProviderList/ProviderItem.tsx
ADDED
@@ -0,0 +1,152 @@
|
|
1
|
+
import { ModelTag, ProviderCombine } from '@lobehub/icons';
|
2
|
+
import { ActionIcon, Grid, Icon, Tooltip } from '@lobehub/ui';
|
3
|
+
import { Tag } from 'antd';
|
4
|
+
import { createStyles } from 'antd-style';
|
5
|
+
import { BadgeCheck, BookIcon, ChevronRightIcon, KeyIcon } from 'lucide-react';
|
6
|
+
import Link from 'next/link';
|
7
|
+
import { memo, useMemo } from 'react';
|
8
|
+
import { useTranslation } from 'react-i18next';
|
9
|
+
import { Flexbox } from 'react-layout-kit';
|
10
|
+
import urlJoin from 'url-join';
|
11
|
+
|
12
|
+
import InterceptingLink from '@/components/InterceptingLink';
|
13
|
+
import { DEFAULT_MODEL_PROVIDER_LIST } from '@/config/modelProviders';
|
14
|
+
import { BASE_PROVIDER_DOC_URL } from '@/const/url';
|
15
|
+
import { DiscoverProviderItem } from '@/types/discover';
|
16
|
+
import { formatPriceByCurrency, formatTokenNumber } from '@/utils/format';
|
17
|
+
|
18
|
+
import Statistic, { type StatisticProps } from '../../../../../components/Statistic';
|
19
|
+
|
20
|
+
const useStyles = createStyles(({ css, token }) => ({
|
21
|
+
tagGreen: css`
|
22
|
+
color: ${token.colorSuccess};
|
23
|
+
background: ${token.colorSuccessBgHover};
|
24
|
+
`,
|
25
|
+
}));
|
26
|
+
|
27
|
+
interface ProviderItemProps extends DiscoverProviderItem {
|
28
|
+
mobile?: boolean;
|
29
|
+
modelId: string;
|
30
|
+
}
|
31
|
+
|
32
|
+
const ProviderItem = memo<ProviderItemProps>(({ mobile, modelId, identifier }) => {
|
33
|
+
const { t } = useTranslation('discover');
|
34
|
+
const { styles, theme } = useStyles();
|
35
|
+
const isLobeHub = identifier === 'lobehub';
|
36
|
+
|
37
|
+
const model = useMemo(() => {
|
38
|
+
const prividerItem = DEFAULT_MODEL_PROVIDER_LIST.find((v) => v.id === identifier);
|
39
|
+
if (!prividerItem) return;
|
40
|
+
return prividerItem.chatModels.find((m) => m.id.toLowerCase().includes(modelId.toLowerCase()));
|
41
|
+
}, [identifier, modelId]);
|
42
|
+
|
43
|
+
const items: StatisticProps[] = [
|
44
|
+
{
|
45
|
+
title: t('models.contentLength'),
|
46
|
+
value: model?.tokens ? formatTokenNumber(model.tokens) : '--',
|
47
|
+
},
|
48
|
+
{
|
49
|
+
title: t('models.providerInfo.maxOutput'),
|
50
|
+
tooltip: t('models.providerInfo.maxOutputTooltip'),
|
51
|
+
value: model?.maxOutput ? formatTokenNumber(model.maxOutput) : '--',
|
52
|
+
},
|
53
|
+
{
|
54
|
+
title: t('models.providerInfo.input'),
|
55
|
+
tooltip: t('models.providerInfo.inputTooltip'),
|
56
|
+
value: model?.pricing?.input
|
57
|
+
? '$' + formatPriceByCurrency(model.pricing.input, model.pricing?.currency)
|
58
|
+
: '--',
|
59
|
+
},
|
60
|
+
{
|
61
|
+
title: t('models.providerInfo.output'),
|
62
|
+
tooltip: t('models.providerInfo.outputTooltip'),
|
63
|
+
value: model?.pricing?.output
|
64
|
+
? '$' + formatPriceByCurrency(model.pricing.output, model.pricing?.currency)
|
65
|
+
: '--',
|
66
|
+
},
|
67
|
+
/* ↓ cloud slot ↓ */
|
68
|
+
/* ↑ cloud slot ↑ */
|
69
|
+
];
|
70
|
+
|
71
|
+
const header = (
|
72
|
+
<Flexbox gap={4} style={{ minWidth: 240 }}>
|
73
|
+
<InterceptingLink
|
74
|
+
href={urlJoin('/discover/provider', identifier)}
|
75
|
+
style={{ color: 'inherit' }}
|
76
|
+
>
|
77
|
+
<ProviderCombine provider={identifier} size={24} />
|
78
|
+
</InterceptingLink>
|
79
|
+
<Flexbox align={'center'} gap={6} horizontal>
|
80
|
+
<ModelTag model={modelId} style={{ background: theme.colorFillQuaternary, margin: 0 }} />
|
81
|
+
{isLobeHub && (
|
82
|
+
<Tooltip title={t('models.providerInfo.officialTooltip')}>
|
83
|
+
<Tag
|
84
|
+
bordered={false}
|
85
|
+
className={styles.tagGreen}
|
86
|
+
icon={<Icon icon={BadgeCheck} />}
|
87
|
+
style={{ margin: 0 }}
|
88
|
+
/>
|
89
|
+
</Tooltip>
|
90
|
+
)}
|
91
|
+
{!isLobeHub && (
|
92
|
+
<Tooltip title={t('models.providerInfo.apiTooltip')}>
|
93
|
+
<Tag bordered={false} icon={<Icon icon={KeyIcon} />} style={{ margin: 0 }} />
|
94
|
+
</Tooltip>
|
95
|
+
)}
|
96
|
+
<Tooltip title={t('models.guide')}>
|
97
|
+
<Link href={urlJoin(BASE_PROVIDER_DOC_URL, identifier)} target={'_blank'}>
|
98
|
+
<Tag bordered={false} icon={<Icon icon={BookIcon} />} style={{ margin: 0 }} />
|
99
|
+
</Link>
|
100
|
+
</Tooltip>
|
101
|
+
</Flexbox>
|
102
|
+
</Flexbox>
|
103
|
+
);
|
104
|
+
|
105
|
+
const button = (
|
106
|
+
<InterceptingLink href={urlJoin('/discover/provider', identifier)} style={{ color: 'inherit' }}>
|
107
|
+
<ActionIcon color={theme.colorTextDescription} icon={ChevronRightIcon} />
|
108
|
+
</InterceptingLink>
|
109
|
+
);
|
110
|
+
|
111
|
+
return (
|
112
|
+
<Flexbox
|
113
|
+
align={'center'}
|
114
|
+
gap={16}
|
115
|
+
horizontal
|
116
|
+
justify={'space-between'}
|
117
|
+
padding={16}
|
118
|
+
wrap={'wrap'}
|
119
|
+
>
|
120
|
+
{mobile && (
|
121
|
+
<Flexbox align={'center'} horizontal justify={'space-between'}>
|
122
|
+
{header}
|
123
|
+
{button}
|
124
|
+
</Flexbox>
|
125
|
+
)}
|
126
|
+
<Grid
|
127
|
+
align={'center'}
|
128
|
+
flex={1}
|
129
|
+
gap={16}
|
130
|
+
horizontal
|
131
|
+
maxItemWidth={100}
|
132
|
+
rows={mobile ? 2 : items.length + 1}
|
133
|
+
style={{ minWidth: 240 }}
|
134
|
+
>
|
135
|
+
{!mobile && header}
|
136
|
+
{items.map((item, index) => (
|
137
|
+
<Statistic
|
138
|
+
align={mobile ? 'flex-start' : 'center'}
|
139
|
+
gap={4}
|
140
|
+
key={index}
|
141
|
+
valuePlacement={'bottom'}
|
142
|
+
valueStyle={{ fontSize: 18 }}
|
143
|
+
{...item}
|
144
|
+
/>
|
145
|
+
))}
|
146
|
+
</Grid>
|
147
|
+
{!mobile && button}
|
148
|
+
</Flexbox>
|
149
|
+
);
|
150
|
+
});
|
151
|
+
|
152
|
+
export default ProviderItem;
|
@@ -0,0 +1,45 @@
|
|
1
|
+
'use client';
|
2
|
+
|
3
|
+
import { ModelIcon } from '@lobehub/icons';
|
4
|
+
import { Divider } from 'antd';
|
5
|
+
import { useTheme } from 'antd-style';
|
6
|
+
import { BrainCircuit } from 'lucide-react';
|
7
|
+
import { memo } from 'react';
|
8
|
+
import { useTranslation } from 'react-i18next';
|
9
|
+
|
10
|
+
import { DiscoverProviderItem } from '@/types/discover';
|
11
|
+
|
12
|
+
import HighlightBlock from '../../../../features/HighlightBlock';
|
13
|
+
import ProviderItem from './ProviderItem';
|
14
|
+
|
15
|
+
interface ProviderListProps {
|
16
|
+
data: DiscoverProviderItem[];
|
17
|
+
identifier: string;
|
18
|
+
mobile?: boolean;
|
19
|
+
}
|
20
|
+
|
21
|
+
const ProviderList = memo<ProviderListProps>(({ mobile, data, identifier }) => {
|
22
|
+
const { t } = useTranslation('discover');
|
23
|
+
const theme = useTheme();
|
24
|
+
|
25
|
+
if (data?.length === 0) return null;
|
26
|
+
|
27
|
+
return (
|
28
|
+
<HighlightBlock
|
29
|
+
avatar={<ModelIcon model={identifier} size={300} type={'avatar'} />}
|
30
|
+
icon={BrainCircuit}
|
31
|
+
justify={'space-between'}
|
32
|
+
style={{ background: theme.colorBgContainer }}
|
33
|
+
title={t('models.supportedProviders')}
|
34
|
+
>
|
35
|
+
{data.map((item, index) => (
|
36
|
+
<>
|
37
|
+
<ProviderItem key={item.identifier} mobile={mobile} modelId={identifier} {...item} />
|
38
|
+
{index < data.length - 1 && <Divider key={index} style={{ margin: 0 }} />}
|
39
|
+
</>
|
40
|
+
))}
|
41
|
+
</HighlightBlock>
|
42
|
+
);
|
43
|
+
});
|
44
|
+
|
45
|
+
export default ProviderList;
|
@@ -0,0 +1,114 @@
|
|
1
|
+
import { notFound } from 'next/navigation';
|
2
|
+
import urlJoin from 'url-join';
|
3
|
+
|
4
|
+
import StructuredData from '@/components/StructuredData';
|
5
|
+
import { Locales } from '@/locales/resources';
|
6
|
+
import { ldModule } from '@/server/ld';
|
7
|
+
import { metadataModule } from '@/server/metadata';
|
8
|
+
import { DiscoverService } from '@/server/services/discover';
|
9
|
+
import { translation } from '@/server/translation';
|
10
|
+
import { DiscoverProviderItem } from '@/types/discover';
|
11
|
+
import { isMobileDevice } from '@/utils/responsive';
|
12
|
+
|
13
|
+
import DetailLayout from '../../features/DetailLayout';
|
14
|
+
import Actions from './features/Actions';
|
15
|
+
import Header from './features/Header';
|
16
|
+
import InfoSidebar from './features/InfoSidebar';
|
17
|
+
import ParameterList from './features/ParameterList';
|
18
|
+
import ProviderList from './features/ProviderList';
|
19
|
+
|
20
|
+
type Props = { params: { slugs: string[] }; searchParams: { hl?: Locales } };
|
21
|
+
|
22
|
+
export const generateMetadata = async ({ params, searchParams }: Props) => {
|
23
|
+
const { slugs } = params;
|
24
|
+
const identifier = decodeURIComponent(slugs.join('/'));
|
25
|
+
const { t, locale } = await translation('metadata', searchParams?.hl);
|
26
|
+
const { t: td } = await translation('models', searchParams?.hl);
|
27
|
+
|
28
|
+
const discoverService = new DiscoverService();
|
29
|
+
const data = await discoverService.getModelById(locale, identifier);
|
30
|
+
if (!data) return notFound();
|
31
|
+
|
32
|
+
const { meta, createdAt, providers } = data;
|
33
|
+
|
34
|
+
return {
|
35
|
+
authors: [
|
36
|
+
{ name: meta.title },
|
37
|
+
{ name: 'LobeHub', url: 'https://github.com/lobehub' },
|
38
|
+
{ name: 'LobeChat', url: 'https://github.com/lobehub/lobe-chat' },
|
39
|
+
],
|
40
|
+
webpage: {
|
41
|
+
enable: true,
|
42
|
+
search: '/discover/search',
|
43
|
+
},
|
44
|
+
...metadataModule.generate({
|
45
|
+
alternate: true,
|
46
|
+
description: td(`${identifier}.description`) || t('discover.models.description'),
|
47
|
+
locale,
|
48
|
+
tags: providers || [],
|
49
|
+
title: [meta.title, t('discover.models.title')].join(' · '),
|
50
|
+
url: urlJoin('/discover/model', identifier),
|
51
|
+
}),
|
52
|
+
other: {
|
53
|
+
'article:author': meta.title,
|
54
|
+
'article:published_time': createdAt
|
55
|
+
? new Date(createdAt).toISOString()
|
56
|
+
: new Date().toISOString(),
|
57
|
+
'robots': 'index,follow,max-image-preview:large',
|
58
|
+
},
|
59
|
+
};
|
60
|
+
};
|
61
|
+
|
62
|
+
const Page = async ({ params, searchParams }: Props) => {
|
63
|
+
const { slugs } = params;
|
64
|
+
|
65
|
+
const identifier = decodeURIComponent(slugs.join('/'));
|
66
|
+
const { t, locale } = await translation('metadata', searchParams?.hl);
|
67
|
+
const { t: td } = await translation('models', searchParams?.hl);
|
68
|
+
const mobile = isMobileDevice();
|
69
|
+
|
70
|
+
const discoverService = new DiscoverService();
|
71
|
+
const data = await discoverService.getModelById(locale, identifier);
|
72
|
+
if (!data) return notFound();
|
73
|
+
|
74
|
+
const { meta, createdAt, providers } = data;
|
75
|
+
|
76
|
+
let providerData: DiscoverProviderItem[] = [];
|
77
|
+
if (providers && providers?.length > 0) {
|
78
|
+
providerData = await discoverService.getProviderByIds(locale, providers);
|
79
|
+
}
|
80
|
+
|
81
|
+
const ld = ldModule.generate({
|
82
|
+
article: {
|
83
|
+
author: [meta.title],
|
84
|
+
enable: true,
|
85
|
+
identifier,
|
86
|
+
tags: providers || [],
|
87
|
+
},
|
88
|
+
date: createdAt ? new Date(createdAt).toISOString() : new Date().toISOString(),
|
89
|
+
description: td(`${identifier}.description`) || t('discover.models.description'),
|
90
|
+
title: [meta.title, t('discover.models.title')].join(' · '),
|
91
|
+
url: urlJoin('/discover/model', identifier),
|
92
|
+
});
|
93
|
+
|
94
|
+
return (
|
95
|
+
<>
|
96
|
+
<StructuredData ld={ld} />
|
97
|
+
<DetailLayout
|
98
|
+
actions={<Actions data={data} identifier={identifier} providerData={providerData} />}
|
99
|
+
header={<Header data={data} identifier={identifier} mobile={mobile} />}
|
100
|
+
mobile={mobile}
|
101
|
+
sidebar={<InfoSidebar data={data} identifier={identifier} mobile={mobile} />}
|
102
|
+
/* ↓ cloud slot ↓ */
|
103
|
+
/* ↑ cloud slot ↑ */
|
104
|
+
>
|
105
|
+
<ProviderList data={providerData} identifier={identifier} mobile={mobile} />
|
106
|
+
<ParameterList data={data} identifier={identifier} />
|
107
|
+
</DetailLayout>
|
108
|
+
</>
|
109
|
+
);
|
110
|
+
};
|
111
|
+
|
112
|
+
Page.DisplayName = 'DiscoverModelDetail';
|
113
|
+
|
114
|
+
export default Page;
|
@@ -0,0 +1,35 @@
|
|
1
|
+
'use client';
|
2
|
+
|
3
|
+
import { memo } from 'react';
|
4
|
+
import { Flexbox, FlexboxProps } from 'react-layout-kit';
|
5
|
+
import urlJoin from 'url-join';
|
6
|
+
|
7
|
+
import { OFFICIAL_URL } from '@/const/url';
|
8
|
+
import { DiscoverPlugintem } from '@/types/discover';
|
9
|
+
|
10
|
+
import ShareButton from '../../../features/ShareButton';
|
11
|
+
import InstallTool from './InstallPlugin';
|
12
|
+
|
13
|
+
interface PluginActionsProps extends FlexboxProps {
|
14
|
+
data: DiscoverPlugintem;
|
15
|
+
identifier: string;
|
16
|
+
}
|
17
|
+
|
18
|
+
const PluginActions = memo<PluginActionsProps>(({ identifier, data }) => {
|
19
|
+
return (
|
20
|
+
<Flexbox align={'center'} gap={8} horizontal>
|
21
|
+
<InstallTool identifier={identifier} />
|
22
|
+
<ShareButton
|
23
|
+
meta={{
|
24
|
+
avatar: data.meta.avatar,
|
25
|
+
desc: data.meta.description,
|
26
|
+
hashtags: data.meta.tags,
|
27
|
+
title: data.meta.title,
|
28
|
+
url: urlJoin(OFFICIAL_URL, '/discover/plugin', identifier),
|
29
|
+
}}
|
30
|
+
/>
|
31
|
+
</Flexbox>
|
32
|
+
);
|
33
|
+
});
|
34
|
+
|
35
|
+
export default PluginActions;
|
@@ -0,0 +1,114 @@
|
|
1
|
+
'use client';
|
2
|
+
|
3
|
+
import { Avatar, Icon, Tag } from '@lobehub/ui';
|
4
|
+
import { Button } from 'antd';
|
5
|
+
import { createStyles } from 'antd-style';
|
6
|
+
import { startCase } from 'lodash-es';
|
7
|
+
import { ChevronRight } from 'lucide-react';
|
8
|
+
import Link from 'next/link';
|
9
|
+
import qs from 'query-string';
|
10
|
+
import { memo } from 'react';
|
11
|
+
import { useTranslation } from 'react-i18next';
|
12
|
+
import { Flexbox } from 'react-layout-kit';
|
13
|
+
import urlJoin from 'url-join';
|
14
|
+
|
15
|
+
import { DiscoverPlugintem } from '@/types/discover';
|
16
|
+
|
17
|
+
import Back from '../../../features/Back';
|
18
|
+
|
19
|
+
export const useStyles = createStyles(({ css, token }) => ({
|
20
|
+
tag: css`
|
21
|
+
color: ${token.colorTextSecondary};
|
22
|
+
background: ${token.colorFillSecondary};
|
23
|
+
border: none;
|
24
|
+
`,
|
25
|
+
time: css`
|
26
|
+
font-size: 12px;
|
27
|
+
color: ${token.colorTextDescription};
|
28
|
+
`,
|
29
|
+
title: css`
|
30
|
+
margin-block: 0;
|
31
|
+
font-size: 18px;
|
32
|
+
font-weight: bold;
|
33
|
+
line-height: 1.2;
|
34
|
+
`,
|
35
|
+
}));
|
36
|
+
|
37
|
+
interface HeaderProps {
|
38
|
+
data: DiscoverPlugintem;
|
39
|
+
identifier: string;
|
40
|
+
mobile?: boolean;
|
41
|
+
}
|
42
|
+
|
43
|
+
const Header = memo<HeaderProps>(({ identifier, data, mobile }) => {
|
44
|
+
const { styles, theme } = useStyles();
|
45
|
+
const { t } = useTranslation('discover');
|
46
|
+
|
47
|
+
return (
|
48
|
+
<Flexbox gap={12} width={'100%'}>
|
49
|
+
{!mobile && <Back href={'/discover/plugins'} />}
|
50
|
+
<Flexbox align={'center'} gap={8} horizontal justify={'space-between'} width={'100%'}>
|
51
|
+
<Flexbox align={'center'} gap={16} horizontal justify={'flex-start'}>
|
52
|
+
<Avatar
|
53
|
+
alt={identifier}
|
54
|
+
animation
|
55
|
+
avatar={data.meta.avatar}
|
56
|
+
background={theme.colorFillTertiary}
|
57
|
+
size={48}
|
58
|
+
style={{ flex: 'none' }}
|
59
|
+
/>
|
60
|
+
<Flexbox gap={4}>
|
61
|
+
<h1 className={styles.title}>{data.meta.title}</h1>
|
62
|
+
<Flexbox align={'center'} gap={8} horizontal>
|
63
|
+
<Link href={data.homepage} target={'_blank'}>
|
64
|
+
@{data.author}
|
65
|
+
</Link>
|
66
|
+
<time className={styles.time} dateTime={new Date(data.createdAt).toISOString()}>
|
67
|
+
{data.createdAt}
|
68
|
+
</time>
|
69
|
+
</Flexbox>
|
70
|
+
</Flexbox>
|
71
|
+
</Flexbox>
|
72
|
+
{!mobile && (
|
73
|
+
<Flexbox align={'center'} gap={4} horizontal justify={'flex-end'}>
|
74
|
+
<Link href={'/discover/plugins'}>
|
75
|
+
<Button className={styles.tag} shape={'round'} size={'small'}>
|
76
|
+
{t('tab.plugins')}
|
77
|
+
</Button>
|
78
|
+
</Link>
|
79
|
+
{data.meta?.category && (
|
80
|
+
<>
|
81
|
+
<Icon color={theme.colorTextSecondary} icon={ChevronRight} />
|
82
|
+
<Link href={urlJoin('/discover/plugins', data.meta?.category || '')}>
|
83
|
+
<Button className={styles.tag} shape={'round'} size={'small'}>
|
84
|
+
{t(`category.plugin.${data.meta?.category}` as any)}
|
85
|
+
</Button>
|
86
|
+
</Link>
|
87
|
+
</>
|
88
|
+
)}
|
89
|
+
</Flexbox>
|
90
|
+
)}
|
91
|
+
</Flexbox>
|
92
|
+
<div>{data.meta.description}</div>
|
93
|
+
{data.meta.tags && (
|
94
|
+
<Flexbox gap={4} horizontal wrap={'wrap'}>
|
95
|
+
{data.meta.tags.map((tag) => (
|
96
|
+
<Link
|
97
|
+
href={qs.stringifyUrl({
|
98
|
+
query: { q: tag },
|
99
|
+
url: '/discover/search',
|
100
|
+
})}
|
101
|
+
key={tag}
|
102
|
+
>
|
103
|
+
<Tag key={tag} style={{ margin: 0 }}>
|
104
|
+
{startCase(tag).trim()}
|
105
|
+
</Tag>
|
106
|
+
</Link>
|
107
|
+
))}
|
108
|
+
</Flexbox>
|
109
|
+
)}
|
110
|
+
</Flexbox>
|
111
|
+
);
|
112
|
+
});
|
113
|
+
|
114
|
+
export default Header;
|
package/src/app/(main)/discover/(detail)/plugin/[slug]/features/InfoSidebar/SuggestionItem.tsx
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
import { Avatar } from '@lobehub/ui';
|
2
|
+
import { Typography } from 'antd';
|
3
|
+
import { createStyles } from 'antd-style';
|
4
|
+
import { memo } from 'react';
|
5
|
+
import { Flexbox, FlexboxProps } from 'react-layout-kit';
|
6
|
+
|
7
|
+
import { DiscoverPlugintem } from '@/types/discover';
|
8
|
+
|
9
|
+
const { Paragraph, Title } = Typography;
|
10
|
+
|
11
|
+
const useStyles = createStyles(({ css, token, isDarkMode }) => ({
|
12
|
+
banner: css`
|
13
|
+
opacity: ${isDarkMode ? 0.9 : 0.4};
|
14
|
+
`,
|
15
|
+
container: css`
|
16
|
+
cursor: pointer;
|
17
|
+
position: relative;
|
18
|
+
overflow: hidden;
|
19
|
+
height: 100%;
|
20
|
+
`,
|
21
|
+
desc: css`
|
22
|
+
margin-block-end: 0 !important;
|
23
|
+
color: ${token.colorTextDescription};
|
24
|
+
`,
|
25
|
+
title: css`
|
26
|
+
margin-block-end: 0 !important;
|
27
|
+
font-size: 16px !important;
|
28
|
+
font-weight: 500 !important;
|
29
|
+
`,
|
30
|
+
}));
|
31
|
+
|
32
|
+
export interface SuggestionItemProps
|
33
|
+
extends Omit<DiscoverPlugintem, 'suggestions' | 'socialData' | 'category' | 'manifest'>,
|
34
|
+
FlexboxProps {}
|
35
|
+
|
36
|
+
const SuggestionItem = memo<SuggestionItemProps>(({ className, meta, identifier, ...rest }) => {
|
37
|
+
const { avatar, title, description } = meta;
|
38
|
+
|
39
|
+
const { cx, styles, theme } = useStyles();
|
40
|
+
|
41
|
+
return (
|
42
|
+
<Flexbox className={cx(styles.container, className)} gap={12} key={identifier} {...rest}>
|
43
|
+
<Flexbox align={'center'} gap={12} horizontal width={'100%'}>
|
44
|
+
<Avatar
|
45
|
+
alt={title}
|
46
|
+
avatar={avatar}
|
47
|
+
background={theme.colorFillTertiary}
|
48
|
+
size={36}
|
49
|
+
title={title}
|
50
|
+
/>
|
51
|
+
<Title className={styles.title} ellipsis={{ rows: 1, tooltip: title }} level={3}>
|
52
|
+
{title}
|
53
|
+
</Title>
|
54
|
+
</Flexbox>
|
55
|
+
<Paragraph className={styles.desc} ellipsis={{ rows: 2 }}>
|
56
|
+
{description}
|
57
|
+
</Paragraph>
|
58
|
+
</Flexbox>
|
59
|
+
);
|
60
|
+
});
|
61
|
+
|
62
|
+
export default SuggestionItem;
|
@@ -0,0 +1,49 @@
|
|
1
|
+
'use client';
|
2
|
+
|
3
|
+
import { Skeleton } from 'antd';
|
4
|
+
import { memo } from 'react';
|
5
|
+
import { useTranslation } from 'react-i18next';
|
6
|
+
import { Flexbox, FlexboxProps } from 'react-layout-kit';
|
7
|
+
import urlJoin from 'url-join';
|
8
|
+
|
9
|
+
import InterceptingLink from '@/components/InterceptingLink';
|
10
|
+
import { DiscoverPlugintem } from '@/types/discover';
|
11
|
+
|
12
|
+
import Block from '../../../../features/Block';
|
13
|
+
import SuggestionItem from './SuggestionItem';
|
14
|
+
|
15
|
+
interface InfoSidebarProps extends FlexboxProps {
|
16
|
+
data: DiscoverPlugintem;
|
17
|
+
identifier: string;
|
18
|
+
mobile?: boolean;
|
19
|
+
}
|
20
|
+
|
21
|
+
const InfoSidebar = memo<InfoSidebarProps>(({ data, ...rest }) => {
|
22
|
+
const { t } = useTranslation('discover');
|
23
|
+
|
24
|
+
return (
|
25
|
+
<Flexbox gap={48} style={{ position: 'relative' }} width={'100%'} {...rest}>
|
26
|
+
<Block
|
27
|
+
gap={24}
|
28
|
+
more={t('assistants.more')}
|
29
|
+
moreLink={urlJoin('/discover/plugins', data.meta?.category || '')}
|
30
|
+
title={t('assistants.suggestions')}
|
31
|
+
>
|
32
|
+
{data?.suggestions?.length > 0 ? (
|
33
|
+
data?.suggestions.map((item) => (
|
34
|
+
<InterceptingLink
|
35
|
+
href={urlJoin('/discover/plugin', item.identifier)}
|
36
|
+
key={item.identifier}
|
37
|
+
>
|
38
|
+
<SuggestionItem {...item} />
|
39
|
+
</InterceptingLink>
|
40
|
+
))
|
41
|
+
) : (
|
42
|
+
<Skeleton active paragraph={{ rows: 5 }} title={false} />
|
43
|
+
)}
|
44
|
+
</Block>
|
45
|
+
</Flexbox>
|
46
|
+
);
|
47
|
+
});
|
48
|
+
|
49
|
+
export default InfoSidebar;
|