Commit Graph

201 Commits

Author SHA1 Message Date
Marco Minerva 9f5bd02f78 Refactor citation handling in Ask.razor and ChatService.cs
Updated the assistant message construction in `Ask.razor` to manage citations more effectively by introducing a `RawText` property and a new `RemoveCitations` method. The `ExtractCitations` method now processes raw input for citation extraction.

Removed outdated comments in `ChatService.cs` regarding citation formatting rules, indicating a potential shift in how citation handling is enforced.
2025-06-05 11:48:18 +02:00
Marco Minerva aae42a1658 Enhance .editorconfig with new rules and adjustments
- Added suggestion for collection expressions with loose type matches.
- Introduced diagnostic rule IDE0305 for simplified collection initialization.
2025-06-04 12:48:31 +02:00
Marco Minerva 1c24250a42 Add citation handling and styling in Ask.razor
Updated Ask.razor to include regex for citation extraction and display.
Introduced a new method to extract citations and updated the Message
class to store them. Added a Citation class for individual citation
representation. Enhanced app.css with styles for citation display.
2025-06-04 12:34:02 +02:00
Marco Minerva 0766103b9a Refactor ChatService and VectorSearchService parameters
Updated parameter types in ChatService and VectorSearchService from IEnumerable<string> to IEnumerable<Entities.DocumentChunk> for better structure. Enhanced citation formatting rules in ChatService. Increased MaxRelevantChunks and MaxInputTokens in appsettings.json to improve processing capabilities.
2025-06-04 11:42:24 +02:00
Marco Minerva 2fc070d0aa Refactor response handling and content decoding
- Updated `TextContentDecoder` to use `ITextChunker` for paragraph splitting and return a list of `Chunk` objects.
- Changed return type of `Stream` method in `AskEndpoints.cs` from `IAsyncEnumerable<QuestionResponse>` to `IAsyncEnumerable<Response>`.
- Removed `QuestionResponse` class and introduced `Response` class to better handle streaming responses.
- Modified `AskQuestionAsync` and `AskStreamingAsync` methods in `VectorSearchService` to return `Response` instead of `QuestionResponse`, and adjusted token count calculation.
- Added namespace declaration in `Response.cs` and defined properties to align with new response structure.
2025-06-04 10:22:15 +02:00
Marco Minerva a7fef36b66 Merge branch 'master' into decoder_updates 2025-06-04 10:08:35 +02:00
Marco Minerva 12e8a042db Update Microsoft.SemanticKernel to version 1.55.0
Updated the `Microsoft.SemanticKernel` package version from `1.54.0` to `1.55.0` in the `SqlDatabaseVectorSearch.csproj` file.
2025-06-04 10:08:21 +02:00
Marco Minerva c0051dbeb7 Update Swashbuckle.AspNetCore.SwaggerUI version
Updated the `Swashbuckle.AspNetCore.SwaggerUI` package from version `8.1.2` to `8.1.3` in the `SqlDatabaseVectorSearch.csproj` file.
2025-06-03 11:28:32 +02:00
Marco Minerva 1e531e5ad6 Filter out empty paragraphs in PdfContentDecoder
Updated the paragraph processing to exclude empty or whitespace-only entries before creating Chunk objects, ensuring only meaningful text is included.
2025-05-27 17:19:25 +02:00
Marco Minerva fa81f01c27 Refactor content decoders and restructure data layer
Updated `DocxContentDecoder`, `PdfContentDecoder`, and `TextContentDecoder` to return `Task<IEnumerable<Chunk>>` instead of `Task<string>`, introducing a new `Chunk` record for structured output.

Restructured the `ApplicationDbContext`, `Document`, and `DocumentChunk` classes by moving them to the `SqlDatabaseVectorSearch.Data` namespace for better organization.

Updated database migration files to align with the new entity structure and modified references in `Program.cs`, `DocumentService.cs`, and `VectorSearchService.cs` to use the new namespace.
2025-05-27 17:10:17 +02:00
Marco Minerva 599cc84928 Update Swashbuckle.AspNetCore.SwaggerUI version
Updated the `Swashbuckle.AspNetCore.SwaggerUI` package from version `8.1.1` to `8.1.2` in the `SqlDatabaseVectorSearch.csproj` file.
2025-05-26 10:32:49 +02:00
Marco Minerva 505b74ad63 Update Microsoft.SemanticKernel to version 1.54.0
Updated the `Microsoft.SemanticKernel` package from version
1.53.1 to 1.54.0 in the `SqlDatabaseVectorSearch.csproj` file.
2025-05-23 10:08:16 +02:00
Marco Minerva db0ec7cec6 Enhance copy confirmation in Ask.razor and update package
Updated the copy confirmation feature in `Ask.razor` by replacing the `isCopied` variable with `showCopyConfirmation`, improving user feedback with a longer display duration for the checkmark icon.

Also, updated the `Microsoft.SemanticKernel` package version from `1.52.1` to `1.53.1` for potential bug fixes and improvements.
2025-05-22 09:36:09 +02:00
Marco Minerva e4a0a53e53 Add tooltip feedback for clipboard copy action
Introduce a tooltip feature in `Ask.razor` that provides user feedback when copying text to the clipboard. Added `isCopied` to track the copy state and `toolTipText` to manage the tooltip message. The tooltip title updates from "Copy to Clipboard" to "Copied!" after the action, with a delay to reset the message for subsequent copies.
2025-05-20 11:42:39 +02:00
Marco Minerva e7c4c45434 Add clipboard copy feature for messages
This update introduces a new feature that allows users to copy messages to the clipboard. A boolean variable `isCopied` tracks the copy action status, and the button now shows a check icon upon successful copy, reverting after 1.5 seconds. A null check is also added in the `CopyToClipboardAsync` method to enhance error handling.
2025-05-20 10:48:31 +02:00
Marco Minerva 72ce93c563 Update Microsoft.SemanticKernel to version 1.52.1
Updated the `Microsoft.SemanticKernel` package from version
1.51.0 to 1.52.1 in the `SqlDatabaseVectorSearch.csproj` file.
2025-05-20 10:36:41 +02:00
Marco Minerva 2d979fd8f0 Update Azure OpenAI services and Semantic Kernel version
- Updated `VectorSearchService.cs` to replace the text embedding generation service with an embedding generator and adjusted embedding generation and vector search logic.
- Changed `Microsoft.SemanticKernel` package version from 1.50.0 to 1.51.0 in `SqlDatabaseVectorSearch.csproj` and modified `NoWarn` property settings.
2025-05-16 17:42:38 +02:00
Marco Minerva 2a511a8836 Update Microsoft.SemanticKernel to version 1.50.0
Updated the `Microsoft.SemanticKernel` package version from `1.49.0` to `1.50.0` in the `SqlDatabaseVectorSearch.csproj` file.
2025-05-15 11:46:32 +02:00
Marco Minerva aabedf049e Update NuGet package references in project file
Updated several NuGet package versions in `SqlDatabaseVectorSearch.csproj` to improve functionality and compatibility. Key upgrades include:
- `Microsoft.AspNetCore.OpenApi` to version `9.0.5`
- `Microsoft.EntityFrameworkCore.SqlServer` to version `9.0.5`
- `Microsoft.EntityFrameworkCore.Tools` to version `9.0.5`
- `Microsoft.Extensions.Caching.Hybrid` to version `9.5.0`
- `Microsoft.Extensions.Http.Resilience` to version `9.5.0`
- `TinyHelpers.AspNetCore` to version `4.0.26`
2025-05-14 10:47:28 +02:00
Marco Minerva 3ad751888c Merge branch 'master' of https://github.com/marcominerva/SqlDatabaseVectorSearch 2025-05-12 10:32:31 +02:00
Marco Minerva f0e07fc96b Update Microsoft.SemanticKernel to version 1.49.0
Updated the `Microsoft.SemanticKernel` package version from `1.48.0` to `1.49.0` in the `SqlDatabaseVectorSearch.csproj` file.
2025-05-12 10:32:21 +02:00
Marco Minerva 3197637019 Update README.md 2025-05-07 17:50:34 +02:00
Marco Minerva 42bfac1648 Update documentation for supported features
Enhanced descriptions in `README.md` for features:
**Conversation History with Question Reformulation**,
**Information about Token Usage**, and
**Response Streaming**.

Reformatted feature list in `Home.razor` to include bold headings
and detailed explanations for improved clarity.
2025-05-07 17:25:14 +02:00
Marco Minerva 32fce98b63 Add FluentValidation for Question model validation
- Updated `AskEndpoints.cs` to include `MinimalHelpers.FluentValidation` and standardize endpoint descriptions.
- Integrated FluentValidation in `Program.cs` and registered validators.
- Modified `SqlDatabaseVectorSearch.csproj` to add necessary package references for FluentValidation.
- Created `QuestionValidator` class to enforce validation rules on the `Question` model.
2025-05-05 15:06:22 +02:00
Marco Minerva a2ae9c05af Update Microsoft.SemanticKernel to version 1.48.0
Updated the `Microsoft.SemanticKernel` package version from 1.47.0 to 1.48.0 in the `SqlDatabaseVectorSearch.csproj` file.
2025-04-30 10:32:12 +02:00
Marco Minerva 711d4a314f Enhance chat responses and update package versions
Updated `ChatService.cs` to improve user guidance for unavailable information responses. Added multiple phrases to ensure clarity and context relevance.

Modified `SqlDatabaseVectorSearch.csproj` to upgrade `Microsoft.SemanticKernel` from `1.45.0` to `1.47.0`, and incremented versions for `Swashbuckle.AspNetCore.SwaggerUI` and `TinyHelpers.AspNetCore` to `8.1.1` and `4.0.25`, respectively, for bug fixes and improvements.
2025-04-22 11:19:32 +02:00
Marco Minerva d8e699730d Update package references in SqlDatabaseVectorSearch
Updated versions of several package references in the
`SqlDatabaseVectorSearch.csproj` file, including:
- `Microsoft.AspNetCore.OpenApi`, `Microsoft.EntityFrameworkCore.SqlServer`,
  and `Microsoft.EntityFrameworkCore.Tools` from `9.0.3` to `9.0.4`.
- `Microsoft.Extensions.Caching.Hybrid` and
  `Microsoft.Extensions.Http.Resilience` from `9.3.0` to `9.4.0`.
- `TinyHelpers.AspNetCore` from `4.0.22` to `4.0.23`.

These updates aim to incorporate bug fixes, new features,
and improvements from the latest versions.
2025-04-09 11:09:05 +02:00
Marco Minerva bfdb96368f Update README.md for embedding model requirements
Clarified the `Dimensions` property requirements for embedding models that support shortening. Added information about the maximum supported size for the `VECTOR` type (1998) and the need to update database migrations accordingly.
2025-04-07 10:04:40 +02:00
Marco Minerva 467115f1a5 Update Microsoft.SemanticKernel to version 1.45.0
Updated the `Microsoft.SemanticKernel` package version from `1.44.0` to `1.45.0` in the `SqlDatabaseVectorSearch.csproj` file.
2025-04-04 11:55:02 +02:00
Marco Minerva cb0e534d17 Update package versions for SwaggerUI and TinyHelpers
Updated `Swashbuckle.AspNetCore.SwaggerUI` from `8.0.0` to `8.1.0` and `TinyHelpers.AspNetCore` from `4.0.21` to `4.0.22`. Removed previous versions in favor of the latest updates.
2025-04-01 12:49:20 +02:00
Marco Minerva b45af8dd9c Update Microsoft.SemanticKernel to version 1.44.0
Updated the `Microsoft.SemanticKernel` package version from
1.43.0 to 1.44.0 in the `SqlDatabaseVectorSearch.csproj` file.
2025-03-27 09:12:08 +01:00
Marco Minerva 25152f8872 Add timeout configurations
Introduce `AttemptTimeout.Timeout` of 15 seconds
2025-03-25 10:25:36 +01:00
Marco Minerva 5d4ef9dcf3 Update Microsoft.SemanticKernel to version 1.43.0
Updated the `Microsoft.SemanticKernel` package from version 1.42.0 to 1.43.0 in the `SqlDatabaseVectorSearch.csproj` file.
2025-03-25 10:08:16 +01:00
Marco Minerva e7eba25bc4 Refactor token usage structure in API responses
Updated token count keys from `inputTokenCount`, `outputTokenCount`, and `totalTokenCount` to `promptTokens`, `completionTokens`, and `totalTokens` for improved clarity. Modified `question` and `answer` fields to align with the new structure, with some values set to `null` to indicate streaming state.
2025-03-24 18:01:38 +01:00
Marco Minerva 817658d539 Rename tokensAvailable to availableTokens for clarity
Updated variable names and references for improved readability and consistency in token calculations and checks.
2025-03-24 17:49:21 +01:00
Marco Minerva f563cacfb1 Update middleware configuration in Program.cs
- Added Swagger endpoint for OpenAPI specification.
- Commented out unused middleware: UseRateLimiter and UseCors.
- Other middleware configurations remain unchanged.
2025-03-24 12:16:30 +01:00
Marco Minerva 406618527c Refactor token usage and enhance logging capabilities
- Updated `TokenUsage` class properties to `PromptTokens` and `CompletionTokens`.
- Modified `Ask.razor` to display new token counts.
- Added logger to `ChatService` constructor for improved logging.
- Implemented logging for token usage in `ChatService` methods.
- Changed logging level to `Debug` for paragraph storage in `VectorSearchService`.
- Updated logging configuration in `appsettings.Development.json` for better visibility.
2025-03-24 10:12:04 +01:00
Marco Minerva a0d1126d15 Enhance file upload and notification features
- Updated `Documents.razor` to change form submission handler to `UploadFile` and added `id` to `InputFile`.
- Implemented `UploadFile` method to handle file uploads and reset input after successful upload.
- Upgraded package references in `SqlDatabaseVectorSearch.csproj` for `Microsoft.SemanticKernel` and `Swashbuckle.AspNetCore.SwaggerUI`.
- Introduced `resetFileInput` function in `functions.js` to clear file input selections.
2025-03-19 10:38:42 +01:00
Marco Minerva d20b1395e0 Update package references in project file
Incremented versions for several packages in `SqlDatabaseVectorSearch.csproj`, including:
- `Microsoft.AspNetCore.OpenApi` to `9.0.3`
- `Microsoft.EntityFrameworkCore.SqlServer` to `9.0.3`
- `Microsoft.EntityFrameworkCore.Tools` to `9.0.3`
- `Microsoft.Extensions.Caching.Hybrid` to `9.3.0` (removed preview version)
- `Microsoft.Extensions.Http.Resilience` to `9.3.0`
- `Microsoft.SemanticKernel` to `1.41.0`
- `TinyHelpers.AspNetCore` to `4.0.21`
2025-03-12 11:16:35 +01:00
Marco Minerva a7fedc6c40 Merge branch 'master' of https://github.com/marcominerva/SqlDatabaseVectorSearch 2025-03-11 17:40:14 +01:00
Marco Minerva 7fab00037a Update package versions for DocumentFormat and PdfPig
Updated the `DocumentFormat.OpenXml` package from `3.2.0` to `3.3.0` and the `PdfPig` package from `0.1.9` to `0.1.10`.
2025-03-11 17:37:31 +01:00
Marco Minerva 0b31aaccbf Enhance user feedback in Ask.razor streaming response
Added functionality to update userMessage.Text with the
reformulated question when the streaming response starts.
This improvement provides immediate feedback to users,
enhancing the overall user experience.
2025-03-11 17:34:31 +01:00
Marco Minerva 0a38de6497 Refactor document upload handling
Replaced `UploadDocumentRequest` with `UploadDocument` class to streamline data management. Updated `EditForm` to bind directly to the new model, removing the `EditContext` and `HandleFileSelected` method. Adjusted validation and submission logic to work with the new structure, enhancing clarity and maintainability.
2025-03-11 17:27:07 +01:00
Marco Minerva 261caffb6d Update README.md 2025-03-10 16:50:07 +01:00
Marco Minerva e3dcf95da7 Update HTTP client configuration in Program.cs
- Modify `AddHybridCache` to include local cache expiration.
- Change resilience handler addition to use configure method.
- Set total request timeout to 2 minutes.
2025-03-07 17:55:25 +01:00
Marco Minerva b37ad46605 Update HTTP client resilience handler configuration
Modified the `AddStandardResilienceHandler` method in
`Program.cs` to accept an `options` parameter. This allows
for setting a `TotalRequestTimeout` of 2 minutes, enhancing
the resilience handling of HTTP requests.
2025-03-04 11:00:45 +01:00
Marco Minerva 90b69f05d8 Refactor endpoint definitions and update dependencies
- Separated endpoint definitions into `AskEndpoints` and `DocumentEndpoints` classes for better organization and maintainability.
- Removed inline endpoint definitions in `Program.cs` and replaced with `app.MapEndpoints();`.
- Updated `Microsoft.SemanticKernel` package from version `1.40.0` to `1.40.1`.
- Replaced `MinimalHelpers.OpenApi` with `MinimalHelpers.Routing.Analyzers` in project dependencies.
- Defined new POST endpoints for asking questions and document management with detailed API documentation.
- Enhanced code structure for easier management and future extensibility.
2025-03-04 10:46:35 +01:00
Marco Minerva 3683d16955 Update README.md 2025-02-28 11:59:26 +01:00
Marco Minerva 69991c076d Merge pull request #10 from marcominerva/ui
Add Web application
2025-02-28 11:55:00 +01:00
Marco Minerva fba3c742dd Merge commit 2025-02-28 11:53:41 +01:00