Skip to content

DeepeshChethanath/AspireIfus-genai

Repository files navigation

AspireIfus

AspireIfus is a minimal sample that demonstrates a Blazor WebApp front-end and a separate API service with light AI integration (chat + semantic search) and vector-store support.

This repository contains the following projects:

  • AspireIfus_ApiService - Minimal API that exposes project data endpoints, integrates with a SQL Server database via Dapper, and provides AI features (chat support + semantic/embedding search) using OpenAI-compatible models and a Qdrant vector collection.
  • AspireIfus.WebApp - Blazor Interactive Server application that consumes the API and displays project lists and funding details. Uses a small typed ProjectApiClient for API calls.
  • AspireIfus.AppHost - (Lightweight host project / shared defaults used by the services)
  • AspireIfus.ServiceDefaults - Project-level helpers and registration extensions.

Requirements

  • .NET 10 SDK
  • SQL Server (or compatible) with the expected stored procedures (see Database section)
  • Configuration values (API keys, connection string) configured as environment variables or in appsettings.*

Database

The API expects a SQL connection string named DefaultConnection and the following stored procedures to exist:

  • GetProjectsById - Returns project rows (used for listing and GetById)
  • GetProjectFundingById - Returns funding allocations for a specific project
  • GetAllInvestors - (used by the service)
  • GetProjectsSearchAllColumns - Free-text search across project columns

Populate the database with sample projects so the API and semantic search can return meaningful results.

Configuration

Set the following configuration keys (example options):

  • ConnectionStrings:DefaultConnection - SQL connection string
  • GitHubModels:Token - API key for OpenAI-compatible models (the code uses models.github.ai endpoint)
  • Vector DB configuration (Qdrant) - the project calls builder.AddQdrantClient("vectordb") and AddQdrantCollection("project-vectors"); configure the host/credentials according to your environment. These values can be set via the appsettings used by the shared defaults.

Running locally

  1. Open the solution in Visual Studio 2026.
  2. Ensure DefaultConnection and GitHubModels:Token are set in user secrets or environment variables.
  3. Start the AspireIfus_ApiService project first (it hosts the API and AI endpoints).
  4. Start AspireIfus.WebApp (Blazor) and navigate to /projects.

Recommended: Run both projects concurrently (set multiple startup projects) so the Blazor app can call the API.

API Endpoints

The API exposes project related endpoints under /projects:

  • GET /projects - Get all projects
  • GET /projects/{id} - Get project by id
  • GET /projects/search/{query} - Database-backed search across projects
  • GET /projects/support/{query} - AI chat support (returns a short chat response driven by models)
  • GET /projects/aisearch/{query} - Semantic search using embeddings and vector store (Qdrant)

Notes on AI features

  • The AI functionality uses an OpenAI-compatible client configured in AspireIfus_ApiService/Program.cs. The application expects a token configured at GitHubModels:Token and communicates with https://models.github.ai/inference by default.
  • The semantic search uses an embedding generator and a Qdrant collection named project-vectors. Embeddings are generated from project metadata and upserted into the collection automatically in ProjectAIService.InitEmbeddingsAsync() when the collection is missing.
  • The system prompt used for the chat assistant is crafted for green energy analysis and restricts responses to project knowledge base facts. See ProjectAIService for the exact rules.

Technical keywords

This repository uses (and references in code) the following libraries, frameworks and concepts:

  • .NET 10 (target framework)
  • Blazor (Interactive Server components)
  • Minimal APIs (MapGroup, IEndpointRouteBuilder, Results)
  • Microsoft.Extensions.AI (chat + embedding abstractions: IChatClient, IEmbeddingGenerator, ChatMessage, ChatRole)
  • OpenAIClient / OpenAI-compatible client usage (model clients configured in Program.cs)
  • Microsoft.Extensions.VectorData (vector store types and attributes: VectorStoreCollection, VectorStoreKey, VectorStoreData, VectorStoreVector)
  • Qdrant (vector DB client configured via AddQdrantClient / AddQdrantCollection)
  • Dapper (data access via stored procedures)
  • Microsoft.Data.SqlClient (SQL Server connections)
  • System.Text.Json (JSON serialization / GetFromJsonAsync usage)
  • HttpClient (typed client ProjectApiClient)
  • OpenAPI / Swagger helpers (AddOpenApi, MapOpenApi)
  • Bootstrap (UI script referenced in Blazor page for modal dialogs)
  • Stored Procedures (database access pattern used by DapperContext)

Blazor WebApp

  • The Blazor page Components/Pages/Projects.razor lists projects and supports searching. It can toggle between database search and AI semantic search.
  • The client code is in AspireIfus.WebApp/ApiClients/ProjectApiClient.cs and calls the API endpoints described above.

Troubleshooting

  • "Missing configuration: GitHubModels:Token." — set GitHubModels:Token in user secrets or environment variables.
  • Connection errors — verify DefaultConnection and that the database is reachable. Confirm the required stored procedures exist.
  • Qdrant / vector store issues — verify your vector DB is running and the host/credentials are configured in the same configuration used by AddQdrantClient.

Extending / Notes for developers

  • Add or adjust stored procedures to match your data model.
  • To change the model or embedding engine, update Program.cs where OpenAIClient is configured and where GetChatClient / GetEmbeddingClient are selected.
  • ProjectAIService will only recommend projects that match the prompt rules and the available project catalog — it will not invent data.

License

This repository is provided as sample code. No license file is included — add one if you intend to publish or share the project.

About

Blazor + Minimal API sample with SQL Server, Dapper, OpenAI-compatible AI chat, and Qdrant semantic search.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors