mirror of
https://github.com/marcominerva/SqlDatabaseVectorSearch.git
synced 2026-06-20 12:23:10 +00:00
Refactor code and enhance API documentation
- Converted `Question.cs` and `Search.cs` records to `record class` syntax for clarity. - Organized API endpoints with tags and added new GET and DELETE endpoints in `Program.cs`, including OpenAPI documentation improvements. - Removed commented-out code in `Program.cs` for cleaner codebase. - Introduced `WithTags` for better API operation categorization in Swagger UI. - Added a TODO comment in `ChatService.cs` for future improvement on chunk length check. - Clarified `using` directives in `VectorSearchService.cs` with namespace aliasing to improve readability. - Refactored document deletion in `VectorSearchService.cs` to use a private helper method and expanded service capabilities with a new `GetDocumentsAsync` method. - Introduced a new `Document` model in the `Models` namespace to support document fetching functionality. - Simplified `appsettings.json` by removing `MaxTokens` configuration for `ChatCompletion` and `Embedding` services.
This commit is contained in:
@@ -45,6 +45,7 @@ public class ChatService(IMemoryCache cache, IChatCompletionService chatCompleti
|
||||
|
||||
""");
|
||||
|
||||
// TODO: Ensure that the chunks are not too long, according to the model max token.
|
||||
foreach (var result in chunks.Select(c => c.Content))
|
||||
{
|
||||
prompt.AppendLine(result);
|
||||
@@ -75,7 +76,6 @@ public class ChatService(IMemoryCache cache, IChatCompletionService chatCompleti
|
||||
}
|
||||
|
||||
cache.Set(conversationId, chat, appSettingsOptions.Value.MessageExpiration);
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user