mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 09:20:22 +08:00
fix: narrow api key install session types
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import apiClient from './client'
|
import apiClient from './client'
|
||||||
import { cachedRequest, buildCacheKey } from '@/utils/cache'
|
import { cachedRequest, buildCacheKey } from '@/utils/cache'
|
||||||
import type { BillingSummary } from './auth'
|
import type { BillingSummary } from './auth'
|
||||||
|
import type { ApiKeyInstallSession, InstallSessionTargetSystem, InstallTargetCli } from './me'
|
||||||
|
|
||||||
// LDAP 配置导出结构
|
// LDAP 配置导出结构
|
||||||
export interface LDAPConfigExport {
|
export interface LDAPConfigExport {
|
||||||
@@ -678,6 +679,18 @@ export const adminApi = {
|
|||||||
return response.data
|
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 }>> {
|
async getAllSystemConfigs(): Promise<Array<{ key: string; value: unknown; description?: string }>> {
|
||||||
|
|||||||
@@ -173,6 +173,7 @@ export interface ApiKey {
|
|||||||
|
|
||||||
export type InstallTargetCli = 'claude_code' | 'codex_cli' | 'gemini_cli'
|
export type InstallTargetCli = 'claude_code' | 'codex_cli' | 'gemini_cli'
|
||||||
export type InstallTargetSystem = 'macos' | 'linux' | 'windows' | 'auto'
|
export type InstallTargetSystem = 'macos' | 'linux' | 'windows' | 'auto'
|
||||||
|
export type InstallSessionTargetSystem = Exclude<InstallTargetSystem, 'auto'>
|
||||||
|
|
||||||
export interface ApiKeyInstallSession {
|
export interface ApiKeyInstallSession {
|
||||||
install_code: string
|
install_code: string
|
||||||
@@ -287,7 +288,7 @@ export const meApi = {
|
|||||||
|
|
||||||
async createApiKeyInstallSession(
|
async createApiKeyInstallSession(
|
||||||
keyId: string,
|
keyId: string,
|
||||||
data: { target_cli: InstallTargetCli; target_system: InstallTargetSystem }
|
data: { target_cli: InstallTargetCli; target_system: InstallSessionTargetSystem }
|
||||||
): Promise<ApiKeyInstallSession> {
|
): Promise<ApiKeyInstallSession> {
|
||||||
const response = await apiClient.post<ApiKeyInstallSession>(
|
const response = await apiClient.post<ApiKeyInstallSession>(
|
||||||
`/api/users/me/api-keys/${keyId}/install-sessions`,
|
`/api/users/me/api-keys/${keyId}/install-sessions`,
|
||||||
|
|||||||
Reference in New Issue
Block a user