mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 17:30:23 +08:00
feat(admin): unify system data management and aggregate import/export
This commit is contained in:
@@ -91,6 +91,13 @@ export interface UsersExportData {
|
||||
standalone_keys?: StandaloneKeyExport[]
|
||||
}
|
||||
|
||||
export interface AggregateExportData {
|
||||
version: string
|
||||
exported_at: string
|
||||
config_data: ConfigExportData
|
||||
user_data: UsersExportData
|
||||
}
|
||||
|
||||
export interface UserGroupExport {
|
||||
id?: string
|
||||
name: string
|
||||
@@ -421,6 +428,16 @@ export interface UsersImportResponse {
|
||||
}
|
||||
}
|
||||
|
||||
export interface AggregateImportRequest extends AggregateExportData {
|
||||
merge_mode: 'skip' | 'overwrite' | 'error'
|
||||
}
|
||||
|
||||
export interface AggregateImportResponse {
|
||||
message: string
|
||||
config: ConfigImportResponse
|
||||
users: UsersImportResponse
|
||||
}
|
||||
|
||||
export interface ConfigImportResponse {
|
||||
message: string
|
||||
stats: {
|
||||
@@ -837,6 +854,21 @@ export const adminApi = {
|
||||
return response.data
|
||||
},
|
||||
|
||||
// 导出聚合数据(配置数据 + 用户数据)
|
||||
async exportAggregateData(): Promise<AggregateExportData> {
|
||||
const response = await apiClient.get<AggregateExportData>('/api/admin/system/data/export')
|
||||
return response.data
|
||||
},
|
||||
|
||||
// 导入聚合数据(配置数据 + 用户数据)
|
||||
async importAggregateData(data: AggregateImportRequest): Promise<AggregateImportResponse> {
|
||||
const response = await apiClient.post<AggregateImportResponse>(
|
||||
'/api/admin/system/data/import',
|
||||
data
|
||||
)
|
||||
return response.data
|
||||
},
|
||||
|
||||
// 查询 Provider 可用模型(从上游 API 获取)
|
||||
async queryProviderModels(providerId: string, apiKeyId?: string, forceRefresh = false): Promise<ProviderModelsQueryResponse> {
|
||||
const response = await apiClient.post<ProviderModelsQueryResponse>(
|
||||
|
||||
Reference in New Issue
Block a user