Refactor and update Swagger docs in Program.cs

Updated Swagger documentation title and endpoint description in Program.cs to reflect a shift towards general SQL Database usage instead of specific SQL Server implementation. Simplified the document upload endpoint by removing the `LinkGenerator` parameter and enhancing clarity in operation descriptions, emphasizing support for uploading documents to SQL databases for indexing and question answering purposes.
This commit is contained in:
Marco Minerva
2024-07-02 10:48:03 +02:00
parent f3a0ec7c31
commit 01016e54e8
+5 -5
View File
@@ -36,7 +36,7 @@ builder.Services.AddScoped<VectorSearchService>();
builder.Services.AddEndpointsApiExplorer(); builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen(options => builder.Services.AddSwaggerGen(options =>
{ {
options.SwaggerDoc("v1", new OpenApiInfo { Title = "SQL Server Vector Search API", Version = "v1" }); options.SwaggerDoc("v1", new OpenApiInfo { Title = "SQL Database Vector Search API", Version = "v1" });
options.AddDefaultResponse(); options.AddDefaultResponse();
options.AddFormFile(); options.AddFormFile();
@@ -59,7 +59,7 @@ if (app.Environment.IsDevelopment())
app.UseSwaggerUI(options => app.UseSwaggerUI(options =>
{ {
options.RoutePrefix = string.Empty; options.RoutePrefix = string.Empty;
options.SwaggerEndpoint("/swagger/v1/swagger.json", "Kernel Memory Service API v1"); options.SwaggerEndpoint("/swagger/v1/swagger.json", "SQL Database Vector Search API v1");
options.InjectStylesheet("/css/swagger.css"); options.InjectStylesheet("/css/swagger.css");
}); });
} }
@@ -78,7 +78,7 @@ documentsApiGroup.MapGet(string.Empty, async (VectorSearchService vectorSearchSe
return operation; return operation;
}); });
documentsApiGroup.MapPost(string.Empty, async (IFormFile file, VectorSearchService vectorSearchService, LinkGenerator linkGenerator, Guid? documentId = null) => documentsApiGroup.MapPost(string.Empty, async (IFormFile file, VectorSearchService vectorSearchService, Guid? documentId = null) =>
{ {
using var stream = file.OpenReadStream(); using var stream = file.OpenReadStream();
documentId = await vectorSearchService.ImportAsync(stream, file.FileName, documentId); documentId = await vectorSearchService.ImportAsync(stream, file.FileName, documentId);
@@ -88,8 +88,8 @@ documentsApiGroup.MapPost(string.Empty, async (IFormFile file, VectorSearchServi
.DisableAntiforgery() .DisableAntiforgery()
.WithOpenApi(operation => .WithOpenApi(operation =>
{ {
operation.Summary = "Uploads a document. Currently, only PDF files are supported"; operation.Summary = "Uploads a document";
operation.Description = "Uploads a document to SQL Server and saves its embeddings using Vector Support. The document will be indexed and used to answer questions."; operation.Description = "Uploads a document to SQL Server and saves its embeddings using Vector Support. The document will be indexed and used to answer questions. Currently, only PDF files are supported.";
operation.Parameter("documentId").Description = "The unique identifier of the document. If not provided, a new one will be generated. If you specify an existing documentId, the document will be overridden."; operation.Parameter("documentId").Description = "The unique identifier of the document. If not provided, a new one will be generated. If you specify an existing documentId, the document will be overridden.";