dramaling-vocab-learning/backend/DramaLing.Api/Models/Configuration/GeminiOptions.cs

45 lines
1.4 KiB
C#
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.

using System.ComponentModel.DataAnnotations;
namespace DramaLing.Api.Models.Configuration;
public class GeminiOptions
{
public const string SectionName = "Gemini";
[Required(ErrorMessage = "Gemini API Key is required")]
public string ApiKey { get; set; } = string.Empty;
/// <summary>
/// API 請求超時時間(秒)
/// </summary>
[Range(1, 120, ErrorMessage = "Timeout must be between 1 and 120 seconds")]
public int TimeoutSeconds { get; set; } = 30;
/// <summary>
/// API 請求最大重試次數
/// </summary>
[Range(1, 10, ErrorMessage = "Max retries must be between 1 and 10")]
public int MaxRetries { get; set; } = 3;
/// <summary>
/// AI 回應最大 Token 數量
/// </summary>
[Range(100, 10000, ErrorMessage = "Max tokens must be between 100 and 10000")]
public int MaxOutputTokens { get; set; } = 2000;
/// <summary>
/// AI 回應的隨機性程度0.0-2.0
/// </summary>
[Range(0.0, 2.0, ErrorMessage = "Temperature must be between 0 and 2")]
public double Temperature { get; set; } = 0.7;
/// <summary>
/// 使用的 Gemini 模型名稱
/// </summary>
public string Model { get; set; } = "gemini-2.0-flash";
/// <summary>
/// Gemini API 基本 URL
/// </summary>
public string BaseUrl { get; set; } = "https://generativelanguage.googleapis.com";
}