implemented offline cache
This commit is contained in:
60
README.md
60
README.md
@@ -68,8 +68,10 @@ daily-journal-prompt/
|
||||
├── requirements.txt # Python dependencies
|
||||
├── ds_prompt.txt # AI prompt template for generating journal prompts
|
||||
├── historic_prompts.json # History of previous 60 prompts (JSON format)
|
||||
├── pool_prompts.json # Pool of available prompts for selection (JSON format)
|
||||
├── example.env # Example environment configuration
|
||||
├── .env # Your actual environment configuration (gitignored)
|
||||
├── settings.cfg # Configuration file for prompt settings and pool size
|
||||
└── .gitignore # Git ignore rules
|
||||
```
|
||||
|
||||
@@ -80,10 +82,12 @@ daily-journal-prompt/
|
||||
- **run.sh**: Convenience bash script for easy execution
|
||||
- **test_project.py**: Test suite to verify project setup
|
||||
- **requirements.txt**: Python dependencies (openai, python-dotenv, rich)
|
||||
- **ds_prompt.txt**: The core prompt template that instructs the AI to generate 6 new journal prompts
|
||||
- **historic_prompts.json**: JSON array containing the last 60 generated prompts
|
||||
- **ds_prompt.txt**: The core prompt template that instructs the AI to generate new journal prompts
|
||||
- **historic_prompts.json**: JSON array containing the last 60 generated prompts (cyclic buffer)
|
||||
- **pool_prompts.json**: JSON array containing the pool of available prompts for selection
|
||||
- **example.env**: Template for your environment configuration
|
||||
- **.env**: Your actual environment variables (not tracked in git for security)
|
||||
- **settings.cfg**: Configuration file for prompt settings (length, count) and pool size
|
||||
|
||||
## 🎯 Quick Start
|
||||
|
||||
@@ -140,14 +144,56 @@ python test_project.py
|
||||
|
||||
## 🔧 Usage
|
||||
|
||||
### New Pool-Based System
|
||||
|
||||
The system now uses a two-step process:
|
||||
|
||||
1. **Fill the Prompt Pool**: Generate prompts using AI and add them to the pool
|
||||
2. **Draw from Pool**: Select prompts from the pool for journaling sessions
|
||||
|
||||
### Command Line Options
|
||||
|
||||
```bash
|
||||
# Default: Draw prompts from pool (no API call)
|
||||
python generate_prompts.py
|
||||
|
||||
# Interactive mode with menu
|
||||
python generate_prompts.py --interactive
|
||||
|
||||
# Fill the prompt pool using AI (makes API call)
|
||||
python generate_prompts.py --fill-pool
|
||||
|
||||
# Show pool statistics
|
||||
python generate_prompts.py --pool-stats
|
||||
|
||||
# Show history statistics
|
||||
python generate_prompts.py --stats
|
||||
|
||||
# Help
|
||||
python generate_prompts.py --help
|
||||
```
|
||||
|
||||
### Interactive Mode Options
|
||||
|
||||
1. **Draw prompts from pool (no API call)**: Displays prompts from the pool file
|
||||
2. **Fill prompt pool using API**: Generates new prompts using AI and adds them to pool
|
||||
3. **View pool statistics**: Shows pool size, target size, and available sessions
|
||||
4. **View history statistics**: Shows historic prompt count and capacity
|
||||
5. **Exit**: Quit the program
|
||||
|
||||
### Prompt Generation Process
|
||||
|
||||
1. The system reads the template from `ds_prompt.txt`
|
||||
2. It loads the previous 60 prompts from the fixed length cyclic buffer `historic_prompts.json`
|
||||
3. The AI generates 6 new prompts, attempting to minimize repetition
|
||||
4. Six new prompts are displayed.
|
||||
5. User selects one prompt for his/her journal writing session, which is added to the `historic_prompts.json` cyclic buffer.
|
||||
1. User chooses to fill the prompt pool.
|
||||
2. The system reads the template from `ds_prompt.txt`
|
||||
3. It loads the previous 60 prompts from the fixed length cyclic buffer `historic_prompts.json`
|
||||
4. The AI generates some number of new prompts, attempting to minimize repetition
|
||||
5. The new prompts are used to fill the prompt pool to the `settings.cfg` configured value.
|
||||
|
||||
### Prompt Selection Process
|
||||
|
||||
1. A `settings.cfg` configurable number of prompts are drawn from the prompt pool and displayed to the user.
|
||||
2. User selects one prompt for his/her journal writing session, which is added to the `historic_prompts.json` cyclic buffer.
|
||||
3. All prompts which were displayed are removed from the prompt pool permanently.
|
||||
|
||||
## 📝 Prompt Examples
|
||||
|
||||
|
||||
Reference in New Issue
Block a user