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.
38 lines
802 B
C#
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);
|
|
}
|
|
}
|