278 Commits

Author SHA1 Message Date
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
Marco Minerva 86b8e611ea Documentation update 2025-02-28 11:52:36 +01:00
Marco Minerva c662d34a2a Refactor Ask.razor and update dependencies
- Renamed `CopyToClipboard` to `CopyToClipboardAsync` in `Ask.razor` for clarity on asynchronous operation.
- Added `ElementReference` for `chat` and introduced `EnsureMessageIsVisibleAsync` to improve message visibility.
- Modified streaming state handling for better readability.
- Made `FormatTokenUsage` and `FormatTokenUsageDetails` methods static and adjusted their implementations.
- Enhanced styling in `Home.razor` with a new paragraph class.
- Updated `SqlDatabaseVectorSearch.csproj` to upgrade `Microsoft.SemanticKernel` and other package versions.
- Added a new `scrollTo` function in `functions.js` to improve user experience by ensuring elements are visible.
2025-02-28 11:24:57 +01:00
Marco Minerva 9d2c4e2e0c Update Swashbuckle.AspNetCore.SwaggerUI version
Updated the `Swashbuckle.AspNetCore.SwaggerUI` package from version `7.2.0` to `7.3.0` in the `SqlDatabaseVectorSearch.csproj` file.
2025-02-26 16:09:04 +01:00
Marco Minerva ec5bf2acb2 Update Home.razor and project dependencies
Refactor Home.razor to replace markdown loading with static HTML content for the SQL Database Vector Search application, including a main heading and feature list. Remove the IWebHostEnvironment dependency.

Upgrade package references in SqlDatabaseVectorSearch.csproj for Microsoft.ML.Tokenizers and Microsoft.SemanticKernel.

Revise docs.md to focus on supported features instead of setup instructions.

Add new SVG files (openai.svg and sqldatabase.svg) for application icons.
2025-02-26 10:36:50 +01:00
Marco Minerva e1324115f8 Remove footer and update card layout styles
- Removed the `FooterSection` from `MainLayout.razor` and its associated styles in `MainLayout.razor.css`.
- Added top margin to the card in `Ask.razor` for improved spacing.
- Increased height of `.card-body` in both default and media queries for better content display.
- Added CSS rules in `app.css` to reset margin and padding for `body` and `html`.
- Modified binary file `SqlDatabaseVectorSearch_WebApp.png`.
2025-02-25 15:52:58 +01:00
Marco Minerva 9071e130de Enhance documentation and refactor request handling
Updated README.md to clarify functionality and added a link to OpenAPI documentation in MainLayout.razor. Removed unnecessary methods from RequestExtensions.cs for simplification. Streamlined docs.md by removing detailed JSON response examples while retaining key information about response streaming.
2025-02-25 15:17:06 +01:00
Marco Minerva eb368470e8 Update README and image assets for SQL Database Vector Search
- Enhanced README.md with new sections and images for the web app and API.
- Clarified setup instructions and reorganized content.
- Removed SqlDatabaseVectorSearch.png; modified favicon.png and SqlDatabaseVectorSearch_API.png.
- Added new image file: SqlDatabaseVectorSearch_WebApp.png.
2025-02-25 14:56:46 +01:00
Marco Minerva 22522a2d50 Update documentation for VECTOR column migration
Clarified the need to update the Database Migration when changing the size of the `VECTOR` column to match the embedding model. This replaces the previous mention that lacked a specific link to the Database Migration.
2025-02-24 12:02:17 +01:00
Marco Minerva a0a6df9cb3 Add loading state and database migration support
- Updated `Documents.razor` to show a loading spinner when documents are being fetched, introducing an `isLoading` state variable.
- Added `ConfigureDatabaseAsync` method in `Program.cs` for handling database migrations at startup.
- Modified `SqlDatabaseVectorSearch.csproj` to include `Microsoft.EntityFrameworkCore.Tools` for migration management.
- Enhanced documentation in `docs.md` regarding the `Dimensions` property and `VECTOR` column size requirements.
- Created initial migration files to define the database schema for `Documents` and `DocumentChunks` tables.
- Defined `Document` and `DocumentChunk` entities in migration files for data storage and retrieval.
2025-02-24 12:01:22 +01:00
Marco Minerva 2ce3d23e73 Downgrade Microsoft.SemanticKernel package version
The version of the `Microsoft.SemanticKernel` package was changed from `1.38.0` to `1.37.0` in the `SqlDatabaseVectorSearch.csproj` file.
2025-02-21 16:27:22 +01:00
Marco Minerva 08ebc517c8 Refactor navigation and update styles and dependencies
- Rearranged navigation items in `MainLayout.razor`.
- Removed `ToastService` injection and modified key handling in `Ask.razor`.
- Downgraded `Microsoft.SemanticKernel` version in project file.
- Updated CSS styles for sidebar brand icon and navigation item states.
- Fixed error message content in `.blazor-error-boundary` class.
2025-02-21 14:13:25 +01:00
Marco Minerva ae88408823 Merge branch 'master' into ui 2025-02-21 12:19:05 +01:00
Marco Minerva 486d73d662 Update Microsoft.SemanticKernel to version 1.38.0
Updated the `Microsoft.SemanticKernel` package version from
1.37.0 to 1.38.0 in the `SqlDatabaseVectorSearch.csproj` file.
2025-02-21 11:05:39 +01:00
Marco Minerva c22b4100fb Refactor Ask component and improve sidebar styles
- Removed clipboard icon reference and added ElementReference for input field in Ask.razor.
- Introduced OnAfterRenderAsync method to manage input focus.
- Updated app.css with new CSS variables for enhanced sidebar styling.
- Added setFocus function in functions.js to manage element focus.
2025-02-20 15:01:25 +01:00
Marco Minerva b7c8cfff76 Update button types in Ask.razor and improve CSS focus style
- Specified `Type` attributes for buttons in `Ask.razor` to clarify their intended behavior.
- Added `h1:focus` style in `app.css` to remove default outline for focused headings.
2025-02-20 12:19:20 +01:00
Marco Minerva eba0d4c272 Add footer to layout and enhance document handling
- Updated `MainLayout.razor` to include a footer displaying the framework description, styled with new CSS.
- Modified `MainLayout.razor.css` to add styles for the footer.
- Enhanced `Ask.razor` with a new `ToastService` for user notifications and improved message handling.
- Updated `Documents.razor` to restrict file uploads to specific formats and improved error handling with notifications for uploads and deletions.
2025-02-20 11:56:48 +01:00
Marco Minerva 402bf1e570 Merge branch 'master' into ui 2025-02-20 10:42:51 +01:00
Marco Minerva 7922fff402 Enhance question reformulation instructions
Added a line to the `embeddingQuestion` string to emphasize that the reformulated question must explicitly contain the subject. This change clarifies the requirements for the chat service's functionality.
2025-02-20 10:36:58 +01:00
Marco Minerva 8472775333 Add message limit to chat history management
Updated `ChatService` to enforce a message limit based on the new `MessageLimit` property in `AppSettings`. Excess messages are removed before updating the cache to optimize performance. Adjusted `appsettings.json` to reflect the new configuration, changing `MaxInputTokens` from 16385 to 16384 and adding `MessageLimit` with a default value of 20.
2025-02-20 10:30:55 +01:00
Marco Minerva 596aa7cf6f Merge branch 'master' of https://github.com/marcominerva/SqlDatabaseVectorSearch 2025-02-20 10:06:29 +01:00
Marco Minerva b1aa81e4ec Enhance question reformulation in ChatService
Updated the `embeddingQuestion` string to require that the reformulated question explicitly contains the subject of the original question. The reformulation must also be in the same language as the user's question and should not include phrases like "in this chat" or "search for."
2025-02-20 10:06:11 +01:00
Marco Minerva 5262f9f794 Enhance UI and notification handling; add documentation
- Updated `MainLayout.razor` to include a `Toasts` component and removed the `FooterSection`.
- Replaced `Toasts` in `Documents.razor` with a new `ToastService` for notifications, enhancing document upload and deletion processes.
- Modified `Home.razor` to read markdown content from a local file using `IWebHostEnvironment`.
- Removed HTTP client service registration in `Program.cs` and adjusted resilience handling configuration.
- Updated `ChatService.cs` with guidelines for question reformulation.
- Added `docs.md` with setup instructions and details on supported features for the SQL Database Vector Search application.
2025-02-20 10:05:44 +01:00
Marco Minerva e1d83f1051 Delete docs.md 2025-02-20 09:09:05 +01:00