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.
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
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) + ".";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user