refactor: 清理未使用的类型定义和接口字段
- 移除 Provider 相关的 apiKeyEnvVar 字段(未实现的功能) - 清理 Server routes 中未使用的 Core 类型导入 - 清理 UI Message 接口中未使用的 metadata 字段
This commit is contained in:
@@ -54,7 +54,6 @@ export function ProviderEditor({
|
||||
|
||||
// Form state
|
||||
const [apiKey, setApiKey] = useState('');
|
||||
const [apiKeyEnvVar, setApiKeyEnvVar] = useState('');
|
||||
const [baseUrl, setBaseUrl] = useState('');
|
||||
const [enabled, setEnabled] = useState(true);
|
||||
|
||||
@@ -84,7 +83,6 @@ export function ProviderEditor({
|
||||
const config = result.data.config;
|
||||
// API key is not returned for security, but we show if it's configured via hasApiKey
|
||||
setApiKey('');
|
||||
setApiKeyEnvVar(result.data.apiKeyEnvVar || '');
|
||||
setBaseUrl(config.baseUrl || result.data.baseUrl || '');
|
||||
setEnabled(config.enabled !== false);
|
||||
} else {
|
||||
@@ -114,9 +112,6 @@ export function ProviderEditor({
|
||||
if (apiKey.trim()) {
|
||||
config.apiKey = apiKey;
|
||||
}
|
||||
if (apiKeyEnvVar.trim() && apiKeyEnvVar !== provider?.apiKeyEnvVar) {
|
||||
config.apiKeyEnvVar = apiKeyEnvVar;
|
||||
}
|
||||
if (baseUrl.trim() && baseUrl !== provider?.baseUrl) {
|
||||
config.baseUrl = baseUrl;
|
||||
}
|
||||
@@ -336,20 +331,6 @@ export function ProviderEditor({
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* API Key Env Var */}
|
||||
<div>
|
||||
<label className="block text-xs text-fg-muted mb-1">
|
||||
Environment Variable (alternative)
|
||||
</label>
|
||||
<Input
|
||||
value={apiKeyEnvVar}
|
||||
onChange={(e) => setApiKeyEnvVar(e.target.value)}
|
||||
placeholder={provider?.apiKeyEnvVar || 'PROVIDER_API_KEY'}
|
||||
/>
|
||||
<p className="text-xs text-fg-subtle mt-1">
|
||||
If no API key is set, this env var will be used
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Base URL Section */}
|
||||
|
||||
@@ -406,14 +406,6 @@ export function ProvidersPanel({ onClose, responsive = false }: ProvidersPanelPr
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* API Key Env Var */}
|
||||
{detail.apiKeyEnvVar && (
|
||||
<div className="text-xs">
|
||||
<span className="text-fg-muted">API Key Env:</span>{' '}
|
||||
<code className="text-fg-secondary bg-surface-subtle px-1 rounded">{detail.apiKeyEnvVar}</code>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Models */}
|
||||
<div className="space-y-2">
|
||||
<div className="flex items-center justify-between">
|
||||
@@ -688,14 +680,6 @@ export function ProvidersPanel({ onClose, responsive = false }: ProvidersPanelPr
|
||||
placeholder="http://localhost:11434/v1"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label className="text-xs text-fg-muted">API Key Env Var (optional)</label>
|
||||
<Input
|
||||
value={newProvider.apiKeyEnvVar || ''}
|
||||
onChange={(e) => setNewProvider((p) => ({ ...p, apiKeyEnvVar: e.target.value }))}
|
||||
placeholder="OLLAMA_API_KEY"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex justify-end gap-2 pt-2">
|
||||
<Button variant="ghost" onClick={() => setShowAddProvider(false)}>
|
||||
|
||||
Reference in New Issue
Block a user