/** * 🔬 配置诊断医生 - 实时检查、智能建议、自动修复 * * 核心功能: * - 实时配置监控和验证 * - 智能问题诊断和修复建议 * - 自动配置优化 * - 性能影响分析 * - 用户友好的错误解释 */ import { UI18nConfig } from './types'; import { ConfigRecommendation, UserScenario } from './progressive-config'; /** * 配置问题等级 */ export declare enum ConfigIssueLevel { CRITICAL = "critical",// 阻塞性错误 WARNING = "warning",// 潜在问题 SUGGESTION = "suggestion",// 优化建议 INFO = "info" } /** * 配置问题详情 */ export interface ConfigIssue { id: string; level: ConfigIssueLevel; field: string; title: string; description: string; impact: string; solution: string; autoFixable: boolean; autoFixAction?: string; learnMoreUrl?: string; affectedFeatures: string[]; estimatedPerformanceImpact: number; } /** * 诊断报告 */ export interface ConfigDiagnosticReport { overallHealth: 'excellent' | 'good' | 'fair' | 'poor' | 'critical'; healthScore: number; issues: ConfigIssue[]; recommendations: ConfigRecommendation[]; estimatedMonthlyCost: { current: number; optimized: number; savings: number; }; performanceMetrics: { expectedLatency: string; cacheHitRate: string; reliability: string; }; securityLevel: 'high' | 'medium' | 'low'; timestamp: string; } /** * 自动修复结果 */ export interface AutoFixResult { appliedFixes: string[]; skippedFixes: Array<{ fix: string; reason: string; }>; newConfig: UI18nConfig; improvementSummary: { healthScoreImprovement: number; issuesResolved: number; performanceGain: string; }; } /** * 🩺 配置诊断医生类 */ export declare class ConfigDoctor { private config; private scenario?; private lastDiagnostic?; constructor(config: Partial, scenario?: UserScenario); /** * 🔍 完整诊断 * 对配置进行全面的健康检查 */ diagnose(): ConfigDiagnosticReport; /** * 🚀 快速健康检查 * 只检查关键问题,适合频繁调用 */ quickHealthCheck(): { healthy: boolean; criticalIssues: number; score: number; topIssue?: ConfigIssue; }; /** * 🔧 自动修复 * 自动应用可修复的配置问题 */ autoFix(confirmDangerous?: boolean): AutoFixResult; /** * 🎯 获取特定问题的解决方案 */ getSolutionFor(issueId: string): { stepByStepGuide: Array<{ step: number; title: string; description: string; code?: string; warning?: string; }>; estimatedTime: string; difficulty: 'easy' | 'medium' | 'hard'; alternativeSolutions?: string[]; } | null; /** * 📊 配置优化建议 */ getOptimizationPlan(): { phases: Array<{ name: string; description: string; fixes: string[]; expectedGain: string; estimatedTime: string; }>; totalImprovement: { healthScore: number; performance: string; cost: string; }; }; /** * 检测配置问题 * @private */ private detectIssues; /** * 生成配置建议 * @private */ private generateRecommendations; /** * 计算健康分数 * @private */ private calculateHealthScore; /** * 获取健康等级 * @private */ private getHealthLevel; /** * 估算成本 * @private */ private estimateCosts; /** * 分析性能指标 * @private */ private analyzePerformance; /** * 评估安全等级 * @private */ private assessSecurityLevel; /** * 应用修复 * @private */ private applyFix; /** * 生成分步解决方案 * @private */ private generateStepByStepSolution; /** * 验证API密钥格式 * @private */ private validateAPIKeyFormat; /** * 计算性能提升 * @private */ private calculatePerformanceGain; /** * 估算总性能提升 * @private */ private estimateTotalPerformanceGain; /** * 估算总成本节省 * @private */ private estimateTotalCostSavings; } /** * 便捷函数:创建配置诊断实例 */ export declare function createConfigDoctor(config: Partial, scenario?: UserScenario): ConfigDoctor; /** * 便捷函数:快速诊断配置 */ export declare function diagnoseConfig(config: Partial): ConfigDiagnosticReport; /** * 便捷函数:检查配置健康状态 */ export declare function checkConfigHealth(config: Partial): boolean; //# sourceMappingURL=config-doctor.d.ts.map