FEAT-12a: provider-agnostic sale-ad AI core - AiOptions (env-only), German prompt builder w/ few-shot, OpenAI-compatible chat-completions client (no SDK)
This commit is contained in:
30
GerbilManagerWebAPI/SaleAd/AiOptions.cs
Normal file
30
GerbilManagerWebAPI/SaleAd/AiOptions.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
namespace GerbilManagerWebAPI.SaleAd
|
||||
{
|
||||
/// <summary>
|
||||
/// FEAT-12a: provider-agnostic AI configuration (section "AI").
|
||||
///
|
||||
/// Values come from ENVIRONMENT VARIABLES or user-secrets — NEVER from a
|
||||
/// committed appsettings file (Julian's directive). Env-var names:
|
||||
/// AI__BaseUrl, AI__ApiKey, AI__Model
|
||||
///
|
||||
/// Any endpoint that speaks the OpenAI-compatible chat-completions shape works:
|
||||
/// Google Gemini : https://generativelanguage.googleapis.com/v1beta/openai
|
||||
/// Groq : https://api.groq.com/openai/v1
|
||||
/// Mistral : https://api.mistral.ai/v1
|
||||
/// Ollama (lokal): http://<host>:11434/v1 (ApiKey beliebig, z. B. "ollama")
|
||||
/// </summary>
|
||||
public sealed class AiOptions
|
||||
{
|
||||
public const string SectionName = "AI";
|
||||
|
||||
public string? BaseUrl { get; set; }
|
||||
public string? ApiKey { get; set; }
|
||||
public string? Model { get; set; }
|
||||
|
||||
/// <summary>All three settings present -> the sale-ad endpoint is live.</summary>
|
||||
public bool IsConfigured =>
|
||||
!string.IsNullOrWhiteSpace(BaseUrl)
|
||||
&& !string.IsNullOrWhiteSpace(ApiKey)
|
||||
&& !string.IsNullOrWhiteSpace(Model);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user