MemScan-EDR/src-csharp/MemScanEDR/Models/AIConfig.cs

48 lines
1.5 KiB
C#
Raw Permalink 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.

namespace MemScanEDR.Models;
public enum AIProvider
{
Heuristic,
OpenAICompatible,
Claude,
Local
}
public class AIConfig
{
public AIProvider Provider { get; set; } = AIProvider.Heuristic;
public string ApiKey { get; set; } = "";
public string BaseUrl { get; set; } = "";
public string Model { get; set; } = "";
public int MaxTokens { get; set; } = 2000;
public double Temperature { get; set; } = 0.3;
public int Timeout { get; set; } = 30;
/// <summary>S2.0: 启用本地AI内存分析无监督+监督)</summary>
public bool EnableLocalAI { get; set; } = true;
/// <summary>S2.0: 启用大模型辅助研判</summary>
public bool EnableLLMAssist { get; set; } = false;
public static AIConfig DefaultFor(AIProvider provider) => provider switch
{
AIProvider.OpenAICompatible => new AIConfig
{
Provider = AIProvider.OpenAICompatible,
BaseUrl = "https://api.openai.com/v1",
Model = "gpt-4o-mini"
},
AIProvider.Claude => new AIConfig
{
Provider = AIProvider.Claude,
BaseUrl = "https://api.anthropic.com",
Model = "claude-3-5-sonnet-20241022"
},
AIProvider.Local => new AIConfig
{
Provider = AIProvider.Local,
BaseUrl = "http://127.0.0.1:11434",
Model = "llama3"
},
_ => new AIConfig { Provider = AIProvider.Heuristic }
};
}