diff --git a/src/components/deeplink/McpConfirmation.tsx b/src/components/deeplink/McpConfirmation.tsx new file mode 100644 index 000000000..00da52e89 --- /dev/null +++ b/src/components/deeplink/McpConfirmation.tsx @@ -0,0 +1,71 @@ +import { useMemo } from "react"; +import { DeepLinkImportRequest } from "../../lib/api/deeplink"; +import { decodeBase64Utf8 } from "../../lib/utils/base64"; + +export function McpConfirmation({ + request, +}: { + request: DeepLinkImportRequest; +}) { + const mcpServers = useMemo(() => { + if (!request.config) return null; + try { + const decoded = decodeBase64Utf8(request.config); + const parsed = JSON.parse(decoded); + return parsed.mcpServers || {}; + } catch (e) { + console.error("Failed to parse MCP config:", e); + return null; + } + }, [request.config]); + + const targetApps = request.apps?.split(",") || []; + + return ( +
+

批量导入 MCP Servers

+ +
+ +
+ {targetApps.map((app) => ( + + {app.trim()} + + ))} +
+
+ +
+ +
+ {mcpServers && + Object.entries(mcpServers).map(([id, spec]: [string, any]) => ( +
+
{id}
+
+ {spec.command + ? `Command: ${spec.command} ` + : `URL: ${spec.url} `} +
+
+ ))} +
+
+ + {request.enabled && ( +
+ ⚠️ + 导入后将立即写入所有指定应用的配置文件 +
+ )} +
+ ); +} diff --git a/src/components/deeplink/PromptConfirmation.tsx b/src/components/deeplink/PromptConfirmation.tsx new file mode 100644 index 000000000..8570763b3 --- /dev/null +++ b/src/components/deeplink/PromptConfirmation.tsx @@ -0,0 +1,60 @@ +import { useMemo } from "react"; +import { DeepLinkImportRequest } from "../../lib/api/deeplink"; +import { decodeBase64Utf8 } from "../../lib/utils/base64"; + +export function PromptConfirmation({ + request, +}: { + request: DeepLinkImportRequest; +}) { + const decodedContent = useMemo(() => { + if (!request.content) return ""; + return decodeBase64Utf8(request.content); + }, [request.content]); + + return ( +
+

导入系统提示词

+ +
+ +
{request.app}
+
+ +
+ +
{request.name}
+
+ + {request.description && ( +
+ +
{request.description}
+
+ )} + +
+ +
+          {decodedContent.substring(0, 500)}
+          {decodedContent.length > 500 && "..."}
+        
+
+ + {request.enabled && ( +
+ ⚠️ + 导入后将立即启用此提示词,其他提示词将被禁用 +
+ )} +
+ ); +} diff --git a/src/components/deeplink/SkillConfirmation.tsx b/src/components/deeplink/SkillConfirmation.tsx new file mode 100644 index 000000000..7594538fd --- /dev/null +++ b/src/components/deeplink/SkillConfirmation.tsx @@ -0,0 +1,56 @@ +import { DeepLinkImportRequest } from "../../lib/api/deeplink"; + +export function SkillConfirmation({ + request, +}: { + request: DeepLinkImportRequest; +}) { + return ( +
+

添加 Claude Skill 仓库

+ +
+ +
+ {request.repo} +
+
+ +
+ +
+ {request.directory} +
+
+ +
+
+ +
{request.branch || "main"}
+
+ + {request.skillsPath && ( +
+ +
{request.skillsPath}
+
+ )} +
+ +
+

ℹ️ 此操作将添加 Skill 仓库到列表。

+

+ 添加后,您可以在 Skills 管理界面中选择安装具体的 Skill。 +

+
+
+ ); +}