dmitrybryantsew/ChemCalculationAndManagementApp

WIP App to Process Chem Data and Have Access to some LLM providers to chat with llm(Zai, Chutes, Openrouter)

C#

0

68 commits

updated Sep 10, 2026

See the code

README

ChemCalculationAndManagementApp

A .NET 9 MAUI cross-platform (Android, iOS, Mac Catalyst, Windows) lab/research assistant that combines chemistry-focused batch image analysis, LLM-powered chat, voice-to-text transcription, and Google Sheets/Drive connectivity.

Key Features

  • Batch Chemical Screen Analysis — point the app at a folder of machine screen captures, and it sends each image to a vision LLM with a machine-specific prompt, parses the returned JSON (station → PU/TPU weights, ratios, temperatures), merges results by station, and uploads a structured table to a per-machine tab in a date-stamped Google Spreadsheet under a readings/ Drive folder.
  • AI Chat — full conversation interface with SQLite-backed history, streaming responses, multi-provider routing, vision (image analysis), and a conversation list/search page.
  • Voice-to-Text — multiple transcription engines behind one router: Chutes Whisper cloud API, OpenAI-proxy multimodal, local Whisper.net (CPU/GPU on Windows), and Android WhisperCpp (JNI/native .so), with automatic fallback.
  • Personal Organizer — import rows from a Google Spreadsheet, classify them (project / account / task / note) with secret detection, persist to SQLite, and re-export to Google.
  • Model Picker — fetches live model lists from all four providers, with fallback lists and grouped presentation.

Providers

ProviderAuthNotes
OpenRouterAPI keyhttps://openrouter.ai/api/v1/chat/completions; sends HTTP-Referer.
ZAIAPI keyStandard or Coding/Subscription endpoint, selected by a setting.
ChutesAPI keyhttps://llm.chutes.ai/v1/chat/completions; UUID|Name model IDs normalized.
OpenAIProxyAPI keyOpenAI-compatible gateway; base URL normalized via OpenAiProxyEndpoint.BuildUrl.

Architecture

  • MVVM with CommunityToolkit.Mvvm source generators ([ObservableProperty], [RelayCommand]).
  • DI via Microsoft.Extensions.DependencyInjection (MauiProgram.cs).
  • Services: OpenRouterService (multi-provider chat/vision/streaming), BatchAnalysisService, GoogleSheetsService, AiModelService, TranscriptionRouterService, SettingsService, PersonalOrganizerClassifier.
  • Data: sqlite-net-pcl via DatabaseService + ChatRepository / PersonalOrganizerRepository; platform path abstracted via IDatabasePathProvider.
  • Secrets: LLM keys in Preferences; Google OAuth IDs/secrets in SecureStorage with environment-variable fallback.

How to Run

# Build the entire solution
dotnet build ChemCalculationAndManagementApp.sln

# Run the Windows desktop app
dotnet build -t:Run -f net9.0-windows10.0.19041.0

# Run the Android app (emulator or device)
dotnet build -t:Run -f net9.0-android

# Run all tests
dotnet test ChemCalculationAndManagementApp.Tests/ChemCalculationAndManagementApp.Tests.csproj

Requirements:

  • .NET 9 SDK
  • Windows 10.0.17763+ (for the Windows target; Whisper.net + local WhisperNet.dll/Whisper.dll referenced from a sibling ..\..\Whisper\ build output)
  • Android SDK 21+ (native .so libraries in Platforms/Android/jniLibs/)
  • A Google Cloud project with OAuth credentials (Android/iOS/Windows client IDs) and the Sheets + Drive APIs enabled (for batch analysis upload)
  • An LLM API key for at least one provider, configurable in Settings

Test Posture

xUnit suite (net9.0, non-MAUI, compiles source directly to avoid loading MAUI dependencies): covers OpenAI-proxy URL normalization, multi-provider routing, model filtering, streaming/SSE models, chat search logic, personal organizer classification, and a secret-regression scan for known leaked API-key patterns.

dotnet test   # 77 passed, 2 skipped (verified 2026-07-29)

Project Structure

ChemCalculationAndManagementApp/
├── ChemCalculationAndManagementApp.sln
├── README.md
├── ChemCalculationAndManagementApp/            # MAUI app project
│   ├── MauiProgram.cs                          # DI + SSL handler factory
│   ├── APIServices/                            # Python backend client
│   ├── Models/                                 # SQLite-mapped entities
│   ├── Data/                                   # DatabaseService, ChatRepository
│   ├── Services/
│   │   ├── OpenRouterService.cs                # Multi-provider chat/vision/streaming
│   │   ├── BatchAnalysisService.cs             # Image-folder -> AI -> JSON -> Sheets
│   │   ├── GoogleSheetsService.cs              # OAuth + Sheets/Drive CRUD
│   │   ├── AiModelService.cs / AiModelFilter.cs
│   │   ├── AnalysisPrompts.cs                  # Machine-specific vision prompts
│   │   ├── PersonalOrganizer*.cs
│   │   ├── Audio/                              # AudioRecorderService
│   │   └── Transcription/                      # Router + 5 Whisper backends
│   ├── ViewModels/                             # CommunityToolkit.Mvvm VMs
│   ├── Converters/                            # 8 XAML value converters
│   ├── *.xaml / *.xaml.cs                     # Pages (Chat, Batch, Voice, Settings, ...)
│   └── Platforms/                              # Android (JNI/.so), Windows, iOS, MacCatalyst
└── ChemCalculationAndManagementApp.Tests/       # xUnit + Moq + FluentAssertions

License

See LICENSE.txt.

dmitrybryantsew/ChemCalculationAndManagementApp

WIP App to Process Chem Data and Have Access to some LLM providers to chat with llm(Zai, Chutes, Openrouter)

C#

0

68 commits

updated Sep 10, 2026

See the code

README

ChemCalculationAndManagementApp

A .NET 9 MAUI cross-platform (Android, iOS, Mac Catalyst, Windows) lab/research assistant that combines chemistry-focused batch image analysis, LLM-powered chat, voice-to-text transcription, and Google Sheets/Drive connectivity.

Key Features

  • Batch Chemical Screen Analysis — point the app at a folder of machine screen captures, and it sends each image to a vision LLM with a machine-specific prompt, parses the returned JSON (station → PU/TPU weights, ratios, temperatures), merges results by station, and uploads a structured table to a per-machine tab in a date-stamped Google Spreadsheet under a readings/ Drive folder.
  • AI Chat — full conversation interface with SQLite-backed history, streaming responses, multi-provider routing, vision (image analysis), and a conversation list/search page.
  • Voice-to-Text — multiple transcription engines behind one router: Chutes Whisper cloud API, OpenAI-proxy multimodal, local Whisper.net (CPU/GPU on Windows), and Android WhisperCpp (JNI/native .so), with automatic fallback.
  • Personal Organizer — import rows from a Google Spreadsheet, classify them (project / account / task / note) with secret detection, persist to SQLite, and re-export to Google.
  • Model Picker — fetches live model lists from all four providers, with fallback lists and grouped presentation.

Providers

ProviderAuthNotes
OpenRouterAPI keyhttps://openrouter.ai/api/v1/chat/completions; sends HTTP-Referer.
ZAIAPI keyStandard or Coding/Subscription endpoint, selected by a setting.
ChutesAPI keyhttps://llm.chutes.ai/v1/chat/completions; UUID|Name model IDs normalized.
OpenAIProxyAPI keyOpenAI-compatible gateway; base URL normalized via OpenAiProxyEndpoint.BuildUrl.

Architecture

  • MVVM with CommunityToolkit.Mvvm source generators ([ObservableProperty], [RelayCommand]).
  • DI via Microsoft.Extensions.DependencyInjection (MauiProgram.cs).
  • Services: OpenRouterService (multi-provider chat/vision/streaming), BatchAnalysisService, GoogleSheetsService, AiModelService, TranscriptionRouterService, SettingsService, PersonalOrganizerClassifier.
  • Data: sqlite-net-pcl via DatabaseService + ChatRepository / PersonalOrganizerRepository; platform path abstracted via IDatabasePathProvider.
  • Secrets: LLM keys in Preferences; Google OAuth IDs/secrets in SecureStorage with environment-variable fallback.

How to Run

# Build the entire solution
dotnet build ChemCalculationAndManagementApp.sln

# Run the Windows desktop app
dotnet build -t:Run -f net9.0-windows10.0.19041.0

# Run the Android app (emulator or device)
dotnet build -t:Run -f net9.0-android

# Run all tests
dotnet test ChemCalculationAndManagementApp.Tests/ChemCalculationAndManagementApp.Tests.csproj

Requirements:

  • .NET 9 SDK
  • Windows 10.0.17763+ (for the Windows target; Whisper.net + local WhisperNet.dll/Whisper.dll referenced from a sibling ..\..\Whisper\ build output)
  • Android SDK 21+ (native .so libraries in Platforms/Android/jniLibs/)
  • A Google Cloud project with OAuth credentials (Android/iOS/Windows client IDs) and the Sheets + Drive APIs enabled (for batch analysis upload)
  • An LLM API key for at least one provider, configurable in Settings

Test Posture

xUnit suite (net9.0, non-MAUI, compiles source directly to avoid loading MAUI dependencies): covers OpenAI-proxy URL normalization, multi-provider routing, model filtering, streaming/SSE models, chat search logic, personal organizer classification, and a secret-regression scan for known leaked API-key patterns.

dotnet test   # 77 passed, 2 skipped (verified 2026-07-29)

Project Structure

ChemCalculationAndManagementApp/
├── ChemCalculationAndManagementApp.sln
├── README.md
├── ChemCalculationAndManagementApp/            # MAUI app project
│   ├── MauiProgram.cs                          # DI + SSL handler factory
│   ├── APIServices/                            # Python backend client
│   ├── Models/                                 # SQLite-mapped entities
│   ├── Data/                                   # DatabaseService, ChatRepository
│   ├── Services/
│   │   ├── OpenRouterService.cs                # Multi-provider chat/vision/streaming
│   │   ├── BatchAnalysisService.cs             # Image-folder -> AI -> JSON -> Sheets
│   │   ├── GoogleSheetsService.cs              # OAuth + Sheets/Drive CRUD
│   │   ├── AiModelService.cs / AiModelFilter.cs
│   │   ├── AnalysisPrompts.cs                  # Machine-specific vision prompts
│   │   ├── PersonalOrganizer*.cs
│   │   ├── Audio/                              # AudioRecorderService
│   │   └── Transcription/                      # Router + 5 Whisper backends
│   ├── ViewModels/                             # CommunityToolkit.Mvvm VMs
│   ├── Converters/                            # 8 XAML value converters
│   ├── *.xaml / *.xaml.cs                     # Pages (Chat, Batch, Voice, Settings, ...)
│   └── Platforms/                              # Android (JNI/.so), Windows, iOS, MacCatalyst
└── ChemCalculationAndManagementApp.Tests/       # xUnit + Moq + FluentAssertions

License

See LICENSE.txt.