Files
Hy2026/backend/Application/Matchmaking/MatchScoring.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

38 lines
802 B
C#

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);
}
}