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,37 @@
|
||||
namespace TarninaHub.Application.Matchmaking;
|
||||
|
||||
/// <summary>
|
||||
/// Combines semantic similarity with context signals (area, location) and
|
||||
/// availability into a final 0..1 match score.
|
||||
/// </summary>
|
||||
public static class MatchScoring
|
||||
{
|
||||
private const double ChallengeBoost = 0.10;
|
||||
private const double LocationBoost = 0.05;
|
||||
|
||||
public static double Combine(
|
||||
double semanticScore,
|
||||
bool challengeMatch,
|
||||
bool locationMatch,
|
||||
bool available)
|
||||
{
|
||||
if (!available)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
var score = semanticScore;
|
||||
|
||||
if (challengeMatch)
|
||||
{
|
||||
score += ChallengeBoost;
|
||||
}
|
||||
|
||||
if (locationMatch)
|
||||
{
|
||||
score += LocationBoost;
|
||||
}
|
||||
|
||||
return Math.Clamp(score, 0, 1);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user