diff --git a/EssentialCSharp.Web.Hosting/WebHostingExtensions.cs b/EssentialCSharp.Web.Hosting/WebHostingExtensions.cs index 7bbeb41c..a457f782 100644 --- a/EssentialCSharp.Web.Hosting/WebHostingExtensions.cs +++ b/EssentialCSharp.Web.Hosting/WebHostingExtensions.cs @@ -91,12 +91,12 @@ public static IResourceBuilder WithEssentialCSharpLocalAI string? endpoint = builder.Configuration["AIOptions:Endpoint"]; bool azureConfigured = !string.IsNullOrWhiteSpace(endpoint); - // Graph selection is startup configuration, not a dashboard parameter. Keep existing saved - // disables working so upgrading does not unexpectedly download a local model. + // Graph selection is startup configuration, not a dashboard parameter. Local AI is opt-in because + // it downloads a multi-gigabyte model; a legacy saved Parameters:UseLocalAI value is still honored. bool useLocalAI = !azureConfigured && (builder.Configuration.GetValue("AIOptions:UseLocalAI") ?? builder.Configuration.GetValue("Parameters:UseLocalAI") - ?? true); + ?? false); if (azureConfigured) { diff --git a/README.md b/README.md index 63cb9b87..030bfeac 100644 --- a/README.md +++ b/README.md @@ -30,19 +30,28 @@ Use the allocated Web HTTP endpoint reported by Aspire, not a hard-coded localho `--isolated` keeps worktree container identities separate. SQL Server, pgvector PostgreSQL, and optional Ollama use persistent data volumes; restart with the same command to retain data. The AppHost has its own `UserSecretsId`, separate from ordinary Web application secrets. -SQL Server passwords are generated by Aspire unless an AppHost `Parameters:sqlserver-password` -secret is supplied. Stop only this AppHost using `aspire stop --apphost` with the same project path. +Database passwords are generated by Aspire and kept in the AppHost's user secrets. Because the data +volumes outlive those secrets, set fixed passwords once if you want them to survive a secrets reset: + +```powershell +dotnet user-secrets set "Parameters:sqlserver-password" "" --project dev\EssentialCSharp.Web.AppHost +dotnet user-secrets set "Parameters:postgres-password" "" --project dev\EssentialCSharp.Web.AppHost +``` + +If the secrets are lost and a database rejects its login, remove that container's data volume +(or restore the same password) and restart. Stop only this AppHost using `aspire stop --apphost` +with the same project path. Add `--format mermaid` to `aspire describe` to print the resource dependency graph as a Mermaid diagram. The Web resource uses Aspire's Project v2 model (`AddDotnetProject`), which the AppHost builds before launch. Aspire watch [is not yet implemented for Project v2 resources](https://aspire.dev/integrations/dotnet/migrate-dotnet-project-resource/#check-workflows-before-migrating); after changing Web code, rebuild just that resource with `aspire resource essentialcsharp-web rebuild --apphost `. -Local AI defaults to Ollama (`qwen2.5-coder:7b`, approximately 5 GB download); local vector search -is not enabled. Disable model downloads before starting when chat is unnecessary: +Local AI is off by default because it downloads a model. Enable Ollama (`qwen2.5-coder:7b`, +approximately 5 GB) before starting when you need local chat; local vector search is not enabled: ```powershell -dotnet user-secrets set "AIOptions:UseLocalAI" "false" --project dev\EssentialCSharp.Web.AppHost +dotnet user-secrets set "AIOptions:UseLocalAI" "true" --project dev\EssentialCSharp.Web.AppHost ``` This is startup configuration: restart the AppHost after changing it. It is not a dashboard diff --git a/dev/EssentialCSharp.Web.AppHost.Tests/WebHostingExtensionsTests.cs b/dev/EssentialCSharp.Web.AppHost.Tests/WebHostingExtensionsTests.cs index faecf3fa..78caf75f 100644 --- a/dev/EssentialCSharp.Web.AppHost.Tests/WebHostingExtensionsTests.cs +++ b/dev/EssentialCSharp.Web.AppHost.Tests/WebHostingExtensionsTests.cs @@ -162,7 +162,9 @@ public async Task WithEssentialCSharpLocalAI_AzureEndpointConfigured_TakesPreced [Arguments(new[] { "--AIOptions:UseLocalAI=false" }, false)] [Arguments(new[] { "--Parameters:UseLocalAI=false" }, false)] [Arguments(new[] { "--AIOptions:UseLocalAI=false", "--Parameters:UseLocalAI=true" }, false)] - [Arguments(new string[0], true)] + [Arguments(new[] { "--AIOptions:UseLocalAI=true" }, true)] + [Arguments(new[] { "--Parameters:UseLocalAI=true" }, true)] + [Arguments(new string[0], false)] public async Task WithEssentialCSharpLocalAI_StartupConfiguration_ControlsOllamaWithoutDashboardParameter( string[] args, bool expectOllama) {