using DramaLing.Api.Models.DTOs;
namespace DramaLing.Api.Services.AI;
///
/// AI 提供商管理器介面,負責選擇和管理多個 AI 提供商
///
public interface IAIProviderManager
{
///
/// 取得最佳 AI 提供商
///
/// 選擇策略
/// AI 提供商
Task GetBestProviderAsync(ProviderSelectionStrategy strategy = ProviderSelectionStrategy.Performance);
///
/// 取得所有可用的提供商
///
/// 可用提供商列表
Task> GetAvailableProvidersAsync();
///
/// 取得指定名稱的提供商
///
/// 提供商名稱
/// AI 提供商
Task GetProviderByNameAsync(string providerName);
///
/// 檢查所有提供商的健康狀態
///
/// 健康狀態報告
Task CheckAllProvidersHealthAsync();
///
/// 使用最佳提供商分析句子
///
/// 輸入文本
/// 分析選項
/// 選擇策略
/// 分析結果
Task AnalyzeSentenceAsync(string inputText, AnalysisOptions options,
ProviderSelectionStrategy strategy = ProviderSelectionStrategy.Performance);
}
///
/// 提供商選擇策略
///
public enum ProviderSelectionStrategy
{
///
/// 基於性能選擇(響應時間)
///
Performance,
///
/// 基於成本選擇(最便宜)
///
Cost,
///
/// 基於可靠性選擇(成功率)
///
Reliability,
///
/// 負載均衡
///
LoadBalance,
///
/// 使用主要提供商
///
Primary
}
///
/// 提供商健康狀態報告
///
public class ProviderHealthReport
{
public DateTime CheckedAt { get; set; }
public int TotalProviders { get; set; }
public int HealthyProviders { get; set; }
public List ProviderHealthInfos { get; set; } = new();
}
///
/// 提供商健康資訊
///
public class ProviderHealthInfo
{
public string ProviderName { get; set; } = string.Empty;
public bool IsHealthy { get; set; }
public int ResponseTimeMs { get; set; }
public string? ErrorMessage { get; set; }
public AIProviderStats Stats { get; set; } = new();
}