mirror of
https://github.com/zyycn/codex-proxy-rs.git
synced 2026-11-21 16:01:32 +00:00
Organize backend modules by responsibility, simplify runtime layers, and keep shared contracts with their owning modules. Split frontend account APIs and separate shared types from request implementations. Strengthen architecture checks for module dependencies and test layout. Co-authored-by: Codex <noreply@openai.com>
44 lines
1.2 KiB
TypeScript
44 lines
1.2 KiB
TypeScript
import type { RequestOptions } from '../../request'
|
|
import type { AccountIdParam } from './types'
|
|
import request from '../../request'
|
|
|
|
export interface AccountModelsResponse {
|
|
models: Array<{ id: string, label: string }>
|
|
observedAt?: string | null
|
|
observedAtDisplay?: string
|
|
}
|
|
|
|
export interface AccountModelCatalogResponse {
|
|
modelCount: number
|
|
observedAt: string
|
|
/** Codex `model_catalog_json` 的文件正文,原样落盘即可被客户端加载。 */
|
|
catalog: unknown
|
|
}
|
|
|
|
export function getAccountModels(data: AccountIdParam, options: RequestOptions = {}) {
|
|
return request<AccountModelsResponse>({
|
|
url: '/api/admin/accounts/models',
|
|
method: 'GET',
|
|
params: data,
|
|
...options,
|
|
})
|
|
}
|
|
|
|
export function getAccountModelCatalog(data: AccountIdParam, options: RequestOptions = {}) {
|
|
return request<AccountModelCatalogResponse>({
|
|
url: '/api/admin/accounts/models/catalog',
|
|
method: 'GET',
|
|
params: data,
|
|
...options,
|
|
})
|
|
}
|
|
|
|
export function refreshAccountModels(data: AccountIdParam, options: RequestOptions = {}) {
|
|
return request<AccountModelsResponse>({
|
|
url: '/api/admin/accounts/models/refresh',
|
|
method: 'POST',
|
|
data,
|
|
...options,
|
|
})
|
|
}
|