mirror of
https://github.com/zyycn/codex-proxy-rs.git
synced 2026-11-06 16:06:08 +00:00
Show server envelope messages from the response interceptor, with shared transport fallbacks, cancellation handling, and explicit silent requests. Remove duplicate page notifications while preserving contextual batch and irreversible-operation feedback. Propagate request options through API modules and document notification ownership. Verify the notification-only tree with ESLint, vue-tsc, and a Vite build. Co-authored-by: Codex <noreply@openai.com>
104 lines
2.6 KiB
TypeScript
104 lines
2.6 KiB
TypeScript
import type { RequestOptions } from '../request'
|
|
import request from '../request'
|
|
|
|
export type RotationStrategy = 'smart' | 'quota_reset_priority' | 'round_robin' | 'sticky'
|
|
|
|
export interface RuntimeSettings {
|
|
modelMappings: Record<string, string>
|
|
refreshMarginSeconds: number
|
|
refreshConcurrency: number
|
|
maxConcurrentPerAccount: number
|
|
requestIntervalMs: number
|
|
rotationStrategy: RotationStrategy
|
|
minCodexDesktopVersion: string | null
|
|
minCodexCliVersion: string | null
|
|
usageRetentionDays: number
|
|
opsEventRetentionDays: number
|
|
auditRetentionDays: number
|
|
updatedAt: string
|
|
}
|
|
|
|
export type ClientArchitecture = 'x64' | 'arm64'
|
|
export type ClientDownloadSource = 'microsoft_store' | 'official_openai'
|
|
|
|
export interface ClientDownloadPackage {
|
|
architecture: ClientArchitecture
|
|
source: ClientDownloadSource
|
|
version: string | null
|
|
fileName: string
|
|
sizeBytes: number | null
|
|
downloadUrl: string
|
|
expiresAt: string | null
|
|
}
|
|
|
|
export interface CodexDesktopWindowsDownloads {
|
|
resolvedAt: string
|
|
cached: boolean
|
|
warning: string | null
|
|
packages: ClientDownloadPackage[]
|
|
}
|
|
|
|
export interface AdminApiKeyStatus {
|
|
exists: boolean
|
|
}
|
|
|
|
export interface RegeneratedAdminApiKey {
|
|
key: string
|
|
}
|
|
|
|
export interface DeletedAdminApiKey {
|
|
message: string
|
|
}
|
|
|
|
export function getSettings(options: RequestOptions = {}) {
|
|
return request<RuntimeSettings>({
|
|
url: '/api/admin/settings',
|
|
method: 'GET',
|
|
...options,
|
|
})
|
|
}
|
|
|
|
type UpdateSettingsParam = Omit<RuntimeSettings, 'updatedAt'>
|
|
|
|
export function updateSettings(data: UpdateSettingsParam, options: RequestOptions = {}) {
|
|
return request<RuntimeSettings>({
|
|
url: '/api/admin/settings/update',
|
|
method: 'POST',
|
|
data,
|
|
...options,
|
|
})
|
|
}
|
|
|
|
export function getAdminApiKeyStatus(options: RequestOptions = {}) {
|
|
return request<AdminApiKeyStatus>({
|
|
url: '/api/admin/settings/admin-api-key',
|
|
method: 'GET',
|
|
...options,
|
|
})
|
|
}
|
|
|
|
export function regenerateAdminApiKey(options: RequestOptions = {}) {
|
|
return request<RegeneratedAdminApiKey>({
|
|
url: '/api/admin/settings/admin-api-key/regenerate',
|
|
method: 'POST',
|
|
...options,
|
|
})
|
|
}
|
|
|
|
export function deleteAdminApiKey(options: RequestOptions = {}) {
|
|
return request<DeletedAdminApiKey>({
|
|
url: '/api/admin/settings/admin-api-key/delete',
|
|
method: 'POST',
|
|
...options,
|
|
})
|
|
}
|
|
|
|
export function getCodexDesktopWindowsDownloads(refresh = false, options: RequestOptions = {}) {
|
|
return request<CodexDesktopWindowsDownloads>({
|
|
url: '/api/admin/settings/client-downloads/codex-desktop/windows',
|
|
method: 'GET',
|
|
params: refresh ? { refresh: true } : undefined,
|
|
...options,
|
|
})
|
|
}
|