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:
2026-06-06 07:37:42 +02:00
parent adea82a0e7
commit f6bb13ca2f
4 changed files with 263 additions and 0 deletions

View 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://&lt;host&gt;: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);
}
}