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.
30 lines
818 B
C#
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) + ".";
|
|
}
|
|
}
|