fix: narrow api key install session types

This commit is contained in:
RWDai
2026-05-12 15:33:53 +08:00
parent a7bab0ebd2
commit a8ff050518
2 changed files with 15 additions and 1 deletions

View File

@@ -1,6 +1,7 @@
import apiClient from './client'
import { cachedRequest, buildCacheKey } from '@/utils/cache'
import type { BillingSummary } from './auth'
import type { ApiKeyInstallSession, InstallSessionTargetSystem, InstallTargetCli } from './me'
// LDAP 配置导出结构
export interface LDAPConfigExport {
@@ -678,6 +679,18 @@ export const adminApi = {
return response.data
},
// 创建独立余额 Key 的 CLI 安装会话
async createApiKeyInstallSession(
keyId: string,
data: { target_cli: InstallTargetCli; target_system: InstallSessionTargetSystem }
): Promise<ApiKeyInstallSession> {
const response = await apiClient.post<ApiKeyInstallSession>(
`/api/admin/api-keys/${keyId}/install-sessions`,
data
)
return response.data
},
// 系统配置相关
// 获取所有系统配置
async getAllSystemConfigs(): Promise<Array<{ key: string; value: unknown; description?: string }>> {

View File

@@ -173,6 +173,7 @@ export interface ApiKey {
export type InstallTargetCli = 'claude_code' | 'codex_cli' | 'gemini_cli'
export type InstallTargetSystem = 'macos' | 'linux' | 'windows' | 'auto'
export type InstallSessionTargetSystem = Exclude<InstallTargetSystem, 'auto'>
export interface ApiKeyInstallSession {
install_code: string
@@ -287,7 +288,7 @@ export const meApi = {
async createApiKeyInstallSession(
keyId: string,
data: { target_cli: InstallTargetCli; target_system: InstallTargetSystem }
data: { target_cli: InstallTargetCli; target_system: InstallSessionTargetSystem }
): Promise<ApiKeyInstallSession> {
const response = await apiClient.post<ApiKeyInstallSession>(
`/api/users/me/api-keys/${keyId}/install-sessions`,