diff --git a/client/mcp_service.go b/client/mcp_service.go index fa19978f..c76a1c97 100644 --- a/client/mcp_service.go +++ b/client/mcp_service.go @@ -35,11 +35,19 @@ type MCPService struct { UpdatedAt string `json:"updated_at"` } -// MCPAuthConfig represents authentication configuration for MCP service +// MCPAuthConfig represents authentication configuration for MCP service. +// +// ClearAPIKey and ClearToken are write-only flags used in Update requests to +// explicitly remove a stored credential. The server never returns these +// fields in responses. type MCPAuthConfig struct { APIKey string `json:"api_key,omitempty"` Token string `json:"token,omitempty"` CustomHeaders map[string]string `json:"custom_headers,omitempty"` + + // Write-only clear flags. + ClearAPIKey bool `json:"clear_api_key,omitempty"` + ClearToken bool `json:"clear_token,omitempty"` } // MCPAdvancedConfig represents advanced configuration for MCP service diff --git a/frontend/src/api/mcp-service.ts b/frontend/src/api/mcp-service.ts index 1aa7a2ee..2b969dda 100644 --- a/frontend/src/api/mcp-service.ts +++ b/frontend/src/api/mcp-service.ts @@ -13,6 +13,10 @@ export interface MCPService { api_key?: string token?: string custom_headers?: Record + // Write-only flags — set to true in Update requests to explicitly remove + // the corresponding credential. The server never returns these fields. + clear_api_key?: boolean + clear_token?: boolean } advanced_config?: { timeout?: number diff --git a/frontend/src/api/model/index.ts b/frontend/src/api/model/index.ts index c108de4e..3ca7ac7a 100644 --- a/frontend/src/api/model/index.ts +++ b/frontend/src/api/model/index.ts @@ -26,6 +26,12 @@ export interface ModelConfig { // 会在调用远程模型 API 时附加到每个请求上。Authorization、Content-Type 等保留头会被忽略。 custom_headers?: Record; supports_vision?: boolean; // Whether the model accepts image/multimodal input + app_id?: string; + app_secret?: string; + // Write-only flags — set to true in Update requests to explicitly remove + // the corresponding credential. The server never returns these fields. + clear_api_key?: boolean; + clear_app_secret?: boolean; }; is_default?: boolean; is_builtin?: boolean; diff --git a/frontend/src/api/web-search-provider.ts b/frontend/src/api/web-search-provider.ts index 1a978d9b..5c0c8c95 100644 --- a/frontend/src/api/web-search-provider.ts +++ b/frontend/src/api/web-search-provider.ts @@ -13,6 +13,9 @@ export interface WebSearchProviderEntity { base_url?: string proxy_url?: string extra_config?: Record + // Write-only flag — set to true in Update requests to explicitly remove + // the stored API key. The server never returns this field. + clear_api_key?: boolean } is_default?: boolean created_at?: string diff --git a/frontend/src/components/ModelEditorDialog.vue b/frontend/src/components/ModelEditorDialog.vue index df8b45f1..6b694ed8 100644 --- a/frontend/src/components/ModelEditorDialog.vue +++ b/frontend/src/components/ModelEditorDialog.vue @@ -211,8 +211,16 @@ + + {{ t('secret.clearHint') }} + @@ -331,7 +339,7 @@