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,39 @@
namespace GerbilManagerWebAPI.SaleAd
{
/// <summary>
/// FEAT-12a: request/response contract of POST /gerbils/sale-ad — FROZEN,
/// mirror of the frontend (gerbil-manager-web/src/api/saleAd.ts).
/// </summary>
public sealed record SaleAdAnimal(
string Name,
string? Farbschlag,
/// <summary>ISO "YYYY-MM-DD" (frontend sends the DTO string verbatim).</summary>
string? DateOfBirth,
string? Notes);
public sealed record SaleAdRequest(
List<SaleAdAnimal> Animals,
/// <summary>e.g. "FREI" / "LOCKER RESERVIERT Anna" / "RESERVIERT".</summary>
string StatusLine,
/// <summary>Free-text style hints/wishes from the user.</summary>
string Hints);
public sealed record SaleAdResponse(string Text);
/// <summary>
/// Error body for the non-200 paths. The code string "AiKeyMissing" is FROZEN —
/// Kevin's UI maps it to the German "API-Schlüssel noch nicht konfiguriert" hint.
/// </summary>
public sealed record SaleAdError(string Code, string Message);
public enum SaleAdStatus
{
Ok,
/// <summary>AI section not (fully) configured -> HTTP 503, code "AiKeyMissing".</summary>
NotConfigured,
/// <summary>Provider call failed -> HTTP 502, code "AiUpstreamError".</summary>
UpstreamError,
}
public sealed record SaleAdResult(SaleAdStatus Status, string? Text, string? Error = null);
}