@lobehub/lobehub 2.0.0-next.47 → 2.0.0-next.48
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.
- package/.env.example +11 -0
- package/CHANGELOG.md +17 -0
- package/apps/desktop/src/main/controllers/AuthCtr.ts +27 -2
- package/apps/desktop/src/main/core/infrastructure/ProtocolManager.ts +9 -4
- package/changelog/v1.json +5 -0
- package/docs/development/database-schema.dbml +2 -0
- package/docs/self-hosting/environment-variables/basic.mdx +49 -3
- package/docs/self-hosting/environment-variables/basic.zh-CN.mdx +49 -4
- package/locales/ar/discover.json +45 -0
- package/locales/ar/marketAuth.json +42 -0
- package/locales/ar/setting.json +94 -1
- package/locales/bg-BG/discover.json +45 -0
- package/locales/bg-BG/marketAuth.json +42 -0
- package/locales/bg-BG/setting.json +94 -1
- package/locales/de-DE/discover.json +45 -0
- package/locales/de-DE/marketAuth.json +42 -0
- package/locales/de-DE/setting.json +94 -1
- package/locales/en-US/discover.json +45 -0
- package/locales/en-US/marketAuth.json +42 -0
- package/locales/en-US/setting.json +94 -1
- package/locales/es-ES/discover.json +45 -0
- package/locales/es-ES/marketAuth.json +42 -0
- package/locales/es-ES/setting.json +94 -1
- package/locales/fa-IR/discover.json +45 -0
- package/locales/fa-IR/marketAuth.json +42 -0
- package/locales/fa-IR/setting.json +94 -1
- package/locales/fr-FR/discover.json +45 -0
- package/locales/fr-FR/marketAuth.json +42 -0
- package/locales/fr-FR/setting.json +94 -1
- package/locales/it-IT/discover.json +45 -0
- package/locales/it-IT/marketAuth.json +42 -0
- package/locales/it-IT/setting.json +94 -1
- package/locales/ja-JP/discover.json +45 -0
- package/locales/ja-JP/marketAuth.json +42 -0
- package/locales/ja-JP/setting.json +94 -1
- package/locales/ko-KR/discover.json +45 -0
- package/locales/ko-KR/marketAuth.json +42 -0
- package/locales/ko-KR/setting.json +94 -1
- package/locales/nl-NL/discover.json +45 -0
- package/locales/nl-NL/marketAuth.json +42 -0
- package/locales/nl-NL/setting.json +94 -1
- package/locales/pl-PL/discover.json +45 -0
- package/locales/pl-PL/marketAuth.json +42 -0
- package/locales/pl-PL/setting.json +94 -1
- package/locales/pt-BR/discover.json +45 -0
- package/locales/pt-BR/marketAuth.json +42 -0
- package/locales/pt-BR/setting.json +94 -1
- package/locales/ru-RU/discover.json +45 -0
- package/locales/ru-RU/marketAuth.json +42 -0
- package/locales/ru-RU/setting.json +94 -1
- package/locales/tr-TR/discover.json +45 -0
- package/locales/tr-TR/marketAuth.json +42 -0
- package/locales/tr-TR/setting.json +94 -1
- package/locales/vi-VN/discover.json +45 -0
- package/locales/vi-VN/marketAuth.json +42 -0
- package/locales/vi-VN/setting.json +94 -1
- package/locales/zh-CN/discover.json +45 -0
- package/locales/zh-CN/marketAuth.json +42 -0
- package/locales/zh-CN/setting.json +94 -1
- package/locales/zh-TW/discover.json +45 -0
- package/locales/zh-TW/marketAuth.json +42 -0
- package/locales/zh-TW/setting.json +94 -1
- package/package.json +27 -26
- package/packages/const/src/url.ts +1 -0
- package/packages/database/migrations/0044_add_tool_intervention.sql +1 -0
- package/packages/database/migrations/0044_high_toxin.sql +1 -0
- package/packages/database/migrations/0045_add_tool_intervention.sql +1 -0
- package/packages/database/migrations/meta/0039_snapshot.json +1 -1
- package/packages/database/migrations/meta/0044_snapshot.json +7813 -0
- package/packages/database/migrations/meta/0045_snapshot.json +8431 -0
- package/packages/database/migrations/meta/_journal.json +14 -0
- package/packages/database/src/core/migrations.json +36 -7
- package/packages/database/src/models/message.ts +1 -1
- package/packages/database/src/models/session.ts +42 -1
- package/packages/database/src/schemas/agent.ts +1 -0
- package/packages/database/src/schemas/message.ts +5 -8
- package/packages/electron-client-ipc/src/events/index.ts +6 -1
- package/packages/electron-client-ipc/src/events/remoteServer.ts +8 -0
- package/packages/fetch-sse/package.json +29 -0
- package/packages/{utils/src/fetch → fetch-sse/src}/__tests__/fetchSSE.test.ts +4 -4
- package/packages/{utils/src/fetch → fetch-sse/src}/__tests__/parseError.test.ts +7 -4
- package/packages/{utils/src/fetch → fetch-sse/src}/fetchSSE.ts +2 -2
- package/packages/{utils/src/fetch → fetch-sse/src}/parseError.ts +3 -3
- package/packages/model-bank/src/aiModels/mistral.ts +2 -1
- package/packages/model-runtime/src/core/contextBuilders/anthropic.test.ts +17 -11
- package/packages/model-runtime/src/core/contextBuilders/anthropic.ts +1 -1
- package/packages/model-runtime/src/core/contextBuilders/google.test.ts +1 -1
- package/packages/model-runtime/src/core/contextBuilders/google.ts +3 -6
- package/packages/model-runtime/src/core/contextBuilders/openai.test.ts +4 -2
- package/packages/model-runtime/src/core/contextBuilders/openai.ts +1 -1
- package/packages/model-runtime/src/core/openaiCompatibleFactory/createImage.test.ts +1 -1
- package/packages/model-runtime/src/core/openaiCompatibleFactory/createImage.ts +1 -1
- package/packages/model-runtime/src/core/openaiCompatibleFactory/index.test.ts +3 -6
- package/packages/model-runtime/src/core/streams/openai/responsesStream.test.ts +1 -1
- package/packages/model-runtime/src/helpers/mergeChatMethodOptions.ts +2 -1
- package/packages/model-runtime/src/providers/aihubmix/index.test.ts +1 -1
- package/packages/model-runtime/src/providers/anthropic/generateObject.test.ts +1 -1
- package/packages/model-runtime/src/providers/anthropic/index.test.ts +1 -1
- package/packages/model-runtime/src/providers/baichuan/index.test.ts +1 -1
- package/packages/model-runtime/src/providers/bedrock/index.test.ts +1 -1
- package/packages/model-runtime/src/providers/bfl/createImage.test.ts +4 -4
- package/packages/model-runtime/src/providers/bfl/createImage.ts +1 -1
- package/packages/model-runtime/src/providers/cloudflare/index.test.ts +1 -1
- package/packages/model-runtime/src/providers/cohere/index.test.ts +1 -1
- package/packages/model-runtime/src/providers/google/createImage.test.ts +2 -2
- package/packages/model-runtime/src/providers/google/createImage.ts +1 -1
- package/packages/model-runtime/src/providers/google/generateObject.test.ts +1 -1
- package/packages/model-runtime/src/providers/google/index.test.ts +1 -4
- package/packages/model-runtime/src/providers/groq/index.test.ts +1 -1
- package/packages/model-runtime/src/providers/hunyuan/index.test.ts +1 -1
- package/packages/model-runtime/src/providers/minimax/createImage.test.ts +1 -1
- package/packages/model-runtime/src/providers/mistral/index.test.ts +1 -1
- package/packages/model-runtime/src/providers/moonshot/index.test.ts +1 -1
- package/packages/model-runtime/src/providers/novita/index.test.ts +1 -1
- package/packages/model-runtime/src/providers/ollama/index.test.ts +43 -32
- package/packages/model-runtime/src/providers/ollama/index.ts +31 -7
- package/packages/model-runtime/src/providers/openrouter/index.test.ts +1 -1
- package/packages/model-runtime/src/providers/perplexity/index.test.ts +1 -1
- package/packages/model-runtime/src/providers/ppio/index.test.ts +1 -1
- package/packages/model-runtime/src/providers/qwen/createImage.test.ts +1 -1
- package/packages/model-runtime/src/providers/search1api/index.test.ts +1 -1
- package/packages/model-runtime/src/providers/siliconcloud/createImage.ts +1 -1
- package/packages/model-runtime/src/providers/taichu/index.test.ts +1 -1
- package/packages/model-runtime/src/providers/wenxin/index.test.ts +1 -1
- package/packages/model-runtime/src/providers/zhipu/index.test.ts +1 -1
- package/packages/model-runtime/src/utils/errorResponse.test.ts +1 -1
- package/packages/ssrf-safe-fetch/index.browser.ts +14 -0
- package/packages/ssrf-safe-fetch/package.json +8 -1
- package/packages/types/src/discover/assistants.ts +16 -0
- package/packages/types/src/index.ts +1 -0
- package/packages/types/src/message/common/tools.ts +10 -0
- package/packages/types/src/message/db/item.ts +15 -1
- package/packages/types/src/message/ui/params.ts +15 -1
- package/packages/types/src/meta.ts +4 -0
- package/packages/types/src/session/agentSession.ts +2 -0
- package/packages/utils/src/imageToBase64.ts +17 -10
- package/packages/utils/src/index.ts +1 -1
- package/src/app/(backend)/market/agent/[[...segments]]/route.ts +153 -0
- package/src/app/(backend)/market/oidc/[[...segments]]/route.ts +207 -0
- package/src/app/[variants]/(main)/(mobile)/me/settings/features/useCategory.tsx +1 -0
- package/src/app/[variants]/(main)/_layout/Desktop/SideBar/PinList/index.tsx +4 -2
- package/src/app/[variants]/(main)/chat/settings/features/AgentInfoDescription/index.tsx +349 -0
- package/src/app/[variants]/(main)/chat/settings/features/HeaderContent.tsx +2 -2
- package/src/app/[variants]/(main)/chat/settings/features/PublishResultModal/index.tsx +64 -0
- package/src/app/[variants]/(main)/chat/settings/features/SmartAgentActionButton/MarketPublishButton.tsx +196 -0
- package/src/app/[variants]/(main)/chat/settings/features/SmartAgentActionButton/MarketPublishModal.tsx +358 -0
- package/src/app/[variants]/(main)/chat/settings/features/SmartAgentActionButton/index.tsx +75 -0
- package/src/app/[variants]/(main)/discover/(detail)/assistant/AssistantDetailPage.tsx +11 -2
- package/src/app/[variants]/(main)/discover/(detail)/assistant/[...slugs]/Client.tsx +12 -1
- package/src/app/[variants]/(main)/discover/(detail)/assistant/[...slugs]/features/Details/Nav.tsx +19 -12
- package/src/app/[variants]/(main)/discover/(detail)/assistant/[...slugs]/features/Details/Overview/TagList.tsx +14 -5
- package/src/app/[variants]/(main)/discover/(detail)/assistant/[...slugs]/features/Details/Overview/index.tsx +2 -0
- package/src/app/[variants]/(main)/discover/(detail)/assistant/[...slugs]/features/Details/Related/index.tsx +14 -5
- package/src/app/[variants]/(main)/discover/(detail)/assistant/[...slugs]/features/Details/SystemRole/TagList.tsx +14 -5
- package/src/app/[variants]/(main)/discover/(detail)/assistant/[...slugs]/features/Details/SystemRole/index.tsx +43 -29
- package/src/app/[variants]/(main)/discover/(detail)/assistant/[...slugs]/features/Details/Versions/index.tsx +137 -0
- package/src/app/[variants]/(main)/discover/(detail)/assistant/[...slugs]/features/Details/index.tsx +2 -0
- package/src/app/[variants]/(main)/discover/(detail)/assistant/[...slugs]/features/Header.tsx +9 -10
- package/src/app/[variants]/(main)/discover/(detail)/assistant/[...slugs]/features/Sidebar/ActionButton/AddAgent.tsx +105 -14
- package/src/app/[variants]/(main)/discover/(detail)/assistant/[...slugs]/features/Sidebar/Related/index.tsx +20 -6
- package/src/app/[variants]/(main)/discover/(detail)/assistant/[...slugs]/features/StatusPage/index.tsx +113 -0
- package/src/app/[variants]/(main)/discover/(detail)/features/Breadcrumb.tsx +4 -3
- package/src/app/[variants]/(main)/discover/(list)/_layout/Desktop/Nav.tsx +3 -1
- package/src/app/[variants]/(main)/discover/(list)/assistant/AssistantPage.tsx +4 -1
- package/src/app/[variants]/(main)/discover/(list)/assistant/Client.tsx +6 -2
- package/src/app/[variants]/(main)/discover/(list)/assistant/features/Category/index.tsx +7 -3
- package/src/app/[variants]/(main)/discover/(list)/assistant/features/List/Item.tsx +13 -2
- package/src/app/[variants]/(main)/discover/(list)/assistant/features/MarketSourceSwitch.tsx +64 -0
- package/src/app/[variants]/(main)/discover/(list)/features/SortButton/index.tsx +26 -7
- package/src/app/[variants]/(main)/profile/_layout/Desktop/index.tsx +10 -10
- package/src/app/[variants]/(main)/settings/_layout/type.ts +1 -1
- package/src/app/[variants]/(main)/settings/agent/index.tsx +11 -10
- package/src/app/[variants]/(main)/settings/common/index.tsx +1 -1
- package/src/app/[variants]/(main)/settings/page.tsx +13 -10
- package/src/app/[variants]/(main)/settings/provider/ProviderMenu/Item.tsx +35 -36
- package/src/app/[variants]/(main)/settings/provider/ProviderMenu/SearchResult.tsx +5 -5
- package/src/app/[variants]/(main)/settings/provider/_layout/Desktop/Container.tsx +10 -4
- package/src/app/market-auth-callback/layout.tsx +15 -0
- package/src/app/market-auth-callback/page.tsx +196 -0
- package/src/features/AgentSetting/AgentPrompt/TokenTag.tsx +3 -2
- package/src/features/AgentSetting/AgentTTS/SelectWithTTSPreview.tsx +1 -1
- package/src/features/AgentSetting/store/action.ts +1 -1
- package/src/features/ChatInput/ActionBar/STT/browser.tsx +1 -1
- package/src/features/ChatInput/ActionBar/STT/openai.tsx +1 -1
- package/src/features/Conversation/components/Extras/TTS/InitPlayer.tsx +1 -1
- package/src/features/PluginTag/PluginStatus.tsx +1 -1
- package/src/hooks/useAgentOwnershipCheck.ts +143 -0
- package/src/instrumentation.node.ts +3 -2
- package/src/layout/AuthProvider/MarketAuth/MarketAuthProvider.tsx +364 -0
- package/src/layout/AuthProvider/MarketAuth/errors.ts +75 -0
- package/src/layout/AuthProvider/MarketAuth/index.ts +2 -0
- package/src/layout/AuthProvider/MarketAuth/oidc.ts +382 -0
- package/src/layout/AuthProvider/MarketAuth/types.ts +64 -0
- package/src/layout/AuthProvider/index.tsx +17 -4
- package/src/locales/default/discover.ts +46 -0
- package/src/locales/default/index.ts +2 -0
- package/src/locales/default/marketAuth.ts +42 -0
- package/src/locales/default/setting.ts +94 -1
- package/src/server/globalConfig/genServerAiProviderConfig.test.ts +5 -5
- package/src/server/globalConfig/genServerAiProviderConfig.ts +1 -1
- package/src/server/routers/lambda/market/index.ts +36 -14
- package/src/server/routers/lambda/message.ts +2 -2
- package/src/server/services/discover/index.test.ts +153 -11
- package/src/server/services/discover/index.ts +339 -40
- package/src/server/sitemap.ts +49 -35
- package/src/services/_url.ts +15 -1
- package/src/services/chat/chat.test.ts +5 -5
- package/src/services/chat/clientModelRuntime.test.ts +1 -1
- package/src/services/chat/index.ts +6 -6
- package/src/services/chat/types.ts +1 -2
- package/src/services/discover.ts +16 -5
- package/src/services/electron/remoteServer.ts +8 -1
- package/src/services/marketApi.ts +124 -0
- package/src/services/models.ts +2 -1
- package/src/store/discover/slices/assistant/action.ts +20 -7
- package/{packages/utils/src → src/utils}/electron/desktopRemoteRPCFetch.ts +1 -1
- package/{packages/utils/src → src/utils/server}/parseModels.ts +1 -2
- package/vitest.config.mts +2 -0
- package/packages/model-runtime/src/utils/imageToBase64.test.ts +0 -91
- package/packages/model-runtime/src/utils/imageToBase64.ts +0 -62
- package/src/app/[variants]/(main)/chat/settings/features/SubmitAgentButton/SubmitAgentModal.tsx +0 -98
- package/src/app/[variants]/(main)/chat/settings/features/SubmitAgentButton/index.tsx +0 -35
- package/src/app/[variants]/(main)/chat/settings/features/SubmitAgentButton/style.ts +0 -47
- /package/packages/{utils/src/fetch → fetch-sse/src}/headers.ts +0 -0
- /package/packages/{utils/src/fetch → fetch-sse/src}/index.ts +0 -0
- /package/packages/{utils/src/fetch → fetch-sse/src}/request.ts +0 -0
- /package/{packages/utils/src → src/utils/server}/__snapshots__/parseModels.test.ts.snap +0 -0
- /package/{packages/utils/src → src/utils/server}/parseModels.test.ts +0 -0
|
@@ -0,0 +1,358 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { ModalForm, ProFormText } from '@ant-design/pro-components';
|
|
4
|
+
import { AgentItemDetail } from '@lobehub/market-sdk';
|
|
5
|
+
import { type ModalProps } from '@lobehub/ui';
|
|
6
|
+
import { Col, Row, Spin } from 'antd';
|
|
7
|
+
import isEqual from 'fast-deep-equal';
|
|
8
|
+
import { memo, useCallback, useEffect, useState } from 'react';
|
|
9
|
+
import { useTranslation } from 'react-i18next';
|
|
10
|
+
|
|
11
|
+
import { message } from '@/components/AntdStaticMethods';
|
|
12
|
+
import { useTokenCount } from '@/hooks/useTokenCount';
|
|
13
|
+
import { useMarketAuth } from '@/layout/AuthProvider/MarketAuth';
|
|
14
|
+
import { marketApiService } from '@/services/marketApi';
|
|
15
|
+
import { useAgentStore } from '@/store/agent';
|
|
16
|
+
import { agentChatConfigSelectors, agentSelectors } from '@/store/agent/selectors';
|
|
17
|
+
import { useGlobalStore } from '@/store/global';
|
|
18
|
+
import { globalGeneralSelectors } from '@/store/global/selectors';
|
|
19
|
+
import { useSessionStore } from '@/store/session';
|
|
20
|
+
import { sessionMetaSelectors } from '@/store/session/selectors';
|
|
21
|
+
|
|
22
|
+
import AgentInfoDescription from '../AgentInfoDescription';
|
|
23
|
+
import PublishResultModal from '../PublishResultModal';
|
|
24
|
+
|
|
25
|
+
export type MarketPublishAction = 'submit' | 'upload';
|
|
26
|
+
|
|
27
|
+
interface MarketPublishModalProps extends ModalProps {
|
|
28
|
+
action: MarketPublishAction;
|
|
29
|
+
onSuccess?: () => void;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
interface MarketPublishFormValues {
|
|
33
|
+
changelog: string;
|
|
34
|
+
identifier?: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const MarketPublishModal = memo<MarketPublishModalProps>(
|
|
38
|
+
({ action, open, onCancel, onSuccess }) => {
|
|
39
|
+
const { t } = useTranslation('setting');
|
|
40
|
+
const isSubmit = action === 'submit';
|
|
41
|
+
const isUpload = action === 'upload';
|
|
42
|
+
|
|
43
|
+
const { session: marketSession, isAuthenticated } = useMarketAuth();
|
|
44
|
+
const meta = useSessionStore(sessionMetaSelectors.currentAgentMeta, isEqual);
|
|
45
|
+
const updateSessionMeta = useSessionStore((s) => s.updateSessionMeta);
|
|
46
|
+
|
|
47
|
+
const systemRole = useAgentStore(agentSelectors.currentAgentSystemRole);
|
|
48
|
+
const language = useGlobalStore(globalGeneralSelectors.currentLanguage);
|
|
49
|
+
const agentConfig = useAgentStore(agentSelectors.currentAgentConfig);
|
|
50
|
+
const chatConfig = useAgentStore(agentChatConfigSelectors.currentChatConfig);
|
|
51
|
+
const plugins = useAgentStore(agentSelectors.currentAgentPlugins);
|
|
52
|
+
const ttsConfig = useAgentStore(agentSelectors.currentAgentTTS);
|
|
53
|
+
const model = useAgentStore(agentSelectors.currentAgentModel);
|
|
54
|
+
const provider = useAgentStore(agentSelectors.currentAgentModelProvider);
|
|
55
|
+
const knowledgeBases = useAgentStore(agentSelectors.currentAgentKnowledgeBases);
|
|
56
|
+
const files = useAgentStore(agentSelectors.currentAgentFiles);
|
|
57
|
+
|
|
58
|
+
const [remoteAgentData, setRemoteAgentData] = useState<
|
|
59
|
+
(AgentItemDetail & { description?: string; name?: string; title?: string }) | null
|
|
60
|
+
>(null);
|
|
61
|
+
const [loadingRemoteData, setLoadingRemoteData] = useState(false);
|
|
62
|
+
const [showResultModal, setShowResultModal] = useState(false);
|
|
63
|
+
const [publishResult, setPublishResult] = useState<{ identifier?: string }>({});
|
|
64
|
+
|
|
65
|
+
const messageKey = isSubmit ? 'submit' : 'upload-version';
|
|
66
|
+
const loadingMessage = isSubmit
|
|
67
|
+
? t('marketPublish.modal.loading.submit')
|
|
68
|
+
: t('marketPublish.modal.loading.upload');
|
|
69
|
+
const submitButtonText = t('marketPublish.modal.submitButton');
|
|
70
|
+
const modalTitle = isSubmit
|
|
71
|
+
? t('marketPublish.modal.title.submit')
|
|
72
|
+
: t('marketPublish.modal.title.upload');
|
|
73
|
+
|
|
74
|
+
useEffect(() => {
|
|
75
|
+
if (!isUpload) return;
|
|
76
|
+
const marketIdentifier = meta?.marketIdentifier;
|
|
77
|
+
const accessToken = marketSession?.accessToken;
|
|
78
|
+
if (!open || !isAuthenticated || !accessToken || !marketIdentifier) return;
|
|
79
|
+
|
|
80
|
+
let cancelled = false;
|
|
81
|
+
|
|
82
|
+
const run = async () => {
|
|
83
|
+
try {
|
|
84
|
+
setLoadingRemoteData(true);
|
|
85
|
+
marketApiService.setAccessToken(accessToken);
|
|
86
|
+
const data = await marketApiService.getAgentDetail(marketIdentifier);
|
|
87
|
+
if (!cancelled) {
|
|
88
|
+
console.log('data', data);
|
|
89
|
+
setRemoteAgentData(data);
|
|
90
|
+
}
|
|
91
|
+
} catch (error) {
|
|
92
|
+
console.error('Failed to fetch remote agent data:', error);
|
|
93
|
+
if (!cancelled) {
|
|
94
|
+
message.error(t('marketPublish.modal.messages.fetchRemoteFailed'));
|
|
95
|
+
}
|
|
96
|
+
} finally {
|
|
97
|
+
if (!cancelled) {
|
|
98
|
+
setLoadingRemoteData(false);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
void run();
|
|
104
|
+
|
|
105
|
+
return () => {
|
|
106
|
+
cancelled = true;
|
|
107
|
+
};
|
|
108
|
+
}, [isAuthenticated, isUpload, marketSession?.accessToken, meta?.marketIdentifier, open]);
|
|
109
|
+
|
|
110
|
+
const tokenUsage = useTokenCount(systemRole);
|
|
111
|
+
|
|
112
|
+
const handleSubmit = useCallback(
|
|
113
|
+
async (values: MarketPublishFormValues) => {
|
|
114
|
+
if (!isAuthenticated || !marketSession?.accessToken) {
|
|
115
|
+
message.error(t('marketPublish.modal.messages.notAuthenticated'));
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
const changelog = values.changelog?.trim();
|
|
120
|
+
if (!changelog) {
|
|
121
|
+
message.error({ content: t('marketPublish.modal.changelog.required'), key: messageKey });
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
let identifier = meta?.marketIdentifier;
|
|
126
|
+
|
|
127
|
+
try {
|
|
128
|
+
message.loading({ content: loadingMessage, key: messageKey });
|
|
129
|
+
marketApiService.setAccessToken(marketSession.accessToken);
|
|
130
|
+
|
|
131
|
+
if (isSubmit) {
|
|
132
|
+
identifier = values.identifier?.trim();
|
|
133
|
+
if (!identifier) {
|
|
134
|
+
message.error({ content: t('marketPublish.modal.identifier.required'), key: messageKey });
|
|
135
|
+
return false;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
try {
|
|
139
|
+
await marketApiService.getAgentDetail(identifier);
|
|
140
|
+
} catch {
|
|
141
|
+
const createPayload: Record<string, unknown> = {
|
|
142
|
+
identifier,
|
|
143
|
+
name: meta?.title || '',
|
|
144
|
+
};
|
|
145
|
+
await marketApiService.createAgent(createPayload as any);
|
|
146
|
+
}
|
|
147
|
+
} else if (!identifier) {
|
|
148
|
+
message.error({ content: t('marketPublish.modal.messages.missingIdentifier'), key: messageKey });
|
|
149
|
+
return false;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
const versionPayload = {
|
|
153
|
+
avatar: meta?.avatar,
|
|
154
|
+
changelog,
|
|
155
|
+
config: {
|
|
156
|
+
chatConfig: {
|
|
157
|
+
displayMode: chatConfig?.displayMode,
|
|
158
|
+
enableHistoryCount: chatConfig?.enableHistoryCount,
|
|
159
|
+
historyCount: chatConfig?.historyCount,
|
|
160
|
+
maxTokens: agentConfig?.params?.max_tokens,
|
|
161
|
+
searchMode: chatConfig?.searchMode,
|
|
162
|
+
temperature: agentConfig?.params?.temperature,
|
|
163
|
+
topP: agentConfig?.params?.top_p,
|
|
164
|
+
},
|
|
165
|
+
description: meta?.description,
|
|
166
|
+
locale: language,
|
|
167
|
+
model: {
|
|
168
|
+
model,
|
|
169
|
+
parameters: agentConfig?.params,
|
|
170
|
+
provider,
|
|
171
|
+
},
|
|
172
|
+
plugins:
|
|
173
|
+
plugins?.map((plugin) => ({
|
|
174
|
+
enabled: true,
|
|
175
|
+
identifier: plugin,
|
|
176
|
+
settings: {},
|
|
177
|
+
})) || [],
|
|
178
|
+
systemRole: systemRole,
|
|
179
|
+
},
|
|
180
|
+
description: meta?.description || '',
|
|
181
|
+
identifier: identifier,
|
|
182
|
+
name: meta?.title || '',
|
|
183
|
+
tags: meta?.tags,
|
|
184
|
+
tokenUsage: tokenUsage,
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
try {
|
|
188
|
+
await marketApiService.createAgentVersion(versionPayload);
|
|
189
|
+
} catch (versionError) {
|
|
190
|
+
const errorMessage = versionError instanceof Error ? versionError.message : '未知错误';
|
|
191
|
+
message.error({
|
|
192
|
+
content: t('marketPublish.modal.messages.createVersionFailed', { message: errorMessage }),
|
|
193
|
+
key: messageKey,
|
|
194
|
+
});
|
|
195
|
+
return false;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
if (isSubmit) {
|
|
199
|
+
updateSessionMeta({ marketIdentifier: identifier });
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
setPublishResult({ identifier });
|
|
203
|
+
setShowResultModal(true);
|
|
204
|
+
|
|
205
|
+
message.destroy(messageKey);
|
|
206
|
+
onSuccess?.();
|
|
207
|
+
return true;
|
|
208
|
+
} catch (error) {
|
|
209
|
+
console.error('Market publish failed:', error);
|
|
210
|
+
const errorMessage = error instanceof Error ? error.message : '发布失败';
|
|
211
|
+
message.error({ content: t('marketPublish.modal.messages.publishFailed', { message: errorMessage }), key: messageKey });
|
|
212
|
+
return false;
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
[
|
|
216
|
+
agentConfig?.params,
|
|
217
|
+
chatConfig?.displayMode,
|
|
218
|
+
chatConfig?.enableHistoryCount,
|
|
219
|
+
chatConfig?.historyCount,
|
|
220
|
+
chatConfig?.searchMode,
|
|
221
|
+
isAuthenticated,
|
|
222
|
+
isSubmit,
|
|
223
|
+
language,
|
|
224
|
+
meta?.avatar,
|
|
225
|
+
meta?.description,
|
|
226
|
+
meta?.marketIdentifier,
|
|
227
|
+
meta?.tags,
|
|
228
|
+
meta?.title,
|
|
229
|
+
marketSession?.accessToken,
|
|
230
|
+
messageKey,
|
|
231
|
+
loadingMessage,
|
|
232
|
+
model,
|
|
233
|
+
onSuccess,
|
|
234
|
+
plugins,
|
|
235
|
+
provider,
|
|
236
|
+
systemRole,
|
|
237
|
+
tokenUsage,
|
|
238
|
+
updateSessionMeta,
|
|
239
|
+
],
|
|
240
|
+
);
|
|
241
|
+
|
|
242
|
+
return (
|
|
243
|
+
<>
|
|
244
|
+
<ModalForm<MarketPublishFormValues>
|
|
245
|
+
modalProps={{
|
|
246
|
+
bodyStyle: { height: '70vh', overflow: 'auto' },
|
|
247
|
+
destroyOnClose: true,
|
|
248
|
+
onCancel,
|
|
249
|
+
style: { minWidth: 750 },
|
|
250
|
+
}}
|
|
251
|
+
onFinish={handleSubmit}
|
|
252
|
+
open={open}
|
|
253
|
+
submitter={{
|
|
254
|
+
resetButtonProps: {
|
|
255
|
+
style: { display: 'none' },
|
|
256
|
+
},
|
|
257
|
+
submitButtonProps: {
|
|
258
|
+
children: submitButtonText,
|
|
259
|
+
},
|
|
260
|
+
}}
|
|
261
|
+
title={modalTitle}
|
|
262
|
+
width="80vw"
|
|
263
|
+
>
|
|
264
|
+
{isSubmit && (
|
|
265
|
+
<ProFormText
|
|
266
|
+
extra={t('marketPublish.modal.identifier.extra')}
|
|
267
|
+
label={t('marketPublish.modal.identifier.label')}
|
|
268
|
+
name="identifier"
|
|
269
|
+
placeholder={t('marketPublish.modal.identifier.placeholder')}
|
|
270
|
+
rules={[
|
|
271
|
+
{ message: t('marketPublish.modal.identifier.required'), required: true },
|
|
272
|
+
{ message: t('marketPublish.modal.identifier.patternError'), pattern: /^[\da-z-]+$/ },
|
|
273
|
+
{ max: 50, message: t('marketPublish.modal.identifier.lengthError'), min: 3 },
|
|
274
|
+
]}
|
|
275
|
+
/>
|
|
276
|
+
)}
|
|
277
|
+
|
|
278
|
+
<ProFormText
|
|
279
|
+
extra={t('marketPublish.modal.changelog.extra')}
|
|
280
|
+
label={t('marketPublish.modal.changelog.label')}
|
|
281
|
+
name="changelog"
|
|
282
|
+
placeholder={t('marketPublish.modal.changelog.placeholder')}
|
|
283
|
+
rules={[
|
|
284
|
+
{ message: t('marketPublish.modal.changelog.required'), required: true },
|
|
285
|
+
{ max: 500, message: t('marketPublish.modal.changelog.maxLengthError') },
|
|
286
|
+
]}
|
|
287
|
+
/>
|
|
288
|
+
|
|
289
|
+
{isUpload ? (
|
|
290
|
+
<Row gutter={24}>
|
|
291
|
+
<Col span={12}>
|
|
292
|
+
<div style={{ border: '1px solid #d9d9d9', borderRadius: '6px', padding: '16px' }}>
|
|
293
|
+
<h3 style={{ marginBottom: '16px', textAlign: 'center' }}>
|
|
294
|
+
{t('marketPublish.modal.comparison.remote')}
|
|
295
|
+
</h3>
|
|
296
|
+
{loadingRemoteData ? (
|
|
297
|
+
<div style={{ padding: '40px', textAlign: 'center' }}>
|
|
298
|
+
<Spin size="large" />
|
|
299
|
+
<div style={{ marginTop: '16px' }}>
|
|
300
|
+
{t('marketPublish.modal.loading.fetchingRemote')}
|
|
301
|
+
</div>
|
|
302
|
+
</div>
|
|
303
|
+
) : (
|
|
304
|
+
<AgentInfoDescription isRemote={true} meta={remoteAgentData || undefined} />
|
|
305
|
+
)}
|
|
306
|
+
</div>
|
|
307
|
+
</Col>
|
|
308
|
+
<Col span={12}>
|
|
309
|
+
<div style={{ border: '1px solid #d9d9d9', borderRadius: '6px', padding: '16px' }}>
|
|
310
|
+
<h3 style={{ marginBottom: '16px', textAlign: 'center' }}>
|
|
311
|
+
{t('marketPublish.modal.comparison.local')}
|
|
312
|
+
</h3>
|
|
313
|
+
<AgentInfoDescription
|
|
314
|
+
agentConfig={agentConfig}
|
|
315
|
+
chatConfig={chatConfig}
|
|
316
|
+
files={files}
|
|
317
|
+
knowledgeBases={knowledgeBases}
|
|
318
|
+
meta={meta}
|
|
319
|
+
model={model}
|
|
320
|
+
plugins={plugins}
|
|
321
|
+
provider={provider}
|
|
322
|
+
systemRole={systemRole}
|
|
323
|
+
ttsConfig={ttsConfig}
|
|
324
|
+
/>
|
|
325
|
+
</div>
|
|
326
|
+
</Col>
|
|
327
|
+
</Row>
|
|
328
|
+
) : (
|
|
329
|
+
<div style={{ marginTop: 24 }}>
|
|
330
|
+
<AgentInfoDescription
|
|
331
|
+
agentConfig={agentConfig}
|
|
332
|
+
chatConfig={chatConfig}
|
|
333
|
+
files={files}
|
|
334
|
+
knowledgeBases={knowledgeBases}
|
|
335
|
+
meta={meta}
|
|
336
|
+
model={model}
|
|
337
|
+
plugins={plugins}
|
|
338
|
+
provider={provider}
|
|
339
|
+
systemRole={systemRole}
|
|
340
|
+
ttsConfig={ttsConfig}
|
|
341
|
+
/>
|
|
342
|
+
</div>
|
|
343
|
+
)}
|
|
344
|
+
</ModalForm>
|
|
345
|
+
|
|
346
|
+
<PublishResultModal
|
|
347
|
+
identifier={publishResult.identifier}
|
|
348
|
+
onCancel={() => setShowResultModal(false)}
|
|
349
|
+
open={showResultModal}
|
|
350
|
+
/>
|
|
351
|
+
</>
|
|
352
|
+
);
|
|
353
|
+
},
|
|
354
|
+
);
|
|
355
|
+
|
|
356
|
+
MarketPublishModal.displayName = 'MarketPublishModal';
|
|
357
|
+
|
|
358
|
+
export default MarketPublishModal;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { Button } from '@lobehub/ui';
|
|
2
|
+
import isEqual from 'fast-deep-equal';
|
|
3
|
+
import { Loader2 } from 'lucide-react';
|
|
4
|
+
import { memo, useMemo } from 'react';
|
|
5
|
+
import { useTranslation } from 'react-i18next';
|
|
6
|
+
|
|
7
|
+
import { useAgentOwnershipCheck } from '@/hooks/useAgentOwnershipCheck';
|
|
8
|
+
import { useSessionStore } from '@/store/session';
|
|
9
|
+
import { sessionMetaSelectors } from '@/store/session/selectors';
|
|
10
|
+
|
|
11
|
+
import MarketPublishButton from './MarketPublishButton';
|
|
12
|
+
|
|
13
|
+
interface SmartAgentActionButtonProps {
|
|
14
|
+
modal?: boolean;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* 智能Agent操作按钮组件
|
|
19
|
+
* 根据Agent的所有权自动决定显示"提交新Agent"还是"上传新版本"按钮
|
|
20
|
+
*/
|
|
21
|
+
const SmartAgentActionButton = memo<SmartAgentActionButtonProps>(({ modal }) => {
|
|
22
|
+
const { t } = useTranslation('setting');
|
|
23
|
+
const meta = useSessionStore(sessionMetaSelectors.currentAgentMeta, isEqual);
|
|
24
|
+
const { isOwnAgent } = useAgentOwnershipCheck(meta?.marketIdentifier);
|
|
25
|
+
|
|
26
|
+
const buttonType = useMemo(() => {
|
|
27
|
+
if (!meta?.marketIdentifier) {
|
|
28
|
+
return 'submit';
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (isOwnAgent === null) {
|
|
32
|
+
return 'loading';
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (isOwnAgent === true) {
|
|
36
|
+
return 'upload';
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return 'submit';
|
|
40
|
+
}, [meta?.marketIdentifier, isOwnAgent]);
|
|
41
|
+
|
|
42
|
+
switch (buttonType) {
|
|
43
|
+
case 'upload': {
|
|
44
|
+
return (
|
|
45
|
+
<MarketPublishButton
|
|
46
|
+
action="upload"
|
|
47
|
+
marketIdentifier={meta?.marketIdentifier}
|
|
48
|
+
modal={modal}
|
|
49
|
+
/>
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
case 'submit': {
|
|
54
|
+
return (
|
|
55
|
+
<MarketPublishButton
|
|
56
|
+
action="submit"
|
|
57
|
+
marketIdentifier={meta?.marketIdentifier}
|
|
58
|
+
modal={modal}
|
|
59
|
+
/>
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
default: {
|
|
64
|
+
return (
|
|
65
|
+
<Button block={Boolean(modal)} disabled icon={Loader2} loading variant={'filled'}>
|
|
66
|
+
{t('checkingPermissions')}
|
|
67
|
+
</Button>
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
SmartAgentActionButton.displayName = 'SmartAgentActionButton';
|
|
74
|
+
|
|
75
|
+
export default SmartAgentActionButton;
|
|
@@ -5,8 +5,9 @@ import { Flexbox } from 'react-layout-kit';
|
|
|
5
5
|
import { useParams } from 'react-router-dom';
|
|
6
6
|
|
|
7
7
|
import { withSuspense } from '@/components/withSuspense';
|
|
8
|
+
import { useQuery } from '@/hooks/useQuery';
|
|
8
9
|
import { useDiscoverStore } from '@/store/discover';
|
|
9
|
-
import { DiscoverTab } from '@/types/discover';
|
|
10
|
+
import { AssistantMarketSource, DiscoverTab } from '@/types/discover';
|
|
10
11
|
|
|
11
12
|
import NotFound from '../components/NotFound';
|
|
12
13
|
import Breadcrumb from '../features/Breadcrumb';
|
|
@@ -14,6 +15,7 @@ import { TocProvider } from '../features/Toc/useToc';
|
|
|
14
15
|
import { DetailProvider } from './[...slugs]/features/DetailProvider';
|
|
15
16
|
import Details from './[...slugs]/features/Details';
|
|
16
17
|
import Header from './[...slugs]/features/Header';
|
|
18
|
+
import StatusPage from './[...slugs]/features/StatusPage';
|
|
17
19
|
import Loading from './[...slugs]/loading';
|
|
18
20
|
|
|
19
21
|
interface AssistantDetailPageProps {
|
|
@@ -24,13 +26,20 @@ const AssistantDetailPage = memo<AssistantDetailPageProps>(({ mobile }) => {
|
|
|
24
26
|
const params = useParams();
|
|
25
27
|
const slugs = params['*']?.split('/') || [];
|
|
26
28
|
const identifier = decodeURIComponent(slugs.join('/'));
|
|
29
|
+
const { version, source } = useQuery() as { source?: AssistantMarketSource; version?: string };
|
|
27
30
|
|
|
28
31
|
const useAssistantDetail = useDiscoverStore((s) => s.useAssistantDetail);
|
|
29
|
-
const { data, isLoading } = useAssistantDetail({ identifier });
|
|
32
|
+
const { data, isLoading } = useAssistantDetail({ identifier, source, version });
|
|
30
33
|
|
|
31
34
|
if (isLoading) return <Loading />;
|
|
32
35
|
if (!data) return <NotFound />;
|
|
33
36
|
|
|
37
|
+
// 检查助手状态
|
|
38
|
+
const status = (data as any)?.status;
|
|
39
|
+
if (status === 'unpublished' || status === 'archived' || status === 'deprecated') {
|
|
40
|
+
return <StatusPage status={status} />;
|
|
41
|
+
}
|
|
42
|
+
|
|
34
43
|
return (
|
|
35
44
|
<TocProvider>
|
|
36
45
|
<DetailProvider config={data}>
|
|
@@ -5,12 +5,15 @@ import { memo } from 'react';
|
|
|
5
5
|
import { Flexbox } from 'react-layout-kit';
|
|
6
6
|
|
|
7
7
|
import { withSuspense } from '@/components/withSuspense';
|
|
8
|
+
import { useQuery } from '@/hooks/useQuery';
|
|
8
9
|
import { useDiscoverStore } from '@/store/discover';
|
|
10
|
+
import { AssistantMarketSource } from '@/types/discover';
|
|
9
11
|
|
|
10
12
|
import { TocProvider } from '../../features/Toc/useToc';
|
|
11
13
|
import { DetailProvider } from './features/DetailProvider';
|
|
12
14
|
import Details from './features/Details';
|
|
13
15
|
import Header from './features/Header';
|
|
16
|
+
import StatusPage from './features/StatusPage';
|
|
14
17
|
import Loading from './loading';
|
|
15
18
|
|
|
16
19
|
interface ClientProps {
|
|
@@ -19,12 +22,20 @@ interface ClientProps {
|
|
|
19
22
|
}
|
|
20
23
|
|
|
21
24
|
const Client = memo<ClientProps>(({ identifier, mobile }) => {
|
|
25
|
+
const { version, source } = useQuery() as { source?: AssistantMarketSource; version?: string };
|
|
26
|
+
const marketSource = source as AssistantMarketSource | undefined;
|
|
22
27
|
const useAssistantDetail = useDiscoverStore((s) => s.useAssistantDetail);
|
|
23
|
-
const { data, isLoading } = useAssistantDetail({ identifier });
|
|
28
|
+
const { data, isLoading } = useAssistantDetail({ identifier, source: marketSource, version });
|
|
24
29
|
|
|
25
30
|
if (isLoading) return <Loading />;
|
|
26
31
|
if (!data) return notFound();
|
|
27
32
|
|
|
33
|
+
// 检查助手状态
|
|
34
|
+
const status = (data as any)?.status;
|
|
35
|
+
if (status === 'unpublished' || status === 'archived' || status === 'deprecated') {
|
|
36
|
+
return <StatusPage status={status} />;
|
|
37
|
+
}
|
|
38
|
+
|
|
28
39
|
return (
|
|
29
40
|
<TocProvider>
|
|
30
41
|
<DetailProvider config={data}>
|
package/src/app/[variants]/(main)/discover/(detail)/assistant/[...slugs]/features/Details/Nav.tsx
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { Icon, Tabs, Tag } from '@lobehub/ui';
|
|
4
4
|
import { createStyles } from 'antd-style';
|
|
5
|
-
import { BookOpenIcon, LayersIcon, ListIcon, SquareUserIcon } from 'lucide-react';
|
|
5
|
+
import { BookOpenIcon, HistoryIcon, LayersIcon, ListIcon, SquareUserIcon } from 'lucide-react';
|
|
6
6
|
import Link from 'next/link';
|
|
7
7
|
import { memo } from 'react';
|
|
8
8
|
import { useTranslation } from 'react-i18next';
|
|
@@ -10,7 +10,9 @@ import { Flexbox } from 'react-layout-kit';
|
|
|
10
10
|
import urlJoin from 'url-join';
|
|
11
11
|
|
|
12
12
|
import { SOCIAL_URL } from '@/const/branding';
|
|
13
|
-
import {
|
|
13
|
+
import { AGENTS_INDEX_GITHUB, AGENTS_OFFICIAL_URL } from '@/const/url';
|
|
14
|
+
import { useQuery } from '@/hooks/useQuery';
|
|
15
|
+
import { AssistantNavKey } from '@/types/discover';
|
|
14
16
|
|
|
15
17
|
import { useDetailContext } from '../DetailProvider';
|
|
16
18
|
|
|
@@ -38,6 +40,13 @@ const Nav = memo<NavProps>(({ mobile, setActiveTab, activeTab = AssistantNavKey.
|
|
|
38
40
|
const { t } = useTranslation('discover');
|
|
39
41
|
const { pluginCount, knowledgeCount, identifier } = useDetailContext();
|
|
40
42
|
const { styles } = useStyles();
|
|
43
|
+
const { source } = useQuery() as { source?: string };
|
|
44
|
+
const isLegacy = source === 'legacy';
|
|
45
|
+
const marketplaceLink = identifier
|
|
46
|
+
? isLegacy
|
|
47
|
+
? urlJoin(AGENTS_INDEX_GITHUB, 'tree/main/locales', identifier)
|
|
48
|
+
: urlJoin(AGENTS_OFFICIAL_URL, identifier)
|
|
49
|
+
: undefined;
|
|
41
50
|
|
|
42
51
|
const capabilitiesCount = Number(pluginCount) + Number(knowledgeCount);
|
|
43
52
|
|
|
@@ -76,9 +85,14 @@ const Nav = memo<NavProps>(({ mobile, setActiveTab, activeTab = AssistantNavKey.
|
|
|
76
85
|
t('assistants.details.capabilities.title')
|
|
77
86
|
),
|
|
78
87
|
},
|
|
88
|
+
{
|
|
89
|
+
icon: <Icon icon={HistoryIcon} size={16} />,
|
|
90
|
+
key: AssistantNavKey.Version,
|
|
91
|
+
label: t('assistants.details.version.title'),
|
|
92
|
+
},
|
|
79
93
|
{
|
|
80
94
|
icon: <Icon icon={ListIcon} size={16} />,
|
|
81
|
-
key:
|
|
95
|
+
key: AssistantNavKey.Related,
|
|
82
96
|
label: t('assistants.details.related.title'),
|
|
83
97
|
},
|
|
84
98
|
]}
|
|
@@ -95,15 +109,8 @@ const Nav = memo<NavProps>(({ mobile, setActiveTab, activeTab = AssistantNavKey.
|
|
|
95
109
|
<Link className={styles.link} href={SOCIAL_URL.discord} target={'_blank'}>
|
|
96
110
|
{t('mcp.details.nav.needHelp')}
|
|
97
111
|
</Link>
|
|
98
|
-
{identifier && (
|
|
99
|
-
<Link
|
|
100
|
-
className={styles.link}
|
|
101
|
-
href={urlJoin(
|
|
102
|
-
'https://github.com/lobehub/lobe-chat-agents/tree/main/locales',
|
|
103
|
-
identifier,
|
|
104
|
-
)}
|
|
105
|
-
target={'_blank'}
|
|
106
|
-
>
|
|
112
|
+
{identifier && marketplaceLink && (
|
|
113
|
+
<Link className={styles.link} href={marketplaceLink} target={'_blank'}>
|
|
107
114
|
{t('mcp.details.nav.viewSourceCode')}
|
|
108
115
|
</Link>
|
|
109
116
|
)}
|
|
@@ -7,6 +7,9 @@ import qs from 'query-string';
|
|
|
7
7
|
import { memo } from 'react';
|
|
8
8
|
import { Flexbox } from 'react-layout-kit';
|
|
9
9
|
|
|
10
|
+
import { useQuery } from '@/hooks/useQuery';
|
|
11
|
+
import { AssistantMarketSource } from '@/types/discover';
|
|
12
|
+
|
|
10
13
|
const useStyles = createStyles(({ token, css }) => {
|
|
11
14
|
return {
|
|
12
15
|
tag: css`
|
|
@@ -22,18 +25,24 @@ const useStyles = createStyles(({ token, css }) => {
|
|
|
22
25
|
|
|
23
26
|
const TagList = memo<{ tags: string[] }>(({ tags }) => {
|
|
24
27
|
const { styles } = useStyles();
|
|
28
|
+
const { source } = useQuery() as { source?: AssistantMarketSource };
|
|
29
|
+
const marketSource = source === 'legacy' ? 'legacy' : undefined;
|
|
25
30
|
const showTags = Boolean(tags?.length && tags?.length > 0);
|
|
26
31
|
return (
|
|
27
32
|
showTags && (
|
|
28
33
|
<Flexbox gap={8} horizontal wrap={'wrap'}>
|
|
29
34
|
{tags.map((tag) => (
|
|
30
35
|
<Link
|
|
31
|
-
href={qs.stringifyUrl(
|
|
32
|
-
|
|
33
|
-
|
|
36
|
+
href={qs.stringifyUrl(
|
|
37
|
+
{
|
|
38
|
+
query: {
|
|
39
|
+
q: tag,
|
|
40
|
+
source: marketSource,
|
|
41
|
+
},
|
|
42
|
+
url: '/discover/assistant',
|
|
34
43
|
},
|
|
35
|
-
|
|
36
|
-
|
|
44
|
+
{ skipNull: true },
|
|
45
|
+
)}
|
|
37
46
|
key={tag}
|
|
38
47
|
>
|
|
39
48
|
<Tag className={styles.tag}>{tag}</Tag>
|
|
@@ -3,6 +3,9 @@ import { memo } from 'react';
|
|
|
3
3
|
import { useTranslation } from 'react-i18next';
|
|
4
4
|
import { Flexbox } from 'react-layout-kit';
|
|
5
5
|
|
|
6
|
+
import { useQuery } from '@/hooks/useQuery';
|
|
7
|
+
import { AssistantMarketSource } from '@/types/discover';
|
|
8
|
+
|
|
6
9
|
import McpList from '../../../../../../(list)/assistant/features/List';
|
|
7
10
|
import Title from '../../../../../../features/Title';
|
|
8
11
|
import { useDetailContext } from '../../DetailProvider';
|
|
@@ -10,16 +13,22 @@ import { useDetailContext } from '../../DetailProvider';
|
|
|
10
13
|
const Related = memo(() => {
|
|
11
14
|
const { t } = useTranslation('discover');
|
|
12
15
|
const { related, category } = useDetailContext();
|
|
16
|
+
const { source } = useQuery() as { source?: AssistantMarketSource };
|
|
17
|
+
const marketSource = source === 'legacy' ? 'legacy' : undefined;
|
|
13
18
|
return (
|
|
14
19
|
<Flexbox gap={16}>
|
|
15
20
|
<Title
|
|
16
21
|
more={t('assistants.details.related.more')}
|
|
17
|
-
moreLink={qs.stringifyUrl(
|
|
18
|
-
|
|
19
|
-
|
|
22
|
+
moreLink={qs.stringifyUrl(
|
|
23
|
+
{
|
|
24
|
+
query: {
|
|
25
|
+
category,
|
|
26
|
+
source: marketSource,
|
|
27
|
+
},
|
|
28
|
+
url: '/discover/assistant',
|
|
20
29
|
},
|
|
21
|
-
|
|
22
|
-
|
|
30
|
+
{ skipNull: true },
|
|
31
|
+
)}
|
|
23
32
|
>
|
|
24
33
|
{t('assistants.details.related.listTitle')}
|
|
25
34
|
</Title>
|