2025-09-29 17:38:56 +08:00

58 lines
1.6 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import request from '../request'
import type { ApiResponse } from '../types'
export interface SystemSettings {
siteEnabled: boolean
maintenanceTitle: string
maintenanceMessage: string
maintenanceStartTime?: string
maintenanceEndTime?: string
}
// 字典项接口
export interface DictItem {
value: string
text: string
color: string | null
jsonObject: any | null
label: string
title: string
}
export const SystemApi = {
// 获取系统设置
getSystemSettings(): Promise<ApiResponse<SystemSettings>> {
return request.get('/aiol/system/settings')
},
// 更新系统设置
updateSystemSettings(settings: Partial<SystemSettings>): Promise<ApiResponse<SystemSettings>> {
return request.put('/aiol/system/settings', settings)
},
// 检查网站状态
checkSiteStatus(): Promise<ApiResponse<{ enabled: boolean; message?: string }>> {
return request.get('/aiol/system/status')
},
// 切换网站状态
toggleSiteStatus(enabled: boolean): Promise<ApiResponse<{ enabled: boolean }>> {
return request.post('/aiol/system/toggle', { enabled })
},
// 获取字典项
getDictItems(dictCode: string, params?: string): Promise<ApiResponse<DictItem[]>> {
const timestamp = Date.now()
const url = params
? `/sys/dict/getDictItems/${dictCode},${params}?_t=${timestamp}`
: `/sys/dict/getDictItems/${dictCode}?_t=${timestamp}`
return request.get(url)
},
// 获取AI模型字典项LLM类型
getAiModelDict(): Promise<ApiResponse<DictItem[]>> {
const timestamp = Date.now()
return request.get(`/sys/dict/getDictItems/airag_model%20where%20model_type%20=%20'LLM',name,id?_t=${timestamp}`)
}
}