mirror of
https://github.com/marcominerva/SqlDatabaseVectorSearch.git
synced 2026-06-20 12:23:10 +00:00
Add support for DOCX and TXT files, update error handling
Updated README.md to reflect support for PDF, DOCX, and TXT files. Removed commented-out code in DocxContentDecoder.cs. Added TextContentDecoder service in Program.cs and updated exception handling middleware. Updated document upload endpoint description in Program.cs. Modified VectorSearchService to throw NotSupportedException for unsupported content types. Added TextContentDecoder class in TextContentDecoder.cs.
This commit is contained in:
@@ -18,7 +18,7 @@ public class VectorSearchService(IServiceProvider serviceProvider, ApplicationDb
|
||||
public async Task<Guid> ImportAsync(Stream stream, string name, string contentType, Guid? documentId)
|
||||
{
|
||||
// Extract the contents of the file.
|
||||
var decoder = serviceProvider.GetRequiredKeyedService<IContentDecoder>(contentType);
|
||||
var decoder = serviceProvider.GetKeyedService<IContentDecoder>(contentType) ?? throw new NotSupportedException($"Content type '{contentType}' is not supported.");
|
||||
var content = await decoder.DecodeAsync(stream, contentType);
|
||||
|
||||
await dbContext.Database.BeginTransactionAsync();
|
||||
|
||||
Reference in New Issue
Block a user