Skip to content

Comments

feat: InferPage visual & functional improvements#122

Open
Madzionator wants to merge 15 commits intomainfrom
feature/infra-page-update
Open

feat: InferPage visual & functional improvements#122
Madzionator wants to merge 15 commits intomainfrom
feature/infra-page-update

Conversation

@Madzionator
Copy link
Collaborator

Visual improvements

  • Redesigned main chat layout (Home.razor) - new structure, spacing and component organization
  • Updated navigation bar with backend type indicator tag showing current BackendType (e.g. Local, DeepSeek, OpenAI)
  • Refreshed color scheme with accent color aligned to MaIN library branding; replaced eval-based theme access with dedicated ThemeManager for consistent theme application across components
  • Updated scroll to be "smarter" - follow output unless user scrolled up

Functional improvements

  • Added file attachment support in chat
  • Added cancel/stop generation button
  • Added show/hide reasoning toggle button
  • Updated backend type configuration - use BackendType enum for backend config and UI

Bug fixes

  • Fixed progressive token streaming for file-based chat messages
  • Fixed browser-level theme persistence - selected theme is now correctly remembered across page reloads

Refactoring

  • Cleaned up Program.cs - simplified and reorganized service registration, removed redundant configuration boilerplate
  • Extracted reusable helper methods to MaIN.Domain/Extensions.cs to reduce code duplication across services
  • Refactored OpenAiCompatibleService and LLMService internals - added CancellationToken propagation through the chat message processing pipeline, enabling proper cancellation of in-flight requests

Refactor backend selection to use BackendType everywhere and simplify API key handling. Added Extensions.GetApiKeyVariable to map backends to env vars; Program now sets Utils.BackendType from the CLI arg, prompts for missing API keys (and marks Utils.HasApiKey), and only registers MaIN services when a non-self backend is selected. Utils was simplified: removed per-backend booleans, added BackendType, HasApiKey, IsLocal helper and moved Reason flag. UI updates: NavBar shows backend and model badges (with color/display name logic including "Local Ollama"), and Home.razor now branches on BackendType and uses Utils.IsLocal for MessageType. Also trimmed launchSettings applicationUrl.
Introduce a small JS themeManager in App.razor that bootstraps theme on page load (reads localStorage, parses JSON, and sets documentElement data-theme for dark mode) and exposes save/load helpers. Replace prior eval-based localStorage/document access in NavBar.razor and Home.razor with calls to themeManager.load, and update component logic to derive UI mode/accent color from the returned value. This centralizes theme persistence, avoids using eval, and provides safer parsing and fallbacks.
Remove the old BackendType extension and centralize API key metadata in LLMApiRegistry (moved to MaIN.Domain.Models.Concrete). Program.cs now looks up the registry entry for each BackendType to read ApiKeyEnvName instead of calling GetApiKeyVariable. Updated numerous LLM and image service files (and McpService) to reference the new namespace. This change consolidates API key configuration and removes the duplicated extension method.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant