This commit is contained in:
2026-05-06 10:56:02 +03:00
parent 661bf461f9
commit 17266730fc
11 changed files with 562 additions and 1024 deletions
@@ -8,8 +8,8 @@ using System.Text.Json;
namespace Api.Controllers;
[ApiController]
[Route("api/rag")]
[EnableRateLimiting("rag")]
[Route("api/cv-matcher")]
[EnableRateLimiting("cv-matcher")]
public sealed class RagController : ControllerBase
{
private readonly IHttpClientFactory _httpClientFactory;
@@ -26,7 +26,7 @@ public sealed class RagController : ControllerBase
_logger = logger;
}
[HttpPost("cv")]
[HttpPost("upload")]
[RequestSizeLimit(8 * 1024 * 1024)]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
+1 -1
View File
@@ -164,7 +164,7 @@ try
});
// Policy: CV matcher, expensive because it calls AI APIs.
options.AddPolicy("rag", httpContext =>
options.AddPolicy("cv-matcher", httpContext =>
{
var ip = httpContext.Connection.RemoteIpAddress?.ToString() ?? "unknown";
return RateLimitPartition.GetFixedWindowLimiter(
-9
View File
@@ -1,9 +0,0 @@
namespace Api.Settings;
public sealed class OpenAiSettings
{
public string ApiKey { get; set; } = string.Empty;
public string ChatModel { get; set; } = "gpt-4o-mini";
public string EmbeddingModel { get; set; } = "text-embedding-3-small";
public int TimeoutSeconds { get; set; } = 60;
}
-11
View File
@@ -1,11 +0,0 @@
namespace Api.Settings;
public sealed class RagSettings
{
public int MaxPdfSizeMb { get; set; } = 5;
public int ChunkSize { get; set; } = 900;
public int ChunkOverlap { get; set; } = 150;
public int CvTtlMinutes { get; set; } = 60;
public int MaxJobTextChars { get; set; } = 20000;
public int TopK { get; set; } = 6;
}
+3 -13
View File
@@ -76,18 +76,8 @@
"FromEmail": "",
"SubjectPrefix": "[File Download]"
},
"OpenAI": {
"ApiKey": "",
"ChatModel": "gpt-4o-mini",
"EmbeddingModel": "text-embedding-3-small",
"TimeoutSeconds": 60
},
"Rag": {
"MaxPdfSizeMb": 5,
"ChunkSize": 900,
"ChunkOverlap": 150,
"CvTtlMinutes": 60,
"MaxJobTextChars": 20000,
"TopK": 6
"CvMatcherApi": {
"BaseUrl": "",
"InternalApiKey": ""
}
}
-4
View File
@@ -105,9 +105,5 @@
"ToEmail": "",
"FromEmail": "",
"SubjectPrefix": "[File Download]"
},
"CvMatcherApi": {
"BaseUrl": "",
"InternalApiKey": ""
}
}