feat(frontend): 支持直接配置模型API密钥

This commit is contained in:
2026-08-30 10:57:05 +08:00
parent 0836807aa2
commit 352975d753
4 changed files with 73 additions and 11 deletions
+12
View File
@@ -49,6 +49,18 @@ export async function listProviderPresets(): Promise<ProviderPreset[]> {
return response.items
}
export async function getCredentialStatus(credentialId: string): Promise<boolean> {
const response = await apiClient.get<{ credential_id: string; configured: boolean }>(`/api/credentials/${encodeURIComponent(credentialId)}`)
return response.configured
}
export async function putCredential(credentialId: string, apiKey: string): Promise<void> {
await apiClient.put<{ credential_id: string; configured: boolean }>(
`/api/credentials/${encodeURIComponent(credentialId)}`,
{ api_key: apiKey },
)
}
export async function updateProvider(providerId: string, data: Partial<ProviderConfig>): Promise<ProviderConfig> {
const response = await apiClient.patch<ApiProviderConfig>(`/api/providers/${providerId}`, {
name: data.name,