Skip to content

refactor: migrate to genai-lite LLM module#65

Merged
lacerbi merged 6 commits into
mainfrom
llm-switch
Jul 3, 2025
Merged

refactor: migrate to genai-lite LLM module#65
lacerbi merged 6 commits into
mainfrom
llm-switch

Conversation

@lacerbi

@lacerbi lacerbi commented Jul 3, 2025

Copy link
Copy Markdown
Owner

Summary

  • Replaced integrated LLM implementation with external genai-lite package (^0.1.0)
  • Maintained full backward compatibility including environment variable support
  • Simplified codebase by removing ~3000 lines of internal LLM code

Changes

Core Refactoring

  • Removed entire electron/modules/llm/ directory containing internal LLM implementation
  • Added genai-lite as external dependency providing unified LLM functionality
  • Created common/types/llm.ts for shared IPC channel constants
  • Implemented custom ApiKeyProvider that supports both secure storage and environment variables

Build System Updates

  • Updated webpack configurations to include common/ directory for TypeScript compilation
  • Verified successful build with npm run package

Bug Fixes

  • Restored environment variable fallback (ATHANOR_<PROVIDER>_API_KEY) that was temporarily lost
  • Fixed documentation: ATHANOR_GEMINI_API_KEY (was incorrectly ATHANOR_GOOGLE_API_KEY)

Documentation

  • Updated CLAUDE.md and PROJECT.md to reflect new architecture
  • Added Mistral to environment variable examples
  • Documented common/types/ pattern for shared types

Test Plan

  • TypeScript compilation passes (npx tsc --noEmit)
  • Application builds successfully (npm run package)
  • Environment variable fallback works for all providers
  • Manual testing of API key functionality with each provider
  • Verify "Send via API" button works correctly

Breaking Changes

None - this refactoring maintains full backward compatibility.

🤖 Generated with Claude Code

lacerbi and others added 6 commits July 3, 2025 22:48
Signed-off-by: Luigi Acerbi <luigi.acerbi@gmail.com>
Replace integrated LLM implementation with genai-lite package:
- Add genai-lite ^0.1.0 dependency
- Remove old electron/modules/llm directory
- Implement custom ApiKeyProvider using genai-key-storage-lite
- Centralize IPC channel constants in common/types/llm.ts
- Update all imports and type references to use genai-lite
- Fix webpack configs to include common directory
- Maintain full backward compatibility with existing API

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: lacerbi <luigi.acerbi@gmail.com>
- Add environment variable checking to isKeyAvailable handler
- Update ApiKeyProvider to fall back to env vars when storage fails
- Support ATHANOR_<PROVIDER>_API_KEY pattern for all providers
- Fix documentation: use ATHANOR_GEMINI_API_KEY (not GOOGLE)
- Add Mistral to environment variable examples

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: lacerbi <luigi.acerbi@gmail.com>
Update CLAUDE.md and PROJECT.md to reflect the new architecture:
- Replace references to old electron/modules/llm/ directory
- Document genai-lite as the unified LLM integration
- Add common/types/ directory documentation
- Note environment variable support pattern
- Update dependency lists to remove individual LLM SDKs

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: lacerbi <luigi.acerbi@gmail.com>
Document the migration to genai-lite external package and all related improvements.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: lacerbi <luigi.acerbi@gmail.com>
Both migrations are now complete:
- API keys module migration (completed in v0.7.9)
- LLM module migration (completed in v0.7.10)

These design documents have served their purpose and can be removed.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: lacerbi <luigi.acerbi@gmail.com>
@lacerbi lacerbi merged commit ed2e787 into main Jul 3, 2025
11 checks passed
@lacerbi lacerbi deleted the llm-switch branch July 3, 2025 21:49
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