@lobehub/chat 1.17.7 → 1.18.1
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/.dockerignore +0 -1
- package/CHANGELOG.md +42 -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/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/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,160 @@
|
|
1
|
+
import { ActionIcon, Avatar, CopyButton, Icon, Input, Modal, Tag } from '@lobehub/ui';
|
2
|
+
import { Button, ButtonProps, Skeleton, Typography } from 'antd';
|
3
|
+
import { createStyles } from 'antd-style';
|
4
|
+
import { startCase } from 'lodash-es';
|
5
|
+
import { LinkIcon, Share2Icon } from 'lucide-react';
|
6
|
+
import Link from 'next/link';
|
7
|
+
import { ReactNode, memo, useState } from 'react';
|
8
|
+
import { useTranslation } from 'react-i18next';
|
9
|
+
import { Center, Flexbox } from 'react-layout-kit';
|
10
|
+
|
11
|
+
import { useShare } from '@/hooks/useShare';
|
12
|
+
|
13
|
+
import CardBanner from '../../components/CardBanner';
|
14
|
+
|
15
|
+
const useStyles = createStyles(({ css, token }) => {
|
16
|
+
return {
|
17
|
+
banner: css`
|
18
|
+
overflow: hidden;
|
19
|
+
|
20
|
+
background: ${token.colorBgContainer};
|
21
|
+
border: 1px solid ${token.colorBorderSecondary};
|
22
|
+
border-radius: ${token.borderRadiusLG}px;
|
23
|
+
box-shadow: ${token.boxShadowTertiary};
|
24
|
+
`,
|
25
|
+
copy: css`
|
26
|
+
background: ${token.colorPrimary};
|
27
|
+
|
28
|
+
&:hover {
|
29
|
+
background: ${token.colorPrimaryHover};
|
30
|
+
}
|
31
|
+
`,
|
32
|
+
icon: css`
|
33
|
+
border: 1px solid ${token.colorFillSecondary};
|
34
|
+
|
35
|
+
svg {
|
36
|
+
fill: ${token.colorTextSecondary};
|
37
|
+
}
|
38
|
+
|
39
|
+
&:hover {
|
40
|
+
border: 1px solid ${token.colorBorderSecondary};
|
41
|
+
|
42
|
+
svg {
|
43
|
+
fill: ${token.colorText};
|
44
|
+
}
|
45
|
+
}
|
46
|
+
`,
|
47
|
+
};
|
48
|
+
});
|
49
|
+
|
50
|
+
interface ShareButtonProps extends ButtonProps {
|
51
|
+
meta?: {
|
52
|
+
avatar?: string | ReactNode;
|
53
|
+
desc?: string;
|
54
|
+
hashtags?: string[];
|
55
|
+
tags?: ReactNode;
|
56
|
+
title?: string;
|
57
|
+
url: string;
|
58
|
+
};
|
59
|
+
}
|
60
|
+
|
61
|
+
const ShareButton = memo<ShareButtonProps>(({ meta, ...rest }) => {
|
62
|
+
const { x, reddit, telegram, whatsapp, mastodon, linkedin, weibo } = useShare({
|
63
|
+
avatar: '',
|
64
|
+
desc: '',
|
65
|
+
hashtags: [],
|
66
|
+
title: '',
|
67
|
+
url: '',
|
68
|
+
...meta,
|
69
|
+
});
|
70
|
+
const { t } = useTranslation('common');
|
71
|
+
const { styles, theme } = useStyles();
|
72
|
+
const [open, setOpen] = useState(false);
|
73
|
+
|
74
|
+
let content;
|
75
|
+
|
76
|
+
if (meta) {
|
77
|
+
content = (
|
78
|
+
<Center gap={16} style={{ position: 'relative' }} width={'100%'}>
|
79
|
+
<Flexbox align={'center'} className={styles.banner} width={'100%'}>
|
80
|
+
<CardBanner avatar={meta.avatar} size={640} style={{ height: 72, marginBottom: -36 }} />
|
81
|
+
<Center
|
82
|
+
flex={'none'}
|
83
|
+
height={72}
|
84
|
+
style={{
|
85
|
+
backgroundColor: theme.colorBgContainer,
|
86
|
+
borderRadius: '50%',
|
87
|
+
overflow: 'hidden',
|
88
|
+
zIndex: 2,
|
89
|
+
}}
|
90
|
+
width={72}
|
91
|
+
>
|
92
|
+
<Avatar animation avatar={meta.avatar} shape={'circle'} size={64} />
|
93
|
+
</Center>
|
94
|
+
<Center padding={12} width={'100%'}>
|
95
|
+
<h3 style={{ fontWeight: 'bold', textAlign: 'center' }}>{meta.title}</h3>
|
96
|
+
<Typography.Paragraph style={{ color: theme.colorTextSecondary, textAlign: 'center' }}>
|
97
|
+
{meta.desc}
|
98
|
+
</Typography.Paragraph>
|
99
|
+
{meta.hashtags && (
|
100
|
+
<Flexbox align={'center'} gap={4} horizontal justify={'center'} wrap={'wrap'}>
|
101
|
+
{meta.hashtags.map((tag, index) => (
|
102
|
+
<Tag key={index} style={{ margin: 0 }}>
|
103
|
+
{startCase(tag).trim()}
|
104
|
+
</Tag>
|
105
|
+
))}
|
106
|
+
</Flexbox>
|
107
|
+
)}
|
108
|
+
{meta.tags}
|
109
|
+
</Center>
|
110
|
+
</Flexbox>
|
111
|
+
<Flexbox align={'center'} gap={8} horizontal justify={'center'} wrap={'wrap'}>
|
112
|
+
{[x, reddit, telegram, whatsapp, mastodon, linkedin, weibo].map((item) => (
|
113
|
+
<Link href={item.link} key={item.title} target={'_blank'}>
|
114
|
+
<ActionIcon
|
115
|
+
className={styles.icon}
|
116
|
+
icon={item.icon as any}
|
117
|
+
size={{ blockSize: 36, borderRadius: 18, fontSize: 16 }}
|
118
|
+
title={item.title}
|
119
|
+
/>
|
120
|
+
</Link>
|
121
|
+
))}
|
122
|
+
</Flexbox>
|
123
|
+
<Flexbox align={'center'} gap={8} horizontal width={'100%'}>
|
124
|
+
<Input type={'block'} value={meta.url} />
|
125
|
+
<CopyButton
|
126
|
+
className={styles.copy}
|
127
|
+
color={theme.colorBgLayout}
|
128
|
+
content={meta.url}
|
129
|
+
icon={LinkIcon}
|
130
|
+
size={{ blockSize: 36, fontSize: 16 }}
|
131
|
+
/>
|
132
|
+
</Flexbox>
|
133
|
+
</Center>
|
134
|
+
);
|
135
|
+
} else {
|
136
|
+
content = <Skeleton active paragraph={{ rows: 4 }} title={false} />;
|
137
|
+
}
|
138
|
+
|
139
|
+
return (
|
140
|
+
<>
|
141
|
+
<Button
|
142
|
+
icon={<Icon icon={Share2Icon} />}
|
143
|
+
onClick={() => setOpen(true)}
|
144
|
+
size={'large'}
|
145
|
+
{...rest}
|
146
|
+
/>
|
147
|
+
<Modal
|
148
|
+
footer={null}
|
149
|
+
onCancel={() => setOpen(false)}
|
150
|
+
open={open}
|
151
|
+
title={t('share')}
|
152
|
+
width={360}
|
153
|
+
>
|
154
|
+
{content}
|
155
|
+
</Modal>
|
156
|
+
</>
|
157
|
+
);
|
158
|
+
});
|
159
|
+
|
160
|
+
export default ShareButton;
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import { memo } from 'react';
|
2
|
+
import { Flexbox, FlexboxProps } from 'react-layout-kit';
|
3
|
+
|
4
|
+
const SidebarContainer = memo<FlexboxProps>(({ children, style, ...rest }) => {
|
5
|
+
return (
|
6
|
+
<Flexbox
|
7
|
+
flex={'none'}
|
8
|
+
gap={48}
|
9
|
+
height={'100%'}
|
10
|
+
style={{ position: 'relative', width: 320, ...style }}
|
11
|
+
width={'100%'}
|
12
|
+
{...rest}
|
13
|
+
>
|
14
|
+
{children}
|
15
|
+
</Flexbox>
|
16
|
+
);
|
17
|
+
});
|
18
|
+
|
19
|
+
export default SidebarContainer;
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
2
|
+
|
3
|
+
import ServerLayout from '@/components/server/ServerLayout';
|
4
|
+
|
5
|
+
import Desktop from './_layout/Desktop';
|
6
|
+
import Mobile from './_layout/Mobile';
|
7
|
+
|
8
|
+
const MainLayout = ServerLayout<PropsWithChildren>({ Desktop, Mobile });
|
9
|
+
|
10
|
+
MainLayout.displayName = 'DiscoverAssistantsDetailLayout';
|
11
|
+
|
12
|
+
export default MainLayout;
|
@@ -0,0 +1,38 @@
|
|
1
|
+
'use client';
|
2
|
+
|
3
|
+
import { Skeleton } from 'antd';
|
4
|
+
import { memo } from 'react';
|
5
|
+
import { Flexbox } from 'react-layout-kit';
|
6
|
+
|
7
|
+
import { useServerConfigStore } from '@/store/serverConfig';
|
8
|
+
|
9
|
+
import DetailLayout from './features/DetailLayout';
|
10
|
+
|
11
|
+
const Loading = memo(() => {
|
12
|
+
const mobile = useServerConfigStore((s) => s.isMobile);
|
13
|
+
return (
|
14
|
+
<DetailLayout
|
15
|
+
actions={<Skeleton.Button block />}
|
16
|
+
header={
|
17
|
+
<Flexbox gap={12} width={'100%'}>
|
18
|
+
<Flexbox align={'center'} gap={8} horizontal justify={'space-between'} width={'100%'}>
|
19
|
+
<Flexbox align={'center'} gap={12} horizontal justify={'flex-start'}>
|
20
|
+
<Skeleton.Avatar active shape={'circle'} size={48} />
|
21
|
+
<Skeleton.Button active />
|
22
|
+
</Flexbox>
|
23
|
+
<Flexbox align={'center'} gap={4} horizontal justify={'flex-end'}>
|
24
|
+
<Skeleton.Button active />
|
25
|
+
</Flexbox>
|
26
|
+
</Flexbox>
|
27
|
+
<Skeleton active title={false} />
|
28
|
+
</Flexbox>
|
29
|
+
}
|
30
|
+
mobile={mobile}
|
31
|
+
sidebar={<Skeleton paragraph={{ rows: 5 }} />}
|
32
|
+
>
|
33
|
+
<Skeleton paragraph={{ rows: 16 }} title={false} />
|
34
|
+
</DetailLayout>
|
35
|
+
);
|
36
|
+
});
|
37
|
+
|
38
|
+
export default Loading;
|
@@ -0,0 +1,46 @@
|
|
1
|
+
'use client';
|
2
|
+
|
3
|
+
import { ModelIcon } from '@lobehub/icons';
|
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 { OFFICIAL_URL } from '@/const/url';
|
10
|
+
import { DiscoverModelItem, DiscoverProviderItem } from '@/types/discover';
|
11
|
+
|
12
|
+
import ModelFeatureTags from '../../../../features/ModelFeatureTags';
|
13
|
+
import ShareButton from '../../../features/ShareButton';
|
14
|
+
import ChatWithModel from './ChatWithModel';
|
15
|
+
|
16
|
+
interface ModelActionsProps extends FlexboxProps {
|
17
|
+
data: DiscoverModelItem;
|
18
|
+
identifier: string;
|
19
|
+
providerData: DiscoverProviderItem[];
|
20
|
+
}
|
21
|
+
|
22
|
+
const ModelActions = memo<ModelActionsProps>(({ identifier, providerData, data }) => {
|
23
|
+
const { t } = useTranslation('models');
|
24
|
+
return (
|
25
|
+
<Flexbox align={'center'} gap={8} horizontal>
|
26
|
+
<ChatWithModel providerData={providerData} providers={data.providers} />
|
27
|
+
<ShareButton
|
28
|
+
meta={{
|
29
|
+
avatar: <ModelIcon model={identifier} size={64} type={'avatar'} />,
|
30
|
+
desc: data.meta.description && t(`${identifier}.description`),
|
31
|
+
tags: (
|
32
|
+
<ModelFeatureTags
|
33
|
+
functionCall={data.meta.functionCall}
|
34
|
+
tokens={data.meta.tokens}
|
35
|
+
vision={data.meta.vision}
|
36
|
+
/>
|
37
|
+
),
|
38
|
+
title: data.meta.title,
|
39
|
+
url: urlJoin(OFFICIAL_URL, '/discover/model', identifier),
|
40
|
+
}}
|
41
|
+
/>
|
42
|
+
</Flexbox>
|
43
|
+
);
|
44
|
+
});
|
45
|
+
|
46
|
+
export default ModelActions;
|
@@ -0,0 +1,93 @@
|
|
1
|
+
'use client';
|
2
|
+
|
3
|
+
import { ProviderIcon } from '@lobehub/icons';
|
4
|
+
import { Icon } from '@lobehub/ui';
|
5
|
+
import { Button, Dropdown } from 'antd';
|
6
|
+
import { createStyles } from 'antd-style';
|
7
|
+
import { ChevronDownIcon } from 'lucide-react';
|
8
|
+
import Link from 'next/link';
|
9
|
+
import { useRouter } from 'next/navigation';
|
10
|
+
import { memo } from 'react';
|
11
|
+
import { useTranslation } from 'react-i18next';
|
12
|
+
import urlJoin from 'url-join';
|
13
|
+
|
14
|
+
import { DiscoverProviderItem } from '@/types/discover';
|
15
|
+
|
16
|
+
const useStyles = createStyles(({ css }) => ({
|
17
|
+
button: css`
|
18
|
+
button {
|
19
|
+
width: 100%;
|
20
|
+
}
|
21
|
+
`,
|
22
|
+
}));
|
23
|
+
|
24
|
+
const ChatWithModel = memo<{ providerData: DiscoverProviderItem[]; providers?: string[] }>(
|
25
|
+
({ providerData, providers = [] }) => {
|
26
|
+
const { styles } = useStyles();
|
27
|
+
const { t } = useTranslation('discover');
|
28
|
+
const includeLobeHub = providers?.includes('lobehub');
|
29
|
+
const route = useRouter();
|
30
|
+
const list = providerData.filter((provider) => provider.identifier !== 'lobehub');
|
31
|
+
|
32
|
+
const items = list.map((item) => ({
|
33
|
+
icon: <ProviderIcon provider={item.identifier} size={20} type={'avatar'} />,
|
34
|
+
key: item.identifier,
|
35
|
+
label: (
|
36
|
+
<Link href={urlJoin('/discover/provider', item.identifier)}>
|
37
|
+
{[item.meta.title, t('models.guide')].join(' ')}
|
38
|
+
</Link>
|
39
|
+
),
|
40
|
+
}));
|
41
|
+
|
42
|
+
const handleLobeHubChat = () => {
|
43
|
+
route.push('/chat');
|
44
|
+
};
|
45
|
+
|
46
|
+
if (includeLobeHub)
|
47
|
+
return (
|
48
|
+
<Dropdown.Button
|
49
|
+
className={styles.button}
|
50
|
+
icon={<Icon icon={ChevronDownIcon} />}
|
51
|
+
menu={{
|
52
|
+
items,
|
53
|
+
}}
|
54
|
+
onClick={handleLobeHubChat}
|
55
|
+
overlayStyle={{ minWidth: 267 }}
|
56
|
+
size={'large'}
|
57
|
+
style={{ flex: 1, width: 'unset' }}
|
58
|
+
type={'primary'}
|
59
|
+
>
|
60
|
+
{t('models.chat')}
|
61
|
+
</Dropdown.Button>
|
62
|
+
);
|
63
|
+
|
64
|
+
if (items.length === 1)
|
65
|
+
return (
|
66
|
+
<Link href={urlJoin('/discover/provider', items[0].key)} style={{ flex: 1 }}>
|
67
|
+
<Button block className={styles.button} size={'large'} type={'primary'}>
|
68
|
+
{t('models.guide')}
|
69
|
+
</Button>
|
70
|
+
</Link>
|
71
|
+
);
|
72
|
+
|
73
|
+
return (
|
74
|
+
<Dropdown
|
75
|
+
menu={{
|
76
|
+
items,
|
77
|
+
}}
|
78
|
+
trigger={['click']}
|
79
|
+
>
|
80
|
+
<Button
|
81
|
+
className={styles.button}
|
82
|
+
size={'large'}
|
83
|
+
style={{ flex: 1, width: 'unset' }}
|
84
|
+
type={'primary'}
|
85
|
+
>
|
86
|
+
{t('models.guide')}
|
87
|
+
</Button>
|
88
|
+
</Dropdown>
|
89
|
+
);
|
90
|
+
},
|
91
|
+
);
|
92
|
+
|
93
|
+
export default ChatWithModel;
|
@@ -0,0 +1,85 @@
|
|
1
|
+
'use client';
|
2
|
+
|
3
|
+
import { ModelIcon } from '@lobehub/icons';
|
4
|
+
import { Button } from 'antd';
|
5
|
+
import { createStyles } from 'antd-style';
|
6
|
+
import Link from 'next/link';
|
7
|
+
import { memo } from 'react';
|
8
|
+
import { useTranslation } from 'react-i18next';
|
9
|
+
import { Flexbox } from 'react-layout-kit';
|
10
|
+
|
11
|
+
import { DiscoverModelItem } from '@/types/discover';
|
12
|
+
|
13
|
+
import ModelFeatureTags from '../../../../features/ModelFeatureTags';
|
14
|
+
import Back from '../../../features/Back';
|
15
|
+
|
16
|
+
export const useStyles = createStyles(({ css, token }) => ({
|
17
|
+
tag: css`
|
18
|
+
color: ${token.colorTextSecondary};
|
19
|
+
background: ${token.colorFillSecondary};
|
20
|
+
border: none;
|
21
|
+
`,
|
22
|
+
time: css`
|
23
|
+
font-size: 12px;
|
24
|
+
color: ${token.colorTextDescription};
|
25
|
+
`,
|
26
|
+
title: css`
|
27
|
+
margin-block: 0;
|
28
|
+
font-size: 18px;
|
29
|
+
font-weight: bold;
|
30
|
+
line-height: 1.2;
|
31
|
+
`,
|
32
|
+
}));
|
33
|
+
|
34
|
+
interface HeaderProps {
|
35
|
+
data: DiscoverModelItem;
|
36
|
+
identifier: string;
|
37
|
+
mobile?: boolean;
|
38
|
+
}
|
39
|
+
|
40
|
+
const Header = memo<HeaderProps>(({ identifier, data, mobile }) => {
|
41
|
+
const { styles, theme } = useStyles();
|
42
|
+
const { t } = useTranslation(['discover', 'models']);
|
43
|
+
|
44
|
+
return (
|
45
|
+
<Flexbox gap={12} width={'100%'}>
|
46
|
+
{!mobile && <Back href={'/discover/models'} />}
|
47
|
+
<Flexbox align={'center'} gap={8} horizontal justify={'space-between'} width={'100%'}>
|
48
|
+
<Flexbox align={'center'} gap={16} horizontal justify={'flex-start'}>
|
49
|
+
<ModelIcon model={identifier} size={48} type={'avatar'} />
|
50
|
+
<Flexbox gap={2}>
|
51
|
+
<h1 className={styles.title}>{data.meta.title}</h1>
|
52
|
+
<Flexbox
|
53
|
+
align={'center'}
|
54
|
+
gap={12}
|
55
|
+
horizontal
|
56
|
+
style={{ color: theme.colorTextSecondary }}
|
57
|
+
>
|
58
|
+
<div>{identifier}</div>
|
59
|
+
<time className={styles.time} dateTime={new Date(data.createdAt).toISOString()}>
|
60
|
+
{data.createdAt}
|
61
|
+
</time>
|
62
|
+
</Flexbox>
|
63
|
+
</Flexbox>
|
64
|
+
</Flexbox>
|
65
|
+
{!mobile && (
|
66
|
+
<Flexbox align={'center'} gap={4} horizontal justify={'flex-end'}>
|
67
|
+
<Link href={'/discover/models'}>
|
68
|
+
<Button className={styles.tag} shape={'round'} size={'small'}>
|
69
|
+
{t('tab.models')}
|
70
|
+
</Button>
|
71
|
+
</Link>
|
72
|
+
</Flexbox>
|
73
|
+
)}
|
74
|
+
</Flexbox>
|
75
|
+
{data.meta.description && <div>{t(`${identifier}.description`, { ns: 'models' })}</div>}
|
76
|
+
<ModelFeatureTags
|
77
|
+
functionCall={data.meta.functionCall}
|
78
|
+
tokens={data.meta.tokens}
|
79
|
+
vision={data.meta.vision}
|
80
|
+
/>
|
81
|
+
</Flexbox>
|
82
|
+
);
|
83
|
+
});
|
84
|
+
|
85
|
+
export default Header;
|
package/src/app/(main)/discover/(detail)/model/[...slugs]/features/InfoSidebar/SuggestionItem.tsx
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
import { ModelIcon } from '@lobehub/icons';
|
2
|
+
import { Typography } from 'antd';
|
3
|
+
import { createStyles } from 'antd-style';
|
4
|
+
import { memo } from 'react';
|
5
|
+
import { useTranslation } from 'react-i18next';
|
6
|
+
import { Flexbox, FlexboxProps } from 'react-layout-kit';
|
7
|
+
|
8
|
+
import { DiscoverModelItem } from '@/types/discover';
|
9
|
+
|
10
|
+
import ModelFeatureTags from '../../../../../features/ModelFeatureTags';
|
11
|
+
|
12
|
+
const { Paragraph, Title } = Typography;
|
13
|
+
|
14
|
+
const useStyles = createStyles(({ css, token, isDarkMode }) => ({
|
15
|
+
banner: css`
|
16
|
+
opacity: ${isDarkMode ? 0.9 : 0.4};
|
17
|
+
`,
|
18
|
+
container: css`
|
19
|
+
cursor: pointer;
|
20
|
+
position: relative;
|
21
|
+
overflow: hidden;
|
22
|
+
height: 100%;
|
23
|
+
`,
|
24
|
+
desc: css`
|
25
|
+
margin-block-end: 0 !important;
|
26
|
+
color: ${token.colorTextDescription};
|
27
|
+
`,
|
28
|
+
id: css`
|
29
|
+
margin-block-end: 0 !important;
|
30
|
+
font-size: 12px;
|
31
|
+
color: ${token.colorTextSecondary};
|
32
|
+
`,
|
33
|
+
title: css`
|
34
|
+
margin-block-end: 0 !important;
|
35
|
+
font-size: 16px !important;
|
36
|
+
font-weight: 500 !important;
|
37
|
+
`,
|
38
|
+
token: css`
|
39
|
+
font-family: ${token.fontFamilyCode};
|
40
|
+
`,
|
41
|
+
}));
|
42
|
+
|
43
|
+
export interface SuggestionItemProps
|
44
|
+
extends Omit<DiscoverModelItem, 'suggestions' | 'socialData' | 'providers'>,
|
45
|
+
FlexboxProps {}
|
46
|
+
|
47
|
+
const SuggestionItem = memo<SuggestionItemProps>(({ className, meta, identifier, ...rest }) => {
|
48
|
+
const { title, description, tokens, vision, functionCall } = meta;
|
49
|
+
const { t } = useTranslation('models');
|
50
|
+
const { cx, styles } = useStyles();
|
51
|
+
|
52
|
+
return (
|
53
|
+
<Flexbox className={cx(styles.container, className)} gap={12} key={identifier} {...rest}>
|
54
|
+
<Flexbox align={'center'} gap={12} horizontal width={'100%'}>
|
55
|
+
<ModelIcon model={identifier} size={36} type={'avatar'} />
|
56
|
+
<Flexbox style={{ overflow: 'hidden' }}>
|
57
|
+
<Title className={styles.title} ellipsis={{ rows: 1, tooltip: title }} level={3}>
|
58
|
+
{title}
|
59
|
+
</Title>
|
60
|
+
<Paragraph className={styles.id} ellipsis={{ rows: 1 }}>
|
61
|
+
{identifier}
|
62
|
+
</Paragraph>
|
63
|
+
</Flexbox>
|
64
|
+
</Flexbox>
|
65
|
+
{description && (
|
66
|
+
<Paragraph className={styles.desc} ellipsis={{ rows: 2 }}>
|
67
|
+
{t(`${identifier}.description`)}
|
68
|
+
</Paragraph>
|
69
|
+
)}
|
70
|
+
<ModelFeatureTags functionCall={functionCall} tokens={tokens} vision={vision} />
|
71
|
+
</Flexbox>
|
72
|
+
);
|
73
|
+
});
|
74
|
+
|
75
|
+
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 { DiscoverModelItem } from '@/types/discover';
|
11
|
+
|
12
|
+
import Block from '../../../../features/Block';
|
13
|
+
import SuggestionItem from './SuggestionItem';
|
14
|
+
|
15
|
+
interface InfoSidebarProps extends FlexboxProps {
|
16
|
+
data: DiscoverModelItem;
|
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('models.more')}
|
29
|
+
moreLink={urlJoin('/discover/models', data.meta?.category || '')}
|
30
|
+
title={t('models.suggestions')}
|
31
|
+
>
|
32
|
+
{data?.suggestions?.length > 0 ? (
|
33
|
+
data?.suggestions.map((item) => (
|
34
|
+
<InterceptingLink
|
35
|
+
href={urlJoin('/discover/model', 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;
|
package/src/app/(main)/discover/(detail)/model/[...slugs]/features/ParameterList/ParameterItem.tsx
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
import { Divider } from 'antd';
|
2
|
+
import { useTheme } from 'antd-style';
|
3
|
+
import Link from 'next/link';
|
4
|
+
import { memo } from 'react';
|
5
|
+
import { useTranslation } from 'react-i18next';
|
6
|
+
import { Flexbox } from 'react-layout-kit';
|
7
|
+
|
8
|
+
import Statistic from '../../../../../components/Statistic';
|
9
|
+
|
10
|
+
const DEFAULT_DOC_URL = 'https://lobehub.com/docs/usage/agents/model';
|
11
|
+
|
12
|
+
export interface ParameterItemProps {
|
13
|
+
defaultValue: string | number;
|
14
|
+
desc: string;
|
15
|
+
docUrl?: string;
|
16
|
+
range?: (string | number)[];
|
17
|
+
type: string;
|
18
|
+
}
|
19
|
+
|
20
|
+
const formatNum = (num: string | number) => {
|
21
|
+
return typeof num === 'number' ? num.toFixed(2) : num.toUpperCase();
|
22
|
+
};
|
23
|
+
|
24
|
+
const ParameterItem = memo<ParameterItemProps>(
|
25
|
+
({ docUrl = DEFAULT_DOC_URL, desc, type, defaultValue, range }) => {
|
26
|
+
const { t } = useTranslation('discover');
|
27
|
+
const theme = useTheme();
|
28
|
+
|
29
|
+
return (
|
30
|
+
<Flexbox align={'flex-start'} gap={16}>
|
31
|
+
<p style={{ color: theme.colorTextSecondary, margin: 0 }}>
|
32
|
+
{desc}{' '}
|
33
|
+
<Link href={docUrl} target={'_blank'}>
|
34
|
+
{t('models.parameterList.docs')}
|
35
|
+
</Link>
|
36
|
+
</p>
|
37
|
+
<Divider dashed style={{ margin: 0 }} />
|
38
|
+
<Flexbox align={'center'} gap={16} horizontal style={{ paddingBottom: 8 }} wrap={'wrap'}>
|
39
|
+
<Statistic
|
40
|
+
gap={4}
|
41
|
+
title={t('models.parameterList.type')}
|
42
|
+
value={<code>{type.toUpperCase()}</code>}
|
43
|
+
valuePlacement={'bottom'}
|
44
|
+
valueStyle={{ fontSize: 14 }}
|
45
|
+
width={100}
|
46
|
+
/>
|
47
|
+
<Statistic
|
48
|
+
gap={4}
|
49
|
+
title={t('models.parameterList.defaultValue')}
|
50
|
+
value={formatNum(defaultValue)}
|
51
|
+
valuePlacement={'bottom'}
|
52
|
+
valueStyle={{ fontSize: 14 }}
|
53
|
+
width={100}
|
54
|
+
/>
|
55
|
+
{range && (
|
56
|
+
<Statistic
|
57
|
+
gap={4}
|
58
|
+
title={t('models.parameterList.range')}
|
59
|
+
value={range.map((item) => (type === 'float' ? formatNum(item) : item)).join(' ~ ')}
|
60
|
+
valuePlacement={'bottom'}
|
61
|
+
valueStyle={{ fontSize: 14 }}
|
62
|
+
width={100}
|
63
|
+
/>
|
64
|
+
)}
|
65
|
+
</Flexbox>
|
66
|
+
</Flexbox>
|
67
|
+
);
|
68
|
+
},
|
69
|
+
);
|
70
|
+
|
71
|
+
export default ParameterItem;
|