feat: initialize new React application structure with TypeScript, ESLint, and Prettier configurations, while removing legacy files and adding new components and pages for enhanced functionality

This commit is contained in:
Supra4E8C
2025-12-07 11:32:31 +08:00
parent 8e4132200d
commit 450964fb1a
144 changed files with 14223 additions and 21647 deletions

View File

@@ -0,0 +1,80 @@
/**
* 配置相关 API
*/
import { apiClient } from './client';
import type { Config } from '@/types';
import { normalizeConfigResponse } from './transformers';
export const configApi = {
/**
* 获取配置(会进行字段规范化)
*/
async getConfig(): Promise<Config> {
const raw = await apiClient.get('/config');
return normalizeConfigResponse(raw);
},
/**
* 获取原始配置(不做转换)
*/
getRawConfig: () => apiClient.get('/config'),
/**
* 更新 Debug 模式
*/
updateDebug: (enabled: boolean) => apiClient.put('/debug', { value: enabled }),
/**
* 更新代理 URL
*/
updateProxyUrl: (proxyUrl: string) => apiClient.put('/proxy-url', { value: proxyUrl }),
/**
* 清除代理 URL
*/
clearProxyUrl: () => apiClient.delete('/proxy-url'),
/**
* 更新重试次数
*/
updateRequestRetry: (retryCount: number) => apiClient.put('/request-retry', { value: retryCount }),
/**
* 配额回退:切换项目
*/
updateSwitchProject: (enabled: boolean) =>
apiClient.put('/quota-exceeded/switch-project', { value: enabled }),
/**
* 配额回退:切换预览模型
*/
updateSwitchPreviewModel: (enabled: boolean) =>
apiClient.put('/quota-exceeded/switch-preview-model', { value: enabled }),
/**
* 使用统计开关
*/
updateUsageStatistics: (enabled: boolean) =>
apiClient.put('/usage-statistics-enabled', { value: enabled }),
/**
* 请求日志开关
*/
updateRequestLog: (enabled: boolean) => apiClient.put('/request-log', { value: enabled }),
/**
* 写日志到文件开关
*/
updateLoggingToFile: (enabled: boolean) => apiClient.put('/logging-to-file', { value: enabled }),
/**
* WebSocket 鉴权开关
*/
updateWsAuth: (enabled: boolean) => apiClient.put('/ws-auth', { value: enabled }),
/**
* 重载配置
*/
reloadConfig: () => apiClient.post('/config/reload')
};