Files
Hy2026/backend/Application/Matchmaking/RationaleBuilder.cs
T
Rafał Tyński 03e2d66ca4 feat(backend): add LLM provider abstraction, contextual ranking and explanations
Add a pluggable LLM provider with an offline template fallback, prompt builder, contextual match scoring (area/location boosts, availability), per-solution explanations and in-memory request limiting for cost control.
2026-10-04 02:52:45 +02:00

30 lines
818 B
C#

namespace TarninaHub.Application.Matchmaking;
/// <summary>
/// Deterministic, offline explanation of "why this fits". Used as the default
/// and as a fallback when the LLM is unavailable or rate-limited.
/// </summary>
public static class RationaleBuilder
{
public static string Build(bool challengeMatch, bool locationMatch, double score)
{
var reasons = new List<string>();
if (challengeMatch)
{
reasons.Add("ten sam obszar problemowy");
}
if (locationMatch)
{
reasons.Add("zbliżona lokalizacja");
}
reasons.Add(score >= 0.3
? "wysoka zbieżność opisu potrzeby"
: "zbieżność semantyczna opisu");
return "Proponowane dopasowanie: " + string.Join(", ", reasons) + ".";
}
}