This commit introduces the capability to summarize Reddit thread content (title + selftext) using the Google Gemini API.
Key changes:
- Added `google-generativeai` to `requirements.txt`.
- Updated `utils/.config.template.toml` and `utils/settings.py` to include a new `[gemini]` configuration section for `api_key` and `enable_summary`. Includes interactive prompt for API key if summarization is enabled but key is missing.
- Created `utils/gemini_client.py` module:
- `initialize_gemini()`: Configures the Gemini client with API key and initializes the `gemini-1.5-pro-latest` model (configurable via settings).
- `summarize_text_with_gemini()`: Takes text, generates a prompt, calls the Gemini API, and returns the summary. Includes error handling for API calls and content safety.
- Integrated into `main.py`:
- Gemini client is initialized at startup if enabled.
- In `generate_audio_and_screenshots()`, if summarization is enabled, the thread's selftext is replaced with the Gemini-generated summary before being passed to TTS. Falls back to original text on error.
- Added relevant logging and documentation for the new feature.