From 39349bfb8c52d193a6b881613c23ef69c89c9cd8 Mon Sep 17 00:00:00 2001 From: sp mac bookpro 2605 Date: Mon, 27 Jul 2026 17:45:16 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=B8=BA=E5=A4=96=E9=83=A8=E5=B7=A5?= =?UTF-8?q?=E5=85=B7=E9=9B=86=E5=A2=9E=E5=8A=A0=E5=85=A8=E5=B1=80=E7=BB=9F?= =?UTF-8?q?=E4=B8=80=20headers=20=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/agents.ts | 1 + src/components/ExternalToolEditor.tsx | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/api/agents.ts b/src/api/agents.ts index 0a6a328..c752f29 100644 --- a/src/api/agents.ts +++ b/src/api/agents.ts @@ -57,6 +57,7 @@ export interface ExternalToolPluginPayload { baseUrl: string; authType: 'none' | 'bearer' | 'basic' | 'apiKey'; authConfig: Record; + headers?: Record | null; apis: ExternalToolApi[]; } diff --git a/src/components/ExternalToolEditor.tsx b/src/components/ExternalToolEditor.tsx index 6d988da..5f84086 100644 --- a/src/components/ExternalToolEditor.tsx +++ b/src/components/ExternalToolEditor.tsx @@ -19,8 +19,9 @@ interface ToolApiFormValue extends Omit { +interface ToolPluginFormValue extends Omit { authConfig?: string; + headers?: string; apis: ToolApiFormValue[]; } @@ -185,6 +186,7 @@ export default function ExternalToolEditor({ open, agentId, plugin, onClose, onS baseUrl: values.baseUrl.trim(), authType: values.authType, authConfig: parseJsonObject(values.authConfig, '认证配置', values.authType === 'none') || {}, + headers: parseJsonObject(values.headers, '统一请求头', true), apis: values.apis.map((item) => ({ name: item.name.trim(), description: item.description.trim(), @@ -235,6 +237,7 @@ export default function ExternalToolEditor({ open, agentId, plugin, onClose, onS baseUrl: plugin.baseUrl, authType: plugin.authType, authConfig: JSON.stringify(plugin.authConfig || {}, null, 2), + headers: JSON.stringify(plugin.headers || {}, null, 2), apis: plugin.apis.map((item) => ({ name: item.name, description: item.description, @@ -255,6 +258,7 @@ export default function ExternalToolEditor({ open, agentId, plugin, onClose, onS baseUrl: '', authType: 'bearer', authConfig: JSON.stringify({ token: '' }, null, 2), + headers: JSON.stringify({}, null, 2), apis: [{ ...EMPTY_API }], }, ); @@ -273,6 +277,13 @@ export default function ExternalToolEditor({ open, agentId, plugin, onClose, onS + + +