@lobehub/lobehub 2.0.0-next.47 → 2.0.0-next.49
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 +50 -0
- package/README.md +1 -1
- package/README.zh-CN.md +1 -1
- 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 +17 -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/chat.json +1 -0
- package/locales/ar/discover.json +45 -0
- package/locales/ar/marketAuth.json +42 -0
- package/locales/ar/setting.json +94 -1
- package/locales/ar/topic.json +1 -0
- package/locales/bg-BG/chat.json +1 -0
- 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/bg-BG/topic.json +1 -0
- package/locales/de-DE/chat.json +1 -0
- 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/de-DE/topic.json +1 -0
- package/locales/en-US/chat.json +1 -0
- 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/en-US/topic.json +1 -0
- package/locales/es-ES/chat.json +1 -0
- 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/es-ES/topic.json +1 -0
- package/locales/fa-IR/chat.json +1 -0
- 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/fa-IR/topic.json +1 -0
- package/locales/fr-FR/chat.json +1 -0
- 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/fr-FR/topic.json +1 -0
- package/locales/it-IT/chat.json +1 -0
- 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/it-IT/topic.json +1 -0
- package/locales/ja-JP/chat.json +1 -0
- 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/ja-JP/topic.json +1 -0
- package/locales/ko-KR/chat.json +1 -0
- 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/ko-KR/topic.json +1 -0
- package/locales/nl-NL/chat.json +1 -0
- 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/nl-NL/topic.json +1 -0
- package/locales/pl-PL/chat.json +1 -0
- 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/pl-PL/topic.json +1 -0
- package/locales/pt-BR/chat.json +1 -0
- 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/pt-BR/topic.json +1 -0
- package/locales/ru-RU/chat.json +1 -0
- 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/ru-RU/topic.json +1 -0
- package/locales/tr-TR/chat.json +1 -0
- 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/tr-TR/topic.json +1 -0
- package/locales/vi-VN/chat.json +1 -0
- 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/vi-VN/topic.json +1 -0
- package/locales/zh-CN/chat.json +1 -0
- 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-CN/topic.json +1 -0
- package/locales/zh-TW/chat.json +1 -0
- 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/locales/zh-TW/topic.json +1 -0
- package/package.json +34 -27
- package/packages/agent-runtime/src/core/InterventionChecker.ts +5 -16
- package/packages/agent-runtime/src/core/__tests__/InterventionChecker.test.ts +27 -80
- package/packages/agent-runtime/src/core/__tests__/runtime.test.ts +32 -13
- package/packages/agent-runtime/src/core/runtime.ts +7 -3
- package/packages/agent-runtime/src/types/event.ts +2 -1
- package/packages/agent-runtime/src/types/generalAgent.ts +1 -0
- package/packages/agent-runtime/src/types/instruction.ts +3 -2
- package/packages/agent-runtime/src/types/state.ts +3 -1
- package/packages/const/src/url.ts +1 -0
- package/packages/conversation-flow/src/transformation/FlatListBuilder.ts +4 -1
- 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 +4 -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/obervability-otel/src/node.ts +15 -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/base.ts +2 -2
- package/packages/types/src/message/common/tools.ts +16 -0
- package/packages/types/src/message/db/item.ts +15 -1
- package/packages/types/src/message/ui/chat.ts +7 -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/types/src/tool/intervention.ts +2 -3
- package/packages/types/src/user/settings/tool.ts +15 -28
- package/packages/utils/src/imageToBase64.ts +17 -10
- package/packages/utils/src/index.ts +1 -1
- package/renovate.json +28 -11
- 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/components/topic/features/Topic/TopicListContent/TopicItem/TopicContent.tsx +1 -1
- package/src/app/[variants]/(main)/chat/session/features/SessionListContent/List/Item/Actions.tsx +1 -1
- 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/Messages/Group/GroupChildren.tsx +20 -15
- package/src/features/Conversation/Messages/Group/GroupContext.tsx +15 -0
- package/src/features/Conversation/Messages/Group/Tool/Inspector/BuiltinPluginTitle.tsx +2 -4
- package/src/features/Conversation/Messages/Group/Tool/Inspector/ToolTitle.tsx +3 -5
- package/src/features/Conversation/Messages/Group/Tool/Inspector/index.tsx +19 -7
- package/src/features/Conversation/Messages/Group/Tool/Render/Arguments/index.tsx +14 -12
- package/src/features/Conversation/Messages/Group/Tool/Render/Intervention/ApprovalActions.tsx +143 -0
- package/src/features/Conversation/Messages/Group/Tool/Render/Intervention/KeyValueEditor.tsx +213 -0
- package/src/features/Conversation/Messages/Group/Tool/Render/Intervention/ModeSelector.tsx +134 -0
- package/src/features/Conversation/Messages/Group/Tool/Render/Intervention/index.tsx +99 -0
- package/src/features/Conversation/Messages/Group/Tool/Render/RejectedResponse.tsx +45 -0
- package/src/features/Conversation/Messages/Group/Tool/Render/index.tsx +23 -1
- package/src/features/Conversation/Messages/Group/Tool/index.tsx +42 -18
- package/src/features/Conversation/Messages/Group/Tools.tsx +3 -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/chat.ts +22 -0
- package/src/locales/default/common.ts +1 -0
- 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/locales/default/topic.ts +1 -0
- 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 +6 -3
- package/src/server/services/discover/index.test.ts +153 -11
- package/src/server/services/discover/index.ts +339 -40
- package/src/server/services/message/index.ts +13 -0
- 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/message/index.ts +17 -2
- package/src/services/models.ts +2 -1
- package/src/store/chat/agents/GeneralChatAgent.ts +141 -24
- package/src/store/chat/agents/__tests__/GeneralChatAgent.test.ts +605 -0
- package/src/store/chat/agents/createAgentExecutors.ts +144 -26
- package/src/store/chat/agents/createToolEngine.ts +22 -0
- package/src/store/chat/slices/aiChat/actions/conversationControl.ts +106 -0
- package/src/store/chat/slices/aiChat/actions/streamingExecutor.ts +54 -26
- package/src/store/chat/slices/message/reducer.ts +2 -1
- package/src/store/chat/slices/plugin/actions/optimisticUpdate.ts +26 -1
- package/src/store/discover/slices/assistant/action.ts +20 -7
- package/src/store/user/slices/settings/action.ts +15 -0
- 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,207 @@
|
|
|
1
|
+
import { MarketSDK } from '@lobehub/market-sdk';
|
|
2
|
+
import { NextRequest, NextResponse } from 'next/server';
|
|
3
|
+
|
|
4
|
+
type RouteContext = {
|
|
5
|
+
params: Promise<{
|
|
6
|
+
segments?: string[];
|
|
7
|
+
}>;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const MARKET_BASE_URL = process.env.NEXT_PUBLIC_MARKET_BASE_URL || 'http://127.0.0.1:8787';
|
|
11
|
+
const ALLOWED_ENDPOINTS = new Set(['handoff', 'token', 'userinfo']);
|
|
12
|
+
|
|
13
|
+
const ensureEndpoint = (segments?: string[]) => {
|
|
14
|
+
if (!segments || segments.length === 0) {
|
|
15
|
+
return { error: 'missing_endpoint', status: 404 } as const;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if (segments.length !== 1) {
|
|
19
|
+
return { error: 'unsupported_nested_path', status: 404 } as const;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const endpoint = segments[0];
|
|
23
|
+
|
|
24
|
+
if (!ALLOWED_ENDPOINTS.has(endpoint)) {
|
|
25
|
+
return { error: 'unknown_endpoint', status: 404 } as const;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return { endpoint } as const;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const methodNotAllowed = (allowed: string[]) =>
|
|
32
|
+
NextResponse.json(
|
|
33
|
+
{
|
|
34
|
+
error: 'method_not_allowed',
|
|
35
|
+
message: `Allowed methods: ${allowed.join(', ')}`,
|
|
36
|
+
status: 'error',
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
headers: { Allow: allowed.join(', ') },
|
|
40
|
+
status: 405,
|
|
41
|
+
},
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
const handleProxy = async (req: NextRequest, context: RouteContext) => {
|
|
45
|
+
const market = new MarketSDK({
|
|
46
|
+
baseURL: MARKET_BASE_URL,
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
const { segments } = await context.params;
|
|
50
|
+
const endpointResult = ensureEndpoint(segments);
|
|
51
|
+
|
|
52
|
+
if ('error' in endpointResult) {
|
|
53
|
+
return NextResponse.json(
|
|
54
|
+
{
|
|
55
|
+
error: endpointResult.error,
|
|
56
|
+
message: 'Requested endpoint is not available.',
|
|
57
|
+
status: 'error',
|
|
58
|
+
},
|
|
59
|
+
{ status: endpointResult.status },
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const endpoint = endpointResult.endpoint;
|
|
64
|
+
|
|
65
|
+
switch (endpoint) {
|
|
66
|
+
case 'handoff': {
|
|
67
|
+
try {
|
|
68
|
+
const id = req.nextUrl.searchParams.get('id');
|
|
69
|
+
if (id) {
|
|
70
|
+
const handoff = await market.auth.getOAuthHandoff(id);
|
|
71
|
+
return new NextResponse(JSON.stringify(handoff), { status: 200 });
|
|
72
|
+
} else {
|
|
73
|
+
return NextResponse.json(
|
|
74
|
+
{
|
|
75
|
+
error: 'missing_id',
|
|
76
|
+
message: 'ID is required for handoff proxy.',
|
|
77
|
+
status: 'error',
|
|
78
|
+
},
|
|
79
|
+
{ status: 400 },
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
} catch (error) {
|
|
83
|
+
return NextResponse.json(
|
|
84
|
+
{
|
|
85
|
+
error: 'handoff_proxy_failed',
|
|
86
|
+
message: error instanceof Error ? error.message : 'Unknown error',
|
|
87
|
+
status: 'error',
|
|
88
|
+
},
|
|
89
|
+
{ status: 500 },
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
case 'token': {
|
|
95
|
+
if (req.method !== 'POST') {
|
|
96
|
+
return methodNotAllowed(['POST']);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
try {
|
|
100
|
+
const body = await req.text();
|
|
101
|
+
const form = new URLSearchParams(body);
|
|
102
|
+
|
|
103
|
+
const grantType = (form.get('grant_type') || 'authorization_code') as
|
|
104
|
+
| 'authorization_code'
|
|
105
|
+
| 'refresh_token';
|
|
106
|
+
|
|
107
|
+
if (grantType === 'authorization_code') {
|
|
108
|
+
const clientId = form.get('client_id');
|
|
109
|
+
const code = form.get('code');
|
|
110
|
+
const codeVerifier = form.get('code_verifier');
|
|
111
|
+
const redirectUri = form.get('redirect_uri');
|
|
112
|
+
|
|
113
|
+
const response = await market.auth.exchangeOAuthToken({
|
|
114
|
+
clientId: clientId as string,
|
|
115
|
+
code: code as string,
|
|
116
|
+
codeVerifier: codeVerifier as string,
|
|
117
|
+
grantType: 'authorization_code',
|
|
118
|
+
redirectUri: redirectUri as string,
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
return NextResponse.json(response);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if (grantType === 'refresh_token') {
|
|
125
|
+
const refreshToken = form.get('refresh_token');
|
|
126
|
+
const clientId = form.get('client_id');
|
|
127
|
+
|
|
128
|
+
const response = await market.auth.exchangeOAuthToken({
|
|
129
|
+
clientId: clientId ?? undefined,
|
|
130
|
+
grantType: 'refresh_token',
|
|
131
|
+
refreshToken: refreshToken as string,
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
return NextResponse.json(response);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
return NextResponse.json(
|
|
138
|
+
{
|
|
139
|
+
error: 'unsupported_grant_type',
|
|
140
|
+
message: `Unsupported grant_type: ${grantType}`,
|
|
141
|
+
status: 'error',
|
|
142
|
+
},
|
|
143
|
+
{ status: 400 },
|
|
144
|
+
);
|
|
145
|
+
} catch (error) {
|
|
146
|
+
console.error('[MarketOIDC] Failed to proxy token request:', error);
|
|
147
|
+
return NextResponse.json(
|
|
148
|
+
{
|
|
149
|
+
error: 'token_proxy_failed',
|
|
150
|
+
message: error instanceof Error ? error.message : 'Unknown error',
|
|
151
|
+
status: 'error',
|
|
152
|
+
},
|
|
153
|
+
{ status: 500 },
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
case 'userinfo': {
|
|
159
|
+
if (req.method !== 'POST') {
|
|
160
|
+
return methodNotAllowed(['POST']);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
try {
|
|
164
|
+
const { token } = (await req.json()) as { token?: string };
|
|
165
|
+
if (!token) {
|
|
166
|
+
return NextResponse.json(
|
|
167
|
+
{
|
|
168
|
+
error: 'missing_token',
|
|
169
|
+
message: 'Token is required for userinfo proxy.',
|
|
170
|
+
status: 'error',
|
|
171
|
+
},
|
|
172
|
+
{ status: 400 },
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
const response = await market.auth.getUserInfo(token);
|
|
177
|
+
return NextResponse.json(response);
|
|
178
|
+
} catch (error) {
|
|
179
|
+
console.error('[MarketOIDC] Failed to proxy userinfo request:', error);
|
|
180
|
+
return NextResponse.json(
|
|
181
|
+
{
|
|
182
|
+
error: 'userinfo_proxy_failed',
|
|
183
|
+
message: error instanceof Error ? error.message : 'Unknown error',
|
|
184
|
+
status: 'error',
|
|
185
|
+
},
|
|
186
|
+
{ status: 500 },
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
default: {
|
|
192
|
+
return NextResponse.json(
|
|
193
|
+
{
|
|
194
|
+
error: 'unsupported_endpoint',
|
|
195
|
+
message: 'Requested endpoint is not supported.',
|
|
196
|
+
status: 'error',
|
|
197
|
+
},
|
|
198
|
+
{ status: 404 },
|
|
199
|
+
);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
export const GET = (req: NextRequest, context: RouteContext) => handleProxy(req, context);
|
|
205
|
+
export const POST = (req: NextRequest, context: RouteContext) => handleProxy(req, context);
|
|
206
|
+
|
|
207
|
+
export const dynamic = 'force-dynamic';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Bot, Brain, Info, Mic2, Settings2, Sparkles } from 'lucide-react';
|
|
2
2
|
import { useRouter } from 'next/navigation';
|
|
3
3
|
import { useTranslation } from 'react-i18next';
|
|
4
|
+
|
|
4
5
|
import { CellProps } from '@/components/Cell';
|
|
5
6
|
import { isDeprecatedEdition } from '@/const/version';
|
|
6
7
|
import { SettingsTabs } from '@/store/global/initialState';
|
|
@@ -82,12 +82,14 @@ const PinList = () => {
|
|
|
82
82
|
hasList && (
|
|
83
83
|
<>
|
|
84
84
|
<Divider style={{ marginBottom: 8, marginTop: 4 }} />
|
|
85
|
-
<ScrollShadow height={
|
|
85
|
+
<ScrollShadow height={'100%'} hideScrollBar={true} size={40}>
|
|
86
86
|
<Flexbox gap={12} style={{ padding: '0' }}>
|
|
87
87
|
{list.map((item, index) => (
|
|
88
88
|
<Flexbox key={item.id} style={{ position: 'relative' }}>
|
|
89
89
|
<Tooltip
|
|
90
|
-
hotkey={
|
|
90
|
+
hotkey={
|
|
91
|
+
index < 9 ? hotkey.replaceAll(KeyEnum.Number, String(index + 1)) : undefined
|
|
92
|
+
}
|
|
91
93
|
placement={'right'}
|
|
92
94
|
title={sessionHelpers.getTitle(item.meta)}
|
|
93
95
|
>
|
|
@@ -100,7 +100,7 @@ const TopicContent = memo<TopicContentProps>(({ id, title, fav, showMore }) => {
|
|
|
100
100
|
{
|
|
101
101
|
icon: <Icon icon={ExternalLink} />,
|
|
102
102
|
key: 'openInNewWindow',
|
|
103
|
-
label: '
|
|
103
|
+
label: t('actions.openInNewWindow'),
|
|
104
104
|
onClick: () => {
|
|
105
105
|
openTopicInNewWindow(activeId, id);
|
|
106
106
|
},
|
package/src/app/[variants]/(main)/chat/session/features/SessionListContent/List/Item/Actions.tsx
CHANGED
|
@@ -97,7 +97,7 @@ const Actions = memo<ActionProps>(({ group, id, openCreateGroupModal, parentType
|
|
|
97
97
|
{
|
|
98
98
|
icon: <Icon icon={ExternalLink} />,
|
|
99
99
|
key: 'openInNewWindow',
|
|
100
|
-
label: '
|
|
100
|
+
label: t('openInNewWindow'),
|
|
101
101
|
onClick: ({ domEvent }: { domEvent: Event }) => {
|
|
102
102
|
domEvent.stopPropagation();
|
|
103
103
|
openSessionInNewWindow(id);
|
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { ProDescriptions } from '@ant-design/pro-components';
|
|
4
|
+
import { AgentItemDetail } from '@lobehub/market-sdk';
|
|
5
|
+
import { Tag } from 'antd';
|
|
6
|
+
import Image from 'next/image';
|
|
7
|
+
import { memo } from 'react';
|
|
8
|
+
import { useTranslation } from 'react-i18next';
|
|
9
|
+
import { Flexbox } from 'react-layout-kit';
|
|
10
|
+
|
|
11
|
+
import Tokens from '@/features/AgentSetting/AgentPrompt/TokenTag';
|
|
12
|
+
|
|
13
|
+
interface AgentConfig {
|
|
14
|
+
params?: {
|
|
15
|
+
max_tokens?: number;
|
|
16
|
+
temperature?: number;
|
|
17
|
+
top_p?: number;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
interface ChatConfig {
|
|
22
|
+
displayMode?: string;
|
|
23
|
+
enableHistoryCount?: boolean;
|
|
24
|
+
historyCount?: number;
|
|
25
|
+
searchMode?: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
interface TTSConfig {
|
|
29
|
+
ttsService?: string;
|
|
30
|
+
voice?: any;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
interface AgentInfoDescriptionProps {
|
|
34
|
+
agentConfig?: AgentConfig;
|
|
35
|
+
chatConfig?: ChatConfig;
|
|
36
|
+
files?: Array<{
|
|
37
|
+
enabled?: boolean;
|
|
38
|
+
id: string;
|
|
39
|
+
name: string;
|
|
40
|
+
type: string;
|
|
41
|
+
}>;
|
|
42
|
+
isRemote?: boolean;
|
|
43
|
+
knowledgeBases?: Array<{
|
|
44
|
+
enabled?: boolean;
|
|
45
|
+
id: string;
|
|
46
|
+
name: string;
|
|
47
|
+
}>;
|
|
48
|
+
meta?: Partial<AgentItemDetail> & {
|
|
49
|
+
description?: string;
|
|
50
|
+
name?: string;
|
|
51
|
+
title?: string;
|
|
52
|
+
};
|
|
53
|
+
model?: string;
|
|
54
|
+
plugins?: string[];
|
|
55
|
+
provider?: string;
|
|
56
|
+
systemRole?: string;
|
|
57
|
+
ttsConfig?: TTSConfig;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const AgentInfoDescription = memo<AgentInfoDescriptionProps>(
|
|
61
|
+
({
|
|
62
|
+
agentConfig,
|
|
63
|
+
chatConfig,
|
|
64
|
+
files = [],
|
|
65
|
+
isRemote = false,
|
|
66
|
+
knowledgeBases = [],
|
|
67
|
+
meta,
|
|
68
|
+
model,
|
|
69
|
+
plugins = [],
|
|
70
|
+
provider,
|
|
71
|
+
systemRole,
|
|
72
|
+
ttsConfig,
|
|
73
|
+
}) => {
|
|
74
|
+
const { t } = useTranslation('setting');
|
|
75
|
+
// 转换远程数据格式
|
|
76
|
+
const getProcessedData = () => {
|
|
77
|
+
if (!isRemote || !meta) {
|
|
78
|
+
return {
|
|
79
|
+
agentConfig,
|
|
80
|
+
chatConfig,
|
|
81
|
+
files,
|
|
82
|
+
knowledgeBases,
|
|
83
|
+
meta,
|
|
84
|
+
model,
|
|
85
|
+
plugins,
|
|
86
|
+
provider,
|
|
87
|
+
systemRole,
|
|
88
|
+
ttsConfig,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// 远程数据格式转换
|
|
93
|
+
const remoteData = meta;
|
|
94
|
+
const config = remoteData.config || {};
|
|
95
|
+
|
|
96
|
+
return {
|
|
97
|
+
agentConfig: {
|
|
98
|
+
params: config.model?.parameters || {},
|
|
99
|
+
},
|
|
100
|
+
chatConfig: config.chatConfig || {},
|
|
101
|
+
files: config.files || [],
|
|
102
|
+
knowledgeBases: config.knowledgeBases || [],
|
|
103
|
+
meta: {
|
|
104
|
+
avatar: remoteData?.avatar,
|
|
105
|
+
description: remoteData?.description,
|
|
106
|
+
name: remoteData?.versionName,
|
|
107
|
+
tags: remoteData?.tags ? [remoteData.tags] : undefined,
|
|
108
|
+
title: remoteData?.name,
|
|
109
|
+
},
|
|
110
|
+
model: config.model?.model,
|
|
111
|
+
plugins: config.plugins?.map((p: any) => (typeof p === 'string' ? p : p.identifier)) || [],
|
|
112
|
+
provider: config.model?.provider,
|
|
113
|
+
systemRole: config.systemRole,
|
|
114
|
+
ttsConfig: config.tts || {},
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
const {
|
|
119
|
+
agentConfig: processedAgentConfig,
|
|
120
|
+
chatConfig: processedChatConfig,
|
|
121
|
+
meta: processedMeta,
|
|
122
|
+
model: processedModel,
|
|
123
|
+
plugins: processedPlugins,
|
|
124
|
+
provider: processedProvider,
|
|
125
|
+
systemRole: processedSystemRole,
|
|
126
|
+
} = getProcessedData();
|
|
127
|
+
const unsetText = t('agentInfoDescription.value.unset');
|
|
128
|
+
const unnamedText = t('agentInfoDescription.value.untitled');
|
|
129
|
+
const pluginEmptyText = t('agentInfoDescription.plugins.empty');
|
|
130
|
+
const renderAvatar = (avatar: string | undefined) => {
|
|
131
|
+
if (!avatar || avatar === '未设置') return unsetText;
|
|
132
|
+
|
|
133
|
+
// 如果是 http 或 https 链接,显示图片
|
|
134
|
+
if (avatar.startsWith('http://') || avatar.startsWith('https://')) {
|
|
135
|
+
return (
|
|
136
|
+
<Image alt="avatar" height={40} src={avatar} style={{ borderRadius: '50%' }} width={40} />
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// 否则直接显示字符(emoji)
|
|
141
|
+
return (
|
|
142
|
+
<div
|
|
143
|
+
style={{
|
|
144
|
+
fontSize: '24px',
|
|
145
|
+
height: 40,
|
|
146
|
+
lineHeight: '40px',
|
|
147
|
+
textAlign: 'center',
|
|
148
|
+
width: 40,
|
|
149
|
+
}}
|
|
150
|
+
>
|
|
151
|
+
{avatar}
|
|
152
|
+
</div>
|
|
153
|
+
);
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
return (
|
|
157
|
+
<div style={{ height: '500px', overflow: 'auto' }}>
|
|
158
|
+
<Flexbox gap={16}>
|
|
159
|
+
{/* 基础信息 */}
|
|
160
|
+
<ProDescriptions
|
|
161
|
+
bordered
|
|
162
|
+
column={2}
|
|
163
|
+
columns={[
|
|
164
|
+
{
|
|
165
|
+
dataIndex: 'title',
|
|
166
|
+
key: 'title',
|
|
167
|
+
title: t('agentInfoDescription.basic.name'),
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
dataIndex: 'avatar',
|
|
171
|
+
key: 'avatar',
|
|
172
|
+
render: (_: any, record: any) => renderAvatar(record.avatar),
|
|
173
|
+
title: t('agentInfoDescription.basic.avatar'),
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
dataIndex: 'description',
|
|
177
|
+
key: 'description',
|
|
178
|
+
span: 2,
|
|
179
|
+
title: t('agentInfoDescription.basic.description'),
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
dataIndex: 'tags',
|
|
183
|
+
key: 'tags',
|
|
184
|
+
render: (_: any, record: any) => {
|
|
185
|
+
const tags = record.tags;
|
|
186
|
+
if (!tags || !tags.length) return unsetText;
|
|
187
|
+
return tags.map((tag: string, index: number) => (
|
|
188
|
+
<Tag color="blue" key={index}>
|
|
189
|
+
{tag}
|
|
190
|
+
</Tag>
|
|
191
|
+
));
|
|
192
|
+
},
|
|
193
|
+
span: 2,
|
|
194
|
+
title: t('agentInfoDescription.basic.tags'),
|
|
195
|
+
},
|
|
196
|
+
]}
|
|
197
|
+
dataSource={{
|
|
198
|
+
avatar: processedMeta?.avatar || unsetText,
|
|
199
|
+
description: processedMeta?.description || unsetText,
|
|
200
|
+
tags: processedMeta?.tags?.length ? processedMeta.tags : undefined,
|
|
201
|
+
title: processedMeta?.title || processedMeta?.name || unnamedText,
|
|
202
|
+
}}
|
|
203
|
+
size="small"
|
|
204
|
+
title={t('agentInfoDescription.basic.title')}
|
|
205
|
+
/>
|
|
206
|
+
|
|
207
|
+
{/* 角色设定 */}
|
|
208
|
+
<ProDescriptions
|
|
209
|
+
bordered
|
|
210
|
+
column={1}
|
|
211
|
+
columns={[
|
|
212
|
+
{
|
|
213
|
+
dataIndex: 'systemRole',
|
|
214
|
+
key: 'systemRole',
|
|
215
|
+
render: (_: any, record: any) => {
|
|
216
|
+
const text = record.systemRole;
|
|
217
|
+
if (text === unsetText) return text;
|
|
218
|
+
return text;
|
|
219
|
+
},
|
|
220
|
+
title: t('agentInfoDescription.role.systemRole'),
|
|
221
|
+
},
|
|
222
|
+
]}
|
|
223
|
+
dataSource={{
|
|
224
|
+
systemRole: processedSystemRole || unsetText,
|
|
225
|
+
}}
|
|
226
|
+
size="small"
|
|
227
|
+
title={
|
|
228
|
+
<Flexbox align={'center'} gap={8} horizontal>
|
|
229
|
+
<span>{t('agentInfoDescription.role.title')}</span>
|
|
230
|
+
<Tokens style={{ marginTop: 0 }} value={processedSystemRole || ''} />
|
|
231
|
+
</Flexbox>
|
|
232
|
+
}
|
|
233
|
+
/>
|
|
234
|
+
|
|
235
|
+
{/* 模型设置 */}
|
|
236
|
+
<ProDescriptions
|
|
237
|
+
bordered
|
|
238
|
+
column={2}
|
|
239
|
+
columns={[
|
|
240
|
+
{
|
|
241
|
+
dataIndex: 'model',
|
|
242
|
+
key: 'model',
|
|
243
|
+
title: t('agentInfoDescription.model.model'),
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
dataIndex: 'provider',
|
|
247
|
+
key: 'provider',
|
|
248
|
+
title: t('agentInfoDescription.model.provider'),
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
dataIndex: 'temperature',
|
|
252
|
+
key: 'temperature',
|
|
253
|
+
title: t('agentInfoDescription.model.temperature'),
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
dataIndex: 'topP',
|
|
257
|
+
key: 'topP',
|
|
258
|
+
title: 'Top P',
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
dataIndex: 'maxTokens',
|
|
262
|
+
key: 'maxTokens',
|
|
263
|
+
span: 2,
|
|
264
|
+
title: t('agentInfoDescription.model.maxTokens'),
|
|
265
|
+
},
|
|
266
|
+
]}
|
|
267
|
+
dataSource={{
|
|
268
|
+
maxTokens: processedAgentConfig?.params?.max_tokens ?? unsetText,
|
|
269
|
+
model: processedModel || unsetText,
|
|
270
|
+
provider: processedProvider || unsetText,
|
|
271
|
+
temperature: processedAgentConfig?.params?.temperature ?? unsetText,
|
|
272
|
+
topP: processedAgentConfig?.params?.top_p ?? unsetText,
|
|
273
|
+
}}
|
|
274
|
+
size="small"
|
|
275
|
+
title={t('agentInfoDescription.model.title')}
|
|
276
|
+
/>
|
|
277
|
+
|
|
278
|
+
{/* 聊天偏好 */}
|
|
279
|
+
<ProDescriptions
|
|
280
|
+
bordered
|
|
281
|
+
column={2}
|
|
282
|
+
columns={[
|
|
283
|
+
{
|
|
284
|
+
dataIndex: 'historyCount',
|
|
285
|
+
key: 'historyCount',
|
|
286
|
+
title: t('agentInfoDescription.chat.historyCount'),
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
dataIndex: 'enableHistoryCount',
|
|
290
|
+
key: 'enableHistoryCount',
|
|
291
|
+
title: t('agentInfoDescription.chat.enableHistoryCount'),
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
dataIndex: 'displayMode',
|
|
295
|
+
key: 'displayMode',
|
|
296
|
+
title: t('agentInfoDescription.chat.displayMode'),
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
dataIndex: 'searchMode',
|
|
300
|
+
key: 'searchMode',
|
|
301
|
+
title: t('agentInfoDescription.chat.searchMode'),
|
|
302
|
+
},
|
|
303
|
+
]}
|
|
304
|
+
dataSource={{
|
|
305
|
+
displayMode: processedChatConfig?.displayMode || unsetText,
|
|
306
|
+
enableHistoryCount: processedChatConfig?.enableHistoryCount
|
|
307
|
+
? t('agentInfoDescription.chat.yes')
|
|
308
|
+
: t('agentInfoDescription.chat.no'),
|
|
309
|
+
historyCount: processedChatConfig?.historyCount ?? unsetText,
|
|
310
|
+
searchMode: processedChatConfig?.searchMode || unsetText,
|
|
311
|
+
}}
|
|
312
|
+
size="small"
|
|
313
|
+
title={t('agentInfoDescription.chat.title')}
|
|
314
|
+
/>
|
|
315
|
+
|
|
316
|
+
<ProDescriptions
|
|
317
|
+
bordered
|
|
318
|
+
column={1}
|
|
319
|
+
columns={[
|
|
320
|
+
{
|
|
321
|
+
dataIndex: 'plugins',
|
|
322
|
+
key: 'plugins',
|
|
323
|
+
render: (_: any, record: any) => {
|
|
324
|
+
const pluginList = record.plugins;
|
|
325
|
+
if (!pluginList?.length) return pluginEmptyText;
|
|
326
|
+
return pluginList.map((plugin: string, index: number) => (
|
|
327
|
+
<Tag color="green" key={index}>
|
|
328
|
+
{plugin}
|
|
329
|
+
</Tag>
|
|
330
|
+
));
|
|
331
|
+
},
|
|
332
|
+
title: t('agentInfoDescription.plugins.title'),
|
|
333
|
+
},
|
|
334
|
+
]}
|
|
335
|
+
dataSource={{
|
|
336
|
+
plugins: processedPlugins?.length ? processedPlugins : [],
|
|
337
|
+
}}
|
|
338
|
+
size="small"
|
|
339
|
+
title={t('agentInfoDescription.plugins.count', {
|
|
340
|
+
count: processedPlugins?.length || 0,
|
|
341
|
+
})}
|
|
342
|
+
/>
|
|
343
|
+
</Flexbox>
|
|
344
|
+
</div>
|
|
345
|
+
);
|
|
346
|
+
},
|
|
347
|
+
);
|
|
348
|
+
|
|
349
|
+
export default AgentInfoDescription;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { memo } from 'react';
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import SmartAgentActionButton from './SmartAgentActionButton';
|
|
4
4
|
|
|
5
5
|
export const HeaderContent = memo<{ mobile?: boolean; modal?: boolean }>(({ modal }) => {
|
|
6
|
-
return <
|
|
6
|
+
return <SmartAgentActionButton modal={modal} />;
|
|
7
7
|
});
|
|
8
8
|
|
|
9
9
|
export default HeaderContent;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { CheckCircleOutlined } from '@ant-design/icons';
|
|
4
|
+
import { Button, Modal, Space } from 'antd';
|
|
5
|
+
import { useRouter } from 'next/navigation';
|
|
6
|
+
import { memo } from 'react';
|
|
7
|
+
import { useTranslation } from 'react-i18next';
|
|
8
|
+
|
|
9
|
+
interface PublishResultModalProps {
|
|
10
|
+
identifier?: string;
|
|
11
|
+
onCancel: () => void;
|
|
12
|
+
open: boolean;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const PublishResultModal = memo<PublishResultModalProps>(({ identifier, onCancel, open }) => {
|
|
16
|
+
const router = useRouter();
|
|
17
|
+
const { t } = useTranslation('setting');
|
|
18
|
+
const { t: tCommon } = useTranslation('common');
|
|
19
|
+
|
|
20
|
+
const handleGoToMarket = () => {
|
|
21
|
+
if (identifier) {
|
|
22
|
+
router.push(`/discover/assistant/${identifier}`);
|
|
23
|
+
}
|
|
24
|
+
onCancel();
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const successContent = (
|
|
28
|
+
<div style={{ padding: '20px 0', textAlign: 'center' }}>
|
|
29
|
+
<CheckCircleOutlined
|
|
30
|
+
style={{
|
|
31
|
+
color: '#52c41a',
|
|
32
|
+
display: 'block',
|
|
33
|
+
fontSize: '48px',
|
|
34
|
+
marginBottom: '16px',
|
|
35
|
+
}}
|
|
36
|
+
/>
|
|
37
|
+
<div style={{ fontSize: '16px', marginBottom: '24px' }}>
|
|
38
|
+
{t('marketPublish.resultModal.message')}
|
|
39
|
+
</div>
|
|
40
|
+
<Space>
|
|
41
|
+
<Button onClick={onCancel}>{tCommon('cancel')}</Button>
|
|
42
|
+
<Button onClick={handleGoToMarket} type="primary">
|
|
43
|
+
{t('marketPublish.resultModal.view')}
|
|
44
|
+
</Button>
|
|
45
|
+
</Space>
|
|
46
|
+
</div>
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<Modal
|
|
51
|
+
centered
|
|
52
|
+
closable={false}
|
|
53
|
+
footer={null}
|
|
54
|
+
onCancel={onCancel}
|
|
55
|
+
open={open}
|
|
56
|
+
title={null}
|
|
57
|
+
width={480}
|
|
58
|
+
>
|
|
59
|
+
{successContent}
|
|
60
|
+
</Modal>
|
|
61
|
+
);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
export default PublishResultModal;
|