This demo showcases how to use offline GPT with the help of LM Studio within a .NET 8 Blazor app.
- Download and install LM Studio.
- Once LM Studio is installed, download a small model (Phi-3, Qwen, Gemma). If your machine has <8GB VRAM, choose a smaller one.
- Go to the "Local Server" tab.
- Select model and start the server.
- Enable "Cross-Origin-Resource-Sharing (CORS)".
- Disable "Verbose Server Logging".
- (Optional) Under "Advanced Settings", set the GPU memory limit to max in "GPU Settings".
- Stop the server and apply changes if required, then start the server.
- Ensure you have the latest .NET 8 SDK installed. (Windows Winget:
winget install dotnet-sdk-8) - Run the application in Visual Studio or use
dotnet runin thesrc/HomeAutomationGptfolder.
From the repository root, run:
- Quickstart (Make) or .NET Aspire:
# Run with Make (client only)
make build
make run
# Or run with .NET Aspire (AppHost)
AI__Provider=Ollama AI__Model=gemma3:1b AI__Endpoint=http://localhost:11434/v1 dotnet run --project src/HomeAutomationGpt.AppHost/HomeAutomationGpt.AppHost.csproj- macOS/Linux (Docker) or VS Code Dev Container (client only):
make image
make up
# open http://localhost:8080/
# or open in VS Code and use "Dev Containers: Reopen in Container"- Windows (PowerShell/CMD):
docker build -t home-automation-gpt .\src\HomeAutomationGpt\
docker run -d -p 8080:80 --name home-automation-gpt home-automation-gpt
# open http://localhost:8080/Open http://localhost:8080/ in your browser.
- Service version selector: Switch between V1–V5 in the UI to compare approaches. V5 is recommended.
- Advanced options: You can optionally edit the system prompt (hidden by default). Leave it off for the default prompts.
- Voice input: Click the “Speak” button to dictate commands (browser’s Web Speech API).
- Switch provider:
./scripts/switch-provider.sh ollamaor./scripts/switch-provider.sh lmstudio. Requires jq. Or usemake provider-ollama/make provider-lmstudio. - AI Trace: Toggle "Show AI trace" in the UI to see system/user prompts, model output, tool calls, and the queued actions.
- "Turn on the lights in the living room."
- "Turn off the lights in the kitchen."
- "Set the temperature to 23 degrees."
- "It's really cold" (Sets A/C to 23, turns on the TV and living room light).
- "Turn off all devices but keep the A/C on."
- "I need more light."
- "I'm feeling cold."