From 97b2152a8192df3e53d299b75e48e47c6d373e0f Mon Sep 17 00:00:00 2001 From: LTbinglingfeng Date: Thu, 28 May 2026 01:44:02 +0800 Subject: [PATCH] fix(providers): remove per-key headers input for openai-compatibility MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The backend OpenAICompatibilityAPIKey struct only has api-key and proxy-url (internal/config/config.go:570-577). PUT /openai-compatibility unmarshals into this struct (config_lists.go:439) and discards any unknown field, so per-entry headers submitted from the UI never persist and never reach the runtime request path. The GET response wrapper also has no headers field (config_auth_index.go:31-34). Drop the per-entry headers input from BaseProviderForm and the ApiKeyEntry/ApiKeyEntryInput types. Connectivity test and model discovery stop reading entry-level headers — they continue to apply provider-level headers, which is the supported contract. --- .../sheets/forms/BaseProviderForm.tsx | 32 ------------------- .../sheets/forms/useConnectivityTest.ts | 19 ----------- .../sheets/forms/useModelDiscovery.ts | 23 ++----------- src/features/providers/types.ts | 1 - .../providers/useProviderWorkbench.ts | 20 ------------ src/services/api/providers.ts | 2 -- src/services/api/transformers.ts | 4 +-- src/types/provider.ts | 1 - 8 files changed, 3 insertions(+), 99 deletions(-) diff --git a/src/features/providers/sheets/forms/BaseProviderForm.tsx b/src/features/providers/sheets/forms/BaseProviderForm.tsx index b69ae0a..96bbd93 100644 --- a/src/features/providers/sheets/forms/BaseProviderForm.tsx +++ b/src/features/providers/sheets/forms/BaseProviderForm.tsx @@ -55,15 +55,8 @@ const emptyModel = (): ModelEntryInput => ({ name: '', alias: '' }); const emptyApiKeyEntry = (): ApiKeyEntryInput => ({ apiKey: '', proxyUrl: '', - headersText: '', }); -const headersObjectToText = (headers?: Record): string => - Object.entries(headers ?? {}) - .filter(([k]) => k.trim()) - .map(([k, v]) => `${k}: ${v}`) - .join('\n'); - const stripDisableAllRule = (list?: string[]): string[] => (list ?? []).filter((s) => s.trim() !== '*'); @@ -124,7 +117,6 @@ function buildInitialForm( ? cfg.apiKeyEntries.map((entry) => ({ apiKey: entry.apiKey, proxyUrl: entry.proxyUrl ?? '', - headersText: headersObjectToText(entry.headers), authIndex: entry.authIndex, })) : [emptyApiKeyEntry()], @@ -823,30 +815,6 @@ export function BaseProviderForm({ placeholder="http://127.0.0.1:7890" /> -
- -