Comments
This commit is contained in:
@@ -2,6 +2,7 @@ using Microsoft.AspNetCore.Mvc;
|
||||
using Api.Services.Contracts;
|
||||
using Rag.Models.Requests;
|
||||
using Rag.Models.Responses;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
|
||||
namespace Api.Controllers;
|
||||
|
||||
@@ -20,6 +21,11 @@ public sealed class RagController : ControllerBase
|
||||
|
||||
[HttpPost("documents")]
|
||||
[RequestSizeLimit(10 * 1024 * 1024)]
|
||||
[SwaggerOperation(Summary = "Index document (multipart)", Description = "Indexes a PDF file or raw text document using multipart/form-data payload.")]
|
||||
[SwaggerResponse(StatusCodes.Status200OK, "Document indexed successfully")]
|
||||
[SwaggerResponse(StatusCodes.Status400BadRequest, "Invalid indexing request")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||
public async Task<ActionResult<IndexDocumentResponse>> IndexDocument(
|
||||
[FromForm] IndexDocumentUploadRequest request,
|
||||
CancellationToken ct)
|
||||
@@ -56,6 +62,11 @@ public sealed class RagController : ControllerBase
|
||||
}
|
||||
|
||||
[HttpPost("documents/json")]
|
||||
[SwaggerOperation(Summary = "Index document (JSON)", Description = "Indexes a text document sent as JSON.")]
|
||||
[SwaggerResponse(StatusCodes.Status200OK, "JSON document indexed successfully")]
|
||||
[SwaggerResponse(StatusCodes.Status400BadRequest, "Invalid JSON indexing request")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||
public async Task<ActionResult<IndexDocumentResponse>> IndexJsonDocument([FromBody] IndexDocumentRequest request, CancellationToken ct)
|
||||
{
|
||||
try
|
||||
@@ -75,6 +86,11 @@ public sealed class RagController : ControllerBase
|
||||
}
|
||||
|
||||
[HttpPost("search")]
|
||||
[SwaggerOperation(Summary = "Semantic search", Description = "Performs semantic retrieval over indexed documents.")]
|
||||
[SwaggerResponse(StatusCodes.Status200OK, "Search results returned")]
|
||||
[SwaggerResponse(StatusCodes.Status400BadRequest, "Invalid search request")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||
public async Task<ActionResult<SearchResponse>> Search([FromBody] SearchRequest request, CancellationToken ct)
|
||||
{
|
||||
try
|
||||
@@ -93,6 +109,11 @@ public sealed class RagController : ControllerBase
|
||||
}
|
||||
|
||||
[HttpGet("documents/{id}")]
|
||||
[SwaggerOperation(Summary = "Get document details", Description = "Returns indexed document details for the provided document id.")]
|
||||
[SwaggerResponse(StatusCodes.Status200OK, "Document details returned")]
|
||||
[SwaggerResponse(StatusCodes.Status404NotFound, "Document was not found")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
public async Task<ActionResult<RagDocumentDetailsResponse>> GetDocument(string id, CancellationToken ct)
|
||||
{
|
||||
_logger.LogInformation("Get document request received. DocumentId={DocumentId}", id);
|
||||
|
||||
Reference in New Issue
Block a user