@@ -1,6 +1,7 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Api.Services.Contracts;
|
||||
using Rag.Models.Requests;
|
||||
using Rag.Models.Responses;
|
||||
|
||||
namespace Api.Controllers;
|
||||
|
||||
@@ -19,7 +20,7 @@ public sealed class RagController : ControllerBase
|
||||
|
||||
[HttpPost("documents")]
|
||||
[RequestSizeLimit(10 * 1024 * 1024)]
|
||||
public async Task<IActionResult> IndexDocument(
|
||||
public async Task<ActionResult<IndexDocumentResponse>> IndexDocument(
|
||||
[FromForm] IFormFile? file,
|
||||
[FromForm] string? text,
|
||||
[FromForm] string? documentType,
|
||||
@@ -59,7 +60,7 @@ public sealed class RagController : ControllerBase
|
||||
}
|
||||
|
||||
[HttpPost("documents/json")]
|
||||
public async Task<IActionResult> IndexJsonDocument([FromBody] IndexDocumentRequest request, CancellationToken ct)
|
||||
public async Task<ActionResult<IndexDocumentResponse>> IndexJsonDocument([FromBody] IndexDocumentRequest request, CancellationToken ct)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -78,7 +79,7 @@ public sealed class RagController : ControllerBase
|
||||
}
|
||||
|
||||
[HttpPost("search")]
|
||||
public async Task<IActionResult> Search([FromBody] SearchRequest request, CancellationToken ct)
|
||||
public async Task<ActionResult<SearchResponse>> Search([FromBody] SearchRequest request, CancellationToken ct)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -96,7 +97,7 @@ public sealed class RagController : ControllerBase
|
||||
}
|
||||
|
||||
[HttpGet("documents/{id}")]
|
||||
public async Task<IActionResult> GetDocument(string id, CancellationToken ct)
|
||||
public async Task<ActionResult<RagDocumentDetailsResponse>> GetDocument(string id, CancellationToken ct)
|
||||
{
|
||||
_logger.LogInformation("Get document request received. DocumentId={DocumentId}", id);
|
||||
var document = await _ragService.GetDocumentAsync(id, ct);
|
||||
|
||||
Reference in New Issue
Block a user