feat(backend): add semantic matchmaking with embedding pipeline
Add a pluggable embedding provider with an offline deterministic default, vector indexing for problems and innovations, cosine semantic ranking, similar cases and solution suggestions, area filtering and an admin reindex endpoint. Refresh the index when innovations or submissions change.
This commit is contained in:
@@ -15,10 +15,12 @@ namespace TarninaHub.Controllers;
|
||||
public class InnovationsController : ControllerBase
|
||||
{
|
||||
private readonly IInnovationService _innovations;
|
||||
private readonly IMatchmakingService _matchmakingService;
|
||||
|
||||
public InnovationsController(IInnovationService innovations)
|
||||
public InnovationsController(IInnovationService innovations, IMatchmakingService matchmakingService)
|
||||
{
|
||||
_innovations = innovations;
|
||||
_matchmakingService = matchmakingService;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
@@ -56,6 +58,8 @@ public class InnovationsController : ControllerBase
|
||||
|
||||
var created = await _innovations.CreateAsync(request, cancellationToken);
|
||||
|
||||
await _matchmakingService.IndexInnovationAsync(created.Id, cancellationToken);
|
||||
|
||||
return CreatedAtAction(nameof(GetById), new { innovationId = created.Id }, created);
|
||||
}
|
||||
|
||||
@@ -73,6 +77,11 @@ public class InnovationsController : ControllerBase
|
||||
|
||||
var updated = await _innovations.UpdateAsync(innovationId, request, cancellationToken);
|
||||
|
||||
if (updated is not null)
|
||||
{
|
||||
await _matchmakingService.IndexInnovationAsync(updated.Id, cancellationToken);
|
||||
}
|
||||
|
||||
return updated is null ? NotFound() : Ok(updated);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user