Compare commits
9 Commits
fastapi_at
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 6879a75f09 | |||
| 18f2f6f461 | |||
| 928f08cc57 | |||
| da300f75fe | |||
| b0b343e009 | |||
| ffaa7c96ba | |||
| c5893a6de4 | |||
| 554efec086 | |||
| 4d089eeb88 |
4
.gitignore
vendored
4
.gitignore
vendored
@@ -1,4 +1,6 @@
|
||||
.env
|
||||
venv
|
||||
__pycache__
|
||||
journal_prompt_*
|
||||
historic_prompts.json
|
||||
pool_prompts.json
|
||||
feedback_words.json
|
||||
|
||||
163
AGENTS.md
Normal file
163
AGENTS.md
Normal file
@@ -0,0 +1,163 @@
|
||||
# Task: Combine pool and history stats into a single function and single menu item
|
||||
|
||||
## Changes Made
|
||||
|
||||
### 1. Created New Combined Stats Function
|
||||
- Added `show_combined_stats()` method to `JournalPromptGenerator` class
|
||||
- Combines both pool statistics and history statistics into a single function
|
||||
- Displays two tables: "Prompt Pool Statistics" and "Prompt History Statistics"
|
||||
|
||||
### 2. Updated Interactive Menu
|
||||
- Changed menu from 5 options to 4 options:
|
||||
- 1. Draw prompts from pool (no API call)
|
||||
- 2. Fill prompt pool using API
|
||||
- 3. View combined statistics (replaces separate pool and history stats)
|
||||
- 4. Exit
|
||||
- Updated menu handling logic to use the new combined stats function
|
||||
|
||||
### 3. Updated Command-Line Arguments
|
||||
- Removed `--pool-stats` argument
|
||||
- Updated `--stats` argument description to "Show combined statistics (pool and history)"
|
||||
- Updated main function logic to use `show_combined_stats()` instead of separate functions
|
||||
|
||||
### 4. Removed Old Stats Functions
|
||||
- Removed `show_pool_stats()` method
|
||||
- Removed `show_history_stats()` method
|
||||
- All functionality consolidated into `show_combined_stats()`
|
||||
|
||||
### 5. Code Cleanup
|
||||
- Removed unused imports and references to old stats functions
|
||||
- Ensured all menu options work correctly with the new combined stats
|
||||
|
||||
## Testing
|
||||
- Verified `--stats` command-line argument works correctly
|
||||
- Tested interactive mode shows updated menu
|
||||
- Confirmed combined stats display both pool and history information
|
||||
- Tested default mode (draw from pool) still works
|
||||
- Verified fill-pool option starts correctly
|
||||
|
||||
## Result
|
||||
Successfully combined pool and history statistics into a single function and single menu item, simplifying the user interface while maintaining all functionality.
|
||||
|
||||
---
|
||||
|
||||
# Task: Implement theme feedback words functionality with new menu item
|
||||
|
||||
## Changes Made
|
||||
|
||||
### 1. Added New Theme Feedback Words API Call
|
||||
- Created `generate_theme_feedback_words()` method that:
|
||||
- Loads `ds_feedback.txt` prompt template
|
||||
- Sends historic prompts to AI API for analysis
|
||||
- **INCLUDES current feedback words from `feedback_words.json` in the API payload**
|
||||
- Receives 6 theme words as JSON response
|
||||
- Parses and validates the response
|
||||
|
||||
### 2. Added User Rating System
|
||||
- Created `collect_feedback_ratings()` method that:
|
||||
- Presents each of the 6 theme words to the user
|
||||
- Collects ratings from 0-6 for each word
|
||||
- Creates structured feedback items with keys (feedback00-feedback05)
|
||||
- Includes weight values based on user ratings
|
||||
|
||||
### 3. Added Feedback Words Update System
|
||||
- Created `update_feedback_words()` method that:
|
||||
- Replaces existing feedback words with new ratings
|
||||
- Saves updated feedback words to `feedback_words.json`
|
||||
- Maintains the required JSON structure
|
||||
|
||||
### 4. Updated Interactive Menu
|
||||
- Expanded menu from 4 options to 5 options:
|
||||
- 1. Draw prompts from pool (no API call)
|
||||
- 2. Fill prompt pool using API
|
||||
- 3. View combined statistics
|
||||
- 4. Generate and rate theme feedback words (NEW)
|
||||
- 5. Exit
|
||||
- Added complete implementation for option 4
|
||||
|
||||
### 5. Enhanced Data Handling
|
||||
- Added `_save_feedback_words()` method for saving feedback data
|
||||
- Updated `_load_feedback_words()` to handle JSON structure properly
|
||||
- Ensured feedback words are included in AI prompts when generating new prompts
|
||||
|
||||
## Testing
|
||||
- Verified all new methods exist and have correct signatures
|
||||
- Confirmed `ds_feedback.txt` file exists and is readable
|
||||
- Tested feedback words JSON structure validation
|
||||
- Verified interactive menu displays new option correctly
|
||||
- Confirmed existing functionality remains intact
|
||||
|
||||
## Result
|
||||
Successfully implemented a new menu item and functionality for generating theme feedback words. The system now:
|
||||
1. Makes an API call with historic prompts and `ds_feedback.txt` template
|
||||
2. Receives 6 theme words from the AI
|
||||
3. Collects user ratings (0-6) for each word
|
||||
4. Updates `feedback_words.json` with the new ratings
|
||||
5. Integrates the feedback into future prompt generation
|
||||
|
||||
The implementation maintains backward compatibility while adding valuable feedback functionality to improve prompt generation quality over time.
|
||||
|
||||
Too many tests, so I moved all of them into the tests directory.
|
||||
|
||||
---
|
||||
|
||||
# Task: Implement feedback_historic.json cyclic buffer system (30 items)
|
||||
|
||||
## Changes Made
|
||||
|
||||
### 1. Added Feedback Historic System
|
||||
- Created `feedback_historic.json` file to store previous feedback words (without weights)
|
||||
- Implemented a cyclic buffer system with 30-item capacity (feedback00-feedback29)
|
||||
- When new feedback is generated (6 words), they become feedback00-feedback05
|
||||
- All existing items shift down by 6 positions
|
||||
- Items beyond feedback29 are discarded
|
||||
|
||||
### 2. Updated Class Initialization
|
||||
- Added `feedback_historic` attribute to `JournalPromptGenerator` class
|
||||
- Updated `__init__` method to load `feedback_historic.json`
|
||||
- Added `_load_feedback_historic()` method to load historic feedback words
|
||||
- Added `_save_feedback_historic()` method to save historic feedback words (keeping only first 30)
|
||||
|
||||
### 3. Enhanced Feedback Words Management
|
||||
- Updated `add_feedback_words_to_history()` method to:
|
||||
- Extract just the words from current feedback words (no weights)
|
||||
- Add 6 new words to the historic buffer
|
||||
- Shift all existing words down by 6 positions
|
||||
- Maintain 30-item limit by discarding oldest items
|
||||
- Updated `update_feedback_words()` to automatically call `add_feedback_words_to_history()`
|
||||
|
||||
### 4. Improved AI Prompt Generation
|
||||
- Updated `generate_theme_feedback_words()` method to include historic feedback words in API call
|
||||
- The prompt now includes three sections:
|
||||
1. Previous prompts (historic prompts)
|
||||
2. Current feedback themes (with weights)
|
||||
3. Historic feedback themes (just words, no weights)
|
||||
- This helps the AI avoid repeating previously used theme words
|
||||
|
||||
### 5. Data Structure Design
|
||||
- Historic feedback words are stored as a list of dictionaries with keys (feedback00, feedback01, etc.)
|
||||
- Each dictionary contains only the word (no weight field)
|
||||
- Structure mirrors `prompts_historic.json` but for feedback words
|
||||
- 30-item limit provides sufficient history while preventing excessive repetition
|
||||
|
||||
## Testing
|
||||
- Created comprehensive test to verify cyclic buffer functionality
|
||||
- Tested that new items are added at the beginning (feedback00-feedback05)
|
||||
- Verified that existing items shift down correctly
|
||||
- Confirmed 30-item limit is enforced (oldest items are dropped)
|
||||
- Tested that historic feedback words are included in AI prompts
|
||||
- Verified that weights are not stored in historic buffer (only words)
|
||||
|
||||
## Result
|
||||
Successfully implemented a feedback historic cyclic buffer system that:
|
||||
1. Stores previous feedback words in `feedback_historic.json` (30-item limit)
|
||||
2. Automatically adds new feedback words to history when they are updated
|
||||
3. Includes historic feedback words in AI prompts to avoid repetition
|
||||
4. Maintains consistent data structure with the rest of the system
|
||||
5. Provides a memory of previous theme words to improve AI suggestions over time
|
||||
|
||||
The system now has a complete feedback loop where:
|
||||
- Historic prompts and feedback words inform new theme word generation
|
||||
- New theme words are rated by users and become current feedback words
|
||||
- Current feedback words are added to the historic buffer
|
||||
- Historic feedback words help avoid repetition in future theme word generation
|
||||
22
README.md
22
README.md
@@ -62,12 +62,13 @@ A Python tool that uses OpenAI-compatible AI endpoints to generate creative writ
|
||||
daily-journal-prompt/
|
||||
├── README.md # This documentation
|
||||
├── generate_prompts.py # Main Python script with rich interface
|
||||
├── simple_generate.py # Lightweight version without rich dependency
|
||||
├── run.sh # Convenience bash script
|
||||
├── test_project.py # Test suite for the project
|
||||
├── 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)
|
||||
├── prompts_historic.json # History of previous 60 prompts (JSON format)
|
||||
├── prompts_pool.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
|
||||
@@ -77,12 +78,13 @@ daily-journal-prompt/
|
||||
### File Descriptions
|
||||
|
||||
- **generate_prompts.py**: Main Python script with interactive mode, rich formatting, and full features
|
||||
- **simple_generate.py**: Lightweight version without rich dependency for basic usage
|
||||
- **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 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
|
||||
- **prompts_historic.json**: JSON array containing the last 60 generated prompts (cyclic buffer)
|
||||
- **prompts_pool.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
|
||||
@@ -100,6 +102,8 @@ chmod +x run.sh
|
||||
# Interactive mode with rich interface
|
||||
./run.sh --interactive
|
||||
|
||||
# Simple version without rich dependency
|
||||
./run.sh --simple
|
||||
|
||||
# Show statistics
|
||||
./run.sh --stats
|
||||
@@ -128,6 +132,8 @@ python generate_prompts.py --interactive
|
||||
# Show statistics
|
||||
python generate_prompts.py --stats
|
||||
|
||||
# Simple version (no rich dependency needed)
|
||||
python simple_generate.py
|
||||
```
|
||||
|
||||
### Testing Your Setup
|
||||
@@ -179,19 +185,19 @@ python generate_prompts.py --help
|
||||
|
||||
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`
|
||||
3. It loads the previous 60 prompts from the fixed length cyclic buffer `prompts_historic.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.
|
||||
2. User selects one prompt for his/her journal writing session, which is added to the `prompts_historic.json` cyclic buffer.
|
||||
3. All prompts which were displayed are removed from the prompt pool permanently.
|
||||
|
||||
## 📝 Prompt Examples
|
||||
|
||||
The tool generates prompts like these (from `historic_prompts.json`):
|
||||
The tool generates prompts like these (from `prompts_historic.json`):
|
||||
|
||||
- **Memory-based**: "Describe a memory you have that is tied to a specific smell..."
|
||||
- **Creative Writing**: "Invent a mythological creature for a modern urban setting..."
|
||||
@@ -228,7 +234,7 @@ You can modify `ds_prompt.txt` to change the prompt generation parameters:
|
||||
|
||||
## 🔄 Maintaining Prompt History
|
||||
|
||||
The `historic_prompts.json` file maintains a rolling history of the last 60 prompts. This helps:
|
||||
The `prompts_historic.json` file maintains a rolling history of the last 60 prompts. This helps:
|
||||
|
||||
1. **Avoid repetition**: The AI references previous prompts to generate new, diverse topics
|
||||
2. **Track usage**: See what types of prompts have been generated
|
||||
|
||||
119
demonstrate_feedback_historic.py
Normal file
119
demonstrate_feedback_historic.py
Normal file
@@ -0,0 +1,119 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Demonstration of the feedback_historic.json cyclic buffer system.
|
||||
"""
|
||||
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
from generate_prompts import JournalPromptGenerator
|
||||
|
||||
def demonstrate_system():
|
||||
"""Demonstrate the feedback historic system."""
|
||||
print("="*70)
|
||||
print("DEMONSTRATION: Feedback Historic Cyclic Buffer System")
|
||||
print("="*70)
|
||||
|
||||
# Create a temporary .env file
|
||||
with open(".env.demo", "w") as f:
|
||||
f.write("DEEPSEEK_API_KEY=demo_key\n")
|
||||
f.write("API_BASE_URL=https://api.deepseek.com\n")
|
||||
f.write("MODEL=deepseek-chat\n")
|
||||
|
||||
# Initialize generator
|
||||
generator = JournalPromptGenerator(config_path=".env.demo")
|
||||
|
||||
print("\n1. Initial state:")
|
||||
print(f" - feedback_words: {len(generator.feedback_words)} items")
|
||||
print(f" - feedback_historic: {len(generator.feedback_historic)} items")
|
||||
|
||||
# Create some sample feedback words
|
||||
sample_words_batch1 = [
|
||||
{"feedback00": "memory", "weight": 5},
|
||||
{"feedback01": "time", "weight": 4},
|
||||
{"feedback02": "nature", "weight": 3},
|
||||
{"feedback03": "emotion", "weight": 6},
|
||||
{"feedback04": "change", "weight": 2},
|
||||
{"feedback05": "connection", "weight": 4}
|
||||
]
|
||||
|
||||
print("\n2. Adding first batch of feedback words...")
|
||||
generator.update_feedback_words(sample_words_batch1)
|
||||
print(f" - Added 6 feedback words")
|
||||
print(f" - feedback_historic now has: {len(generator.feedback_historic)} items")
|
||||
|
||||
# Show the historic items
|
||||
print("\n Historic feedback words (no weights):")
|
||||
for i, item in enumerate(generator.feedback_historic):
|
||||
key = list(item.keys())[0]
|
||||
print(f" {key}: {item[key]}")
|
||||
|
||||
# Add second batch
|
||||
sample_words_batch2 = [
|
||||
{"feedback00": "creativity", "weight": 5},
|
||||
{"feedback01": "reflection", "weight": 4},
|
||||
{"feedback02": "growth", "weight": 3},
|
||||
{"feedback03": "transformation", "weight": 6},
|
||||
{"feedback04": "journey", "weight": 2},
|
||||
{"feedback05": "discovery", "weight": 4}
|
||||
]
|
||||
|
||||
print("\n3. Adding second batch of feedback words...")
|
||||
generator.update_feedback_words(sample_words_batch2)
|
||||
print(f" - Added 6 more feedback words")
|
||||
print(f" - feedback_historic now has: {len(generator.feedback_historic)} items")
|
||||
|
||||
print("\n Historic feedback words after second batch:")
|
||||
print(" (New words at the top, old words shifted down)")
|
||||
for i, item in enumerate(generator.feedback_historic[:12]): # Show first 12
|
||||
key = list(item.keys())[0]
|
||||
print(f" {key}: {item[key]}")
|
||||
|
||||
# Demonstrate the cyclic buffer by adding more batches
|
||||
print("\n4. Demonstrating cyclic buffer (30 item limit)...")
|
||||
print(" Adding 5 more batches (30 more words total)...")
|
||||
|
||||
for batch_num in range(3, 8):
|
||||
batch_words = []
|
||||
for j in range(6):
|
||||
batch_words.append({f"feedback{j:02d}": f"batch{batch_num}_word{j+1}", "weight": 3})
|
||||
generator.update_feedback_words(batch_words)
|
||||
|
||||
print(f" - feedback_historic now has: {len(generator.feedback_historic)} items (max 30)")
|
||||
print(f" - Oldest items have been dropped to maintain 30-item limit")
|
||||
|
||||
# Show the structure
|
||||
print("\n5. Checking file structure...")
|
||||
if os.path.exists("feedback_historic.json"):
|
||||
with open("feedback_historic.json", "r") as f:
|
||||
data = json.load(f)
|
||||
print(f" - feedback_historic.json exists with {len(data)} items")
|
||||
print(f" - First item: {data[0]}")
|
||||
print(f" - Last item: {data[-1]}")
|
||||
print(f" - Items have keys (feedback00, feedback01, etc.) but no weights")
|
||||
|
||||
# Clean up
|
||||
os.remove(".env.demo")
|
||||
if os.path.exists("feedback_words.json"):
|
||||
os.remove("feedback_words.json")
|
||||
if os.path.exists("feedback_historic.json"):
|
||||
os.remove("feedback_historic.json")
|
||||
|
||||
print("\n" + "="*70)
|
||||
print("SUMMARY:")
|
||||
print("="*70)
|
||||
print("✓ feedback_historic.json stores previous feedback words (no weights)")
|
||||
print("✓ Maximum of 30 items (feedback00-feedback29)")
|
||||
print("✓ When new feedback is generated (6 words):")
|
||||
print(" - They become feedback00-feedback05 in the historic buffer")
|
||||
print(" - All existing items shift down by 6 positions")
|
||||
print(" - Items beyond feedback29 are discarded")
|
||||
print("✓ Historic feedback words are included in AI prompts for")
|
||||
print(" generate_theme_feedback_words() to avoid repetition")
|
||||
print("="*70)
|
||||
|
||||
if __name__ == "__main__":
|
||||
demonstrate_system()
|
||||
|
||||
20
ds_feedback.txt
Normal file
20
ds_feedback.txt
Normal file
@@ -0,0 +1,20 @@
|
||||
Request for generation of writing prompts for journaling
|
||||
|
||||
Payload:
|
||||
The previous 60 prompts have been provided as a JSON array for reference.
|
||||
The current 6 feedback themes have been provided. You will not re-use any of these most-recently used words here.
|
||||
The previous 30 feedback themes are also provided. You should try to avoid re-using these unless it really makes sense to.
|
||||
|
||||
Guidelines:
|
||||
Using the attached JSON of writing prompts, you should try to pick out 4 unique and intentionally vague single-word themes that apply to some portion of the list. They can range from common to uncommon words.
|
||||
Then add 2 more single word divergent themes that are less related to the historic prompts and are somewhat different from the other 4 for a total of 6 words.
|
||||
These 2 divergent themes give the user the option to steer away from existing themes.
|
||||
Examples for the divergent themes could be the option to add a theme like technology when the other themes are related to beauty, or mortality when the other themes are very positive.
|
||||
Be creative, don't just use my example.
|
||||
A very high temperature AI response is warranted here to generate a large vocabulary.
|
||||
|
||||
Expected Output:
|
||||
Output as a JSON list with just the six words, in lowercase.
|
||||
Despite the provided history being a keyed list or dictionary, the expected return JSON will be a simple list with no keys.
|
||||
Respond ONLY with valid JSON. No explanations, no markdown, no backticks.
|
||||
|
||||
@@ -2,6 +2,7 @@ Request for generation of writing prompts for journaling
|
||||
|
||||
Payload:
|
||||
The previous 60 prompts have been provided as a JSON array for reference.
|
||||
Some vague feedback themes have been provided, each having a weight value from 0 to 6.
|
||||
|
||||
Guidelines:
|
||||
Please generate some number of individual writing prompts in English following these guidelines.
|
||||
@@ -13,6 +14,11 @@ The provided history brackets two mechanisms.
|
||||
The history will allow for reducing repetition, however some thematic overlap is acceptable. Try harder to avoid overlap with lower indices in the array.
|
||||
As the user discards prompts, the themes will be very slowly steered, so it's okay to take some inspiration from the history.
|
||||
|
||||
Feedback Themes:
|
||||
A JSON of single-word feedback themes is provided with each having a weight value from 0 to 6.
|
||||
Consider these weighted themes only rarely when creating a new writing prompt. Most prompts should be created with full creative freedom.
|
||||
Only gently influence writing prompts with these. It is better to have all generated prompts ignore a theme than have many reference a theme overtly.
|
||||
|
||||
Expected Output:
|
||||
Output as a JSON list with the requested number of elements.
|
||||
Despite the provided history being a keyed list or dictionary, the expected return JSON will be a simple list with no keys.
|
||||
|
||||
92
feedback_historic.json
Normal file
92
feedback_historic.json
Normal file
@@ -0,0 +1,92 @@
|
||||
[
|
||||
{
|
||||
"feedback00": "labyrinth"
|
||||
},
|
||||
{
|
||||
"feedback01": "residue"
|
||||
},
|
||||
{
|
||||
"feedback02": "tremor"
|
||||
},
|
||||
{
|
||||
"feedback03": "effigy"
|
||||
},
|
||||
{
|
||||
"feedback04": "quasar"
|
||||
},
|
||||
{
|
||||
"feedback05": "gossamer"
|
||||
},
|
||||
{
|
||||
"feedback06": "resonance"
|
||||
},
|
||||
{
|
||||
"feedback07": "erosion"
|
||||
},
|
||||
{
|
||||
"feedback08": "surrender"
|
||||
},
|
||||
{
|
||||
"feedback09": "excess"
|
||||
},
|
||||
{
|
||||
"feedback10": "chaos"
|
||||
},
|
||||
{
|
||||
"feedback11": "fabric"
|
||||
},
|
||||
{
|
||||
"feedback12": "palimpsest"
|
||||
},
|
||||
{
|
||||
"feedback13": "lacuna"
|
||||
},
|
||||
{
|
||||
"feedback14": "efflorescence"
|
||||
},
|
||||
{
|
||||
"feedback15": "tessellation"
|
||||
},
|
||||
{
|
||||
"feedback16": "sublimation"
|
||||
},
|
||||
{
|
||||
"feedback17": "vertigo"
|
||||
},
|
||||
{
|
||||
"feedback18": "artifact"
|
||||
},
|
||||
{
|
||||
"feedback19": "mycelium"
|
||||
},
|
||||
{
|
||||
"feedback20": "threshold"
|
||||
},
|
||||
{
|
||||
"feedback21": "cartography"
|
||||
},
|
||||
{
|
||||
"feedback22": "spectacle"
|
||||
},
|
||||
{
|
||||
"feedback23": "friction"
|
||||
},
|
||||
{
|
||||
"feedback24": "mutation"
|
||||
},
|
||||
{
|
||||
"feedback25": "echo"
|
||||
},
|
||||
{
|
||||
"feedback26": "repair"
|
||||
},
|
||||
{
|
||||
"feedback27": "velocity"
|
||||
},
|
||||
{
|
||||
"feedback28": "syntax"
|
||||
},
|
||||
{
|
||||
"feedback29": "divergence"
|
||||
}
|
||||
]
|
||||
26
feedback_words.json
Normal file
26
feedback_words.json
Normal file
@@ -0,0 +1,26 @@
|
||||
[
|
||||
{
|
||||
"feedback00": "labyrinth",
|
||||
"weight": 3
|
||||
},
|
||||
{
|
||||
"feedback01": "residue",
|
||||
"weight": 3
|
||||
},
|
||||
{
|
||||
"feedback02": "tremor",
|
||||
"weight": 3
|
||||
},
|
||||
{
|
||||
"feedback03": "effigy",
|
||||
"weight": 3
|
||||
},
|
||||
{
|
||||
"feedback04": "quasar",
|
||||
"weight": 3
|
||||
},
|
||||
{
|
||||
"feedback05": "gossamer",
|
||||
"weight": 3
|
||||
}
|
||||
]
|
||||
@@ -30,6 +30,8 @@ class JournalPromptGenerator:
|
||||
self.client = None
|
||||
self.historic_prompts = []
|
||||
self.pool_prompts = []
|
||||
self.feedback_words = []
|
||||
self.feedback_historic = []
|
||||
self.prompt_template = ""
|
||||
self.settings = {}
|
||||
|
||||
@@ -41,6 +43,8 @@ class JournalPromptGenerator:
|
||||
self._load_prompt_template()
|
||||
self._load_historic_prompts()
|
||||
self._load_pool_prompts()
|
||||
self._load_feedback_words()
|
||||
self._load_feedback_historic()
|
||||
|
||||
def _load_config(self):
|
||||
"""Load configuration from environment file."""
|
||||
@@ -120,13 +124,13 @@ class JournalPromptGenerator:
|
||||
def _load_historic_prompts(self):
|
||||
"""Load historic prompts from JSON file."""
|
||||
try:
|
||||
with open("historic_prompts.json", "r") as f:
|
||||
with open("prompts_historic.json", "r") as f:
|
||||
self.historic_prompts = json.load(f)
|
||||
except FileNotFoundError:
|
||||
self.console.print("[yellow]Warning: historic_prompts.json not found, starting with empty history[/yellow]")
|
||||
self.console.print("[yellow]Warning: prompts_historic.json not found, starting with empty history[/yellow]")
|
||||
self.historic_prompts = []
|
||||
except json.JSONDecodeError:
|
||||
self.console.print("[yellow]Warning: historic_prompts.json is corrupted, starting with empty history[/yellow]")
|
||||
self.console.print("[yellow]Warning: prompts_historic.json is corrupted, starting with empty history[/yellow]")
|
||||
self.historic_prompts = []
|
||||
|
||||
def _save_historic_prompts(self):
|
||||
@@ -135,24 +139,62 @@ class JournalPromptGenerator:
|
||||
if len(self.historic_prompts) > 60:
|
||||
self.historic_prompts = self.historic_prompts[:60]
|
||||
|
||||
with open("historic_prompts.json", "w") as f:
|
||||
with open("prompts_historic.json", "w") as f:
|
||||
json.dump(self.historic_prompts, f, indent=2)
|
||||
|
||||
def _load_pool_prompts(self):
|
||||
"""Load pool prompts from JSON file."""
|
||||
try:
|
||||
with open("pool_prompts.json", "r") as f:
|
||||
with open("prompts_pool.json", "r") as f:
|
||||
self.pool_prompts = json.load(f)
|
||||
except FileNotFoundError:
|
||||
self.console.print("[yellow]Warning: pool_prompts.json not found, starting with empty pool[/yellow]")
|
||||
self.console.print("[yellow]Warning: prompts_pool.json not found, starting with empty pool[/yellow]")
|
||||
self.pool_prompts = []
|
||||
except json.JSONDecodeError:
|
||||
self.console.print("[yellow]Warning: pool_prompts.json is corrupted, starting with empty pool[/yellow]")
|
||||
self.console.print("[yellow]Warning: prompts_pool.json is corrupted, starting with empty pool[/yellow]")
|
||||
self.pool_prompts = []
|
||||
|
||||
def _load_feedback_words(self):
|
||||
"""Load feedback words from JSON file."""
|
||||
try:
|
||||
with open("feedback_words.json", "r") as f:
|
||||
self.feedback_words = json.load(f)
|
||||
except FileNotFoundError:
|
||||
self.console.print("[yellow]Warning: feedback_words.json not found, starting with empty feedback words[/yellow]")
|
||||
self.feedback_words = []
|
||||
except json.JSONDecodeError:
|
||||
self.console.print("[yellow]Warning: feedback_words.json is corrupted, starting with empty feedback words[/yellow]")
|
||||
self.feedback_words = []
|
||||
|
||||
def _load_feedback_historic(self):
|
||||
"""Load historic feedback words from JSON file."""
|
||||
try:
|
||||
with open("feedback_historic.json", "r") as f:
|
||||
self.feedback_historic = json.load(f)
|
||||
except FileNotFoundError:
|
||||
self.console.print("[yellow]Warning: feedback_historic.json not found, starting with empty feedback history[/yellow]")
|
||||
self.feedback_historic = []
|
||||
except json.JSONDecodeError:
|
||||
self.console.print("[yellow]Warning: feedback_historic.json is corrupted, starting with empty feedback history[/yellow]")
|
||||
self.feedback_historic = []
|
||||
|
||||
def _save_feedback_words(self):
|
||||
"""Save feedback words to JSON file."""
|
||||
with open("feedback_words.json", "w") as f:
|
||||
json.dump(self.feedback_words, f, indent=2)
|
||||
|
||||
def _save_feedback_historic(self):
|
||||
"""Save historic feedback words to JSON file (keeping only first 30)."""
|
||||
# Keep only the first 30 feedback words (newest are at the beginning)
|
||||
if len(self.feedback_historic) > 30:
|
||||
self.feedback_historic = self.feedback_historic[:30]
|
||||
|
||||
with open("feedback_historic.json", "w") as f:
|
||||
json.dump(self.feedback_historic, f, indent=2)
|
||||
|
||||
def _save_pool_prompts(self):
|
||||
"""Save pool prompts to JSON file."""
|
||||
with open("pool_prompts.json", "w") as f:
|
||||
with open("prompts_pool.json", "w") as f:
|
||||
json.dump(self.pool_prompts, f, indent=2)
|
||||
|
||||
def add_prompts_to_pool(self, prompts: List[str]):
|
||||
@@ -186,22 +228,6 @@ class JournalPromptGenerator:
|
||||
return drawn_prompts
|
||||
|
||||
|
||||
def show_pool_stats(self):
|
||||
"""Show statistics about the prompt pool."""
|
||||
total_prompts = len(self.pool_prompts)
|
||||
|
||||
table = Table(title="Prompt Pool Statistics")
|
||||
table.add_column("Metric", style="cyan")
|
||||
table.add_column("Value", style="green")
|
||||
|
||||
table.add_row("Prompts in pool", str(total_prompts))
|
||||
table.add_row("Prompts per session", str(self.settings['num_prompts']))
|
||||
table.add_row("Target pool size", str(self.settings['cached_pool_volume']))
|
||||
table.add_row("Available sessions", str(total_prompts // self.settings['num_prompts']))
|
||||
|
||||
self.console.print(table)
|
||||
|
||||
|
||||
def add_prompt_to_history(self, prompt_text: str):
|
||||
"""
|
||||
Add a single prompt to the historic prompts cyclic buffer.
|
||||
@@ -234,6 +260,53 @@ class JournalPromptGenerator:
|
||||
self.historic_prompts = updated_prompts
|
||||
self._save_historic_prompts()
|
||||
|
||||
def add_feedback_words_to_history(self):
|
||||
"""
|
||||
Add current feedback words to the historic feedback words cyclic buffer.
|
||||
The 6 new feedback words become feedback00-feedback05, all others shift down,
|
||||
and feedback29 is discarded (keeping only 30 items total).
|
||||
"""
|
||||
# Extract just the words from the current feedback words
|
||||
# Current feedback_words structure: [{"feedback00": "word", "weight": 3}, ...]
|
||||
new_feedback_words = []
|
||||
|
||||
for i, feedback_item in enumerate(self.feedback_words):
|
||||
# Get the word from the feedback item (key is feedback00, feedback01, etc.)
|
||||
feedback_key = f"feedback{i:02d}"
|
||||
if feedback_key in feedback_item:
|
||||
word = feedback_item[feedback_key]
|
||||
# Create new feedback word object with just the word (no weight)
|
||||
new_feedback_words.append({
|
||||
feedback_key: word
|
||||
})
|
||||
|
||||
# If we don't have 6 feedback words, we can't add them to history
|
||||
if len(new_feedback_words) != 6:
|
||||
self.console.print(f"[yellow]Warning: Expected 6 feedback words, got {len(new_feedback_words)}. Not adding to history.[/yellow]")
|
||||
return
|
||||
|
||||
# Shift all existing feedback words down by 6 positions
|
||||
# We'll create a new list starting with the 6 new feedback words
|
||||
updated_feedback_historic = new_feedback_words
|
||||
|
||||
# Add all existing feedback words, shifting their numbers down by 6
|
||||
for i, feedback_dict in enumerate(self.feedback_historic):
|
||||
if i >= 24: # We only keep 30 feedback words total (00-29), and we've already added 6
|
||||
break
|
||||
|
||||
# Get the feedback word
|
||||
feedback_key = list(feedback_dict.keys())[0]
|
||||
word = feedback_dict[feedback_key]
|
||||
|
||||
# Create feedback word with new number (shifted down by 6)
|
||||
new_feedback_key = f"feedback{i+6:02d}"
|
||||
updated_feedback_historic.append({
|
||||
new_feedback_key: word
|
||||
})
|
||||
|
||||
self.feedback_historic = updated_feedback_historic
|
||||
self._save_feedback_historic()
|
||||
self.console.print("[green]Added 6 feedback words to history[/green]")
|
||||
|
||||
def _parse_ai_response(self, response_content: str) -> List[str]:
|
||||
"""
|
||||
@@ -429,6 +502,11 @@ class JournalPromptGenerator:
|
||||
else:
|
||||
full_prompt = f"{template}\n\n{prompt_instruction}"
|
||||
|
||||
# Add feedback words if available
|
||||
if self.feedback_words:
|
||||
feedback_context = json.dumps(self.feedback_words, indent=2)
|
||||
full_prompt = f"{full_prompt}\n\nFeedback words:\n{feedback_context}"
|
||||
|
||||
return full_prompt
|
||||
|
||||
def _parse_ai_response_with_count(self, response_content: str, expected_count: int) -> List[str]:
|
||||
@@ -510,6 +588,162 @@ class JournalPromptGenerator:
|
||||
self.console.print("[red]Failed to generate prompts[/red]")
|
||||
return 0
|
||||
|
||||
def generate_theme_feedback_words(self) -> List[str]:
|
||||
"""Generate 6 theme feedback words using AI based on historic prompts."""
|
||||
self.console.print("\n[cyan]Generating theme feedback words based on historic prompts...[/cyan]")
|
||||
|
||||
# Load the feedback prompt template
|
||||
try:
|
||||
with open("ds_feedback.txt", "r") as f:
|
||||
feedback_template = f.read()
|
||||
except FileNotFoundError:
|
||||
self.console.print("[red]Error: ds_feedback.txt not found[/red]")
|
||||
return []
|
||||
|
||||
# Prepare the full prompt with historic context and feedback words
|
||||
if self.historic_prompts:
|
||||
historic_context = json.dumps(self.historic_prompts, indent=2)
|
||||
full_prompt = f"{feedback_template}\n\nPrevious prompts:\n{historic_context}"
|
||||
|
||||
# Add current feedback words if available (with weights)
|
||||
if self.feedback_words:
|
||||
feedback_context = json.dumps(self.feedback_words, indent=2)
|
||||
full_prompt = f"{full_prompt}\n\nCurrent feedback themes (with weights):\n{feedback_context}"
|
||||
|
||||
# Add historic feedback words if available (just words, no weights)
|
||||
if self.feedback_historic:
|
||||
feedback_historic_context = json.dumps(self.feedback_historic, indent=2)
|
||||
full_prompt = f"{full_prompt}\n\nHistoric feedback themes (just words):\n{feedback_historic_context}"
|
||||
else:
|
||||
self.console.print("[yellow]Warning: No historic prompts available for feedback analysis[/yellow]")
|
||||
return []
|
||||
|
||||
# Show progress
|
||||
with Progress(
|
||||
SpinnerColumn(),
|
||||
TextColumn("[progress.description]{task.description}"),
|
||||
transient=True,
|
||||
) as progress:
|
||||
task = progress.add_task("Calling AI API for theme analysis...", total=None)
|
||||
|
||||
try:
|
||||
# Call the AI API
|
||||
response = self.client.chat.completions.create(
|
||||
model=self.model,
|
||||
messages=[
|
||||
{"role": "system", "content": "You are a creative writing assistant that analyzes writing prompts. Always respond with valid JSON."},
|
||||
{"role": "user", "content": full_prompt}
|
||||
],
|
||||
temperature=0.7,
|
||||
max_tokens=1000
|
||||
)
|
||||
|
||||
response_content = response.choices[0].message.content
|
||||
|
||||
except Exception as e:
|
||||
self.console.print(f"[red]Error calling AI API: {e}[/red]")
|
||||
self.console.print(f"[yellow]Full prompt sent to API (first 500 chars):[/yellow]")
|
||||
self.console.print(f"[yellow]{full_prompt[:500]}...[/yellow]")
|
||||
return []
|
||||
|
||||
# Parse the response to get 6 theme words
|
||||
theme_words = self._parse_theme_words_response(response_content)
|
||||
|
||||
if not theme_words or len(theme_words) != 6:
|
||||
self.console.print(f"[red]Error: Expected 6 theme words, got {len(theme_words) if theme_words else 0}[/red]")
|
||||
return []
|
||||
|
||||
return theme_words
|
||||
|
||||
def _parse_theme_words_response(self, response_content: str) -> List[str]:
|
||||
"""
|
||||
Parse the AI response to extract 6 theme words.
|
||||
Expected format: JSON list of 6 lowercase words.
|
||||
"""
|
||||
# First, try to clean up the response content
|
||||
cleaned_content = self._clean_ai_response(response_content)
|
||||
|
||||
try:
|
||||
# Try to parse as JSON
|
||||
data = json.loads(cleaned_content)
|
||||
|
||||
# Check if data is a list
|
||||
if isinstance(data, list):
|
||||
# Ensure all items are strings and lowercase them
|
||||
theme_words = []
|
||||
for word in data:
|
||||
if isinstance(word, str):
|
||||
theme_words.append(word.lower().strip())
|
||||
else:
|
||||
theme_words.append(str(word).lower().strip())
|
||||
|
||||
return theme_words
|
||||
else:
|
||||
self.console.print(f"[yellow]Warning: AI returned unexpected data type: {type(data)}[/yellow]")
|
||||
return []
|
||||
|
||||
except json.JSONDecodeError:
|
||||
# If not valid JSON, try to extract words from text
|
||||
self.console.print("[yellow]Warning: AI response is not valid JSON, attempting to extract theme words...[/yellow]")
|
||||
|
||||
# Look for patterns in the text
|
||||
lines = response_content.strip().split('\n')
|
||||
theme_words = []
|
||||
|
||||
for line in lines:
|
||||
line = line.strip()
|
||||
if line and len(line) < 50: # Theme words should be short
|
||||
# Try to extract words (lowercase, no punctuation)
|
||||
words = [w.lower().strip('.,;:!?()[]{}"\'') for w in line.split()]
|
||||
theme_words.extend(words)
|
||||
|
||||
if len(theme_words) >= 6:
|
||||
break
|
||||
|
||||
return theme_words[:6]
|
||||
|
||||
def collect_feedback_ratings(self, theme_words: List[str]) -> List[Dict[str, Any]]:
|
||||
"""Collect user ratings (0-6) for each theme word and return structured feedback."""
|
||||
self.console.print("\n[bold]Please rate each theme word from 0 to 6:[/bold]")
|
||||
self.console.print("[dim]0 = Not relevant, 6 = Very relevant[/dim]\n")
|
||||
|
||||
feedback_items = []
|
||||
|
||||
for i, word in enumerate(theme_words):
|
||||
while True:
|
||||
try:
|
||||
rating = Prompt.ask(
|
||||
f"[bold]Word {i+1}: {word}[/bold]",
|
||||
choices=[str(x) for x in range(0, 7)], # 0-6 inclusive
|
||||
default="3"
|
||||
)
|
||||
rating_int = int(rating)
|
||||
|
||||
if 0 <= rating_int <= 6:
|
||||
# Create feedback item with key (feedback00, feedback01, etc.)
|
||||
feedback_key = f"feedback{i:02d}"
|
||||
feedback_items.append({
|
||||
feedback_key: word,
|
||||
"weight": rating_int
|
||||
})
|
||||
break
|
||||
else:
|
||||
self.console.print("[yellow]Please enter a number between 0 and 6[/yellow]")
|
||||
except ValueError:
|
||||
self.console.print("[yellow]Please enter a valid number[/yellow]")
|
||||
|
||||
return feedback_items
|
||||
|
||||
def update_feedback_words(self, new_feedback_items: List[Dict[str, Any]]):
|
||||
"""Update feedback words with new ratings."""
|
||||
# Replace existing feedback words with new ones
|
||||
self.feedback_words = new_feedback_items
|
||||
self._save_feedback_words()
|
||||
self.console.print(f"[green]Updated feedback words with {len(new_feedback_items)} items[/green]")
|
||||
|
||||
# Also add the new feedback words to the historic buffer
|
||||
self.add_feedback_words_to_history()
|
||||
|
||||
def display_prompts(self, prompts: List[str]):
|
||||
"""Display generated prompts in a nice format."""
|
||||
self.console.print("\n" + "="*60)
|
||||
@@ -527,19 +761,33 @@ class JournalPromptGenerator:
|
||||
self.console.print(panel)
|
||||
self.console.print() # Empty line between prompts
|
||||
|
||||
def show_history_stats(self):
|
||||
"""Show statistics about prompt history."""
|
||||
total_prompts = len(self.historic_prompts)
|
||||
def show_combined_stats(self):
|
||||
"""Show combined statistics about both prompt pool and history."""
|
||||
# Pool statistics
|
||||
total_pool_prompts = len(self.pool_prompts)
|
||||
pool_table = Table(title="Prompt Pool Statistics")
|
||||
pool_table.add_column("Metric", style="cyan")
|
||||
pool_table.add_column("Value", style="green")
|
||||
|
||||
table = Table(title="Prompt History Statistics")
|
||||
table.add_column("Metric", style="cyan")
|
||||
table.add_column("Value", style="green")
|
||||
pool_table.add_row("Prompts in pool", str(total_pool_prompts))
|
||||
pool_table.add_row("Prompts per session", str(self.settings['num_prompts']))
|
||||
pool_table.add_row("Target pool size", str(self.settings['cached_pool_volume']))
|
||||
pool_table.add_row("Available sessions", str(total_pool_prompts // self.settings['num_prompts']))
|
||||
|
||||
table.add_row("Total prompts in history", str(total_prompts))
|
||||
table.add_row("History capacity", "60 prompts")
|
||||
table.add_row("Available slots", str(max(0, 60 - total_prompts)))
|
||||
# History statistics
|
||||
total_history_prompts = len(self.historic_prompts)
|
||||
history_table = Table(title="Prompt History Statistics")
|
||||
history_table.add_column("Metric", style="cyan")
|
||||
history_table.add_column("Value", style="green")
|
||||
|
||||
self.console.print(table)
|
||||
history_table.add_row("Total prompts in history", str(total_history_prompts))
|
||||
history_table.add_row("History capacity", "60 prompts")
|
||||
history_table.add_row("Available slots", str(max(0, 60 - total_history_prompts)))
|
||||
|
||||
# Display both tables
|
||||
self.console.print(pool_table)
|
||||
self.console.print() # Empty line between tables
|
||||
self.console.print(history_table)
|
||||
|
||||
def interactive_mode(self):
|
||||
"""Run in interactive mode with user prompts."""
|
||||
@@ -565,8 +813,8 @@ class JournalPromptGenerator:
|
||||
self.console.print("\n[bold]Options:[/bold]")
|
||||
self.console.print("1. Draw prompts from pool (no API call)")
|
||||
self.console.print("2. Fill prompt pool using API")
|
||||
self.console.print("3. View pool statistics")
|
||||
self.console.print("4. View history statistics")
|
||||
self.console.print("3. View combined statistics")
|
||||
self.console.print("4. Generate and rate theme feedback words")
|
||||
self.console.print("5. Exit")
|
||||
|
||||
choice = Prompt.ask("\nEnter your choice", choices=["1", "2", "3", "4", "5"], default="1")
|
||||
@@ -600,10 +848,16 @@ class JournalPromptGenerator:
|
||||
self.console.print("[yellow]No prompts were added to pool[/yellow]")
|
||||
|
||||
elif choice == "3":
|
||||
self.show_pool_stats()
|
||||
self.show_combined_stats()
|
||||
|
||||
elif choice == "4":
|
||||
self.show_history_stats()
|
||||
# Generate and rate theme feedback words
|
||||
theme_words = self.generate_theme_feedback_words()
|
||||
if theme_words:
|
||||
feedback_items = self.collect_feedback_ratings(theme_words)
|
||||
self.update_feedback_words(feedback_items)
|
||||
else:
|
||||
self.console.print("[yellow]No theme words were generated[/yellow]")
|
||||
|
||||
elif choice == "5":
|
||||
self.console.print("[green]Goodbye! Happy journaling! 📓[/green]")
|
||||
@@ -626,12 +880,7 @@ def main():
|
||||
parser.add_argument(
|
||||
"--stats", "-s",
|
||||
action="store_true",
|
||||
help="Show history statistics"
|
||||
)
|
||||
parser.add_argument(
|
||||
"--pool-stats", "-p",
|
||||
action="store_true",
|
||||
help="Show pool statistics"
|
||||
help="Show combined statistics (pool and history)"
|
||||
)
|
||||
parser.add_argument(
|
||||
"--fill-pool", "-f",
|
||||
@@ -645,9 +894,7 @@ def main():
|
||||
generator = JournalPromptGenerator(config_path=args.config)
|
||||
|
||||
if args.stats:
|
||||
generator.show_history_stats()
|
||||
elif args.pool_stats:
|
||||
generator.show_pool_stats()
|
||||
generator.show_combined_stats()
|
||||
elif args.fill_pool:
|
||||
# Fill prompt pool to target volume using API
|
||||
total_added = generator.fill_pool_to_target()
|
||||
|
||||
@@ -1,182 +0,0 @@
|
||||
[
|
||||
{
|
||||
"prompt00": "Choose a street you walk down often. Today, walk it with the mission of noticing five things you've never seen before. They can be tiny: a crack in the pavement shaped like a continent, a particular stain on a wall, a hidden doorbell. Document each discovery in detail. Then, reflect on the phenomenon of selective attention. What had you been filtering out, and why? How does this exercise change your sense of the familiar path?"
|
||||
},
|
||||
{
|
||||
"prompt01": "Imagine you could host a dinner party for three fictional characters from different books, films, or myths. Who would you invite and why? Don't just list them. Set the scene: the table setting, the menu, the lighting. Write the conversation that unfolds. What would they argue about? What surprising common ground might they find? How would their presence challenge or affirm your own worldview? Let the dialogue reveal their core natures."
|
||||
},
|
||||
{
|
||||
"prompt02": "Describe a taste you loved as a child but have since grown indifferent to or now dislike. Recreate the sensory memory of that taste with precision. What was its context? Who was with you? Now, analyze the shift. Did your palate change, or did the associations sour? Is there a way to reclaim the innocent pleasure of that taste, or is its loss a necessary marker of growing up? Explore the nostalgia and slight grief in outgrowing a flavor."
|
||||
},
|
||||
{
|
||||
"prompt03": "Contemplate the concept of 'waste' in your daily life. Choose one item destined for the trash or recycling. Trace its journey backwards from your hand to its origins as raw material. Then, project its journey forward after it leaves your custody. What systems does it touch? What hands might process it? Write a biography of this discarded object, granting it dignity and narrative. How does this perspective alter your sense of responsibility and connection?"
|
||||
},
|
||||
{
|
||||
"prompt04": "Invent a small, personal ritual you could perform to mark the transition from one part of your day to another (e.g., work to home, waking to activity). Describe each step with deliberate, sensory care. What object is involved? What words, if any, are said? How does your posture change? The goal isn't superstition, but mindfulness. Write about performing this ritual for a week. What subtle shifts in your awareness might it create? How does deliberately carving out a threshold affect your experience of time?"
|
||||
},
|
||||
{
|
||||
"prompt05": "Consider a piece of music that feels like a physical space to you\u2014a song you can walk into. Describe the architecture of this auditory landscape. What is the floor made of? How high is the ceiling? What color is the light? Where are the shadows? What happens to your body and breath as you move through its sections\u2014the verses, the chorus, the bridge? Is it a place of refuge, confrontation, or memory? Explore how sound can build an environment you inhabit, not just hear."
|
||||
},
|
||||
{
|
||||
"prompt06": "Describe your ideal sanctuary\u2014not a grand fantasy, but a realistically attainable space you could create. Detail its location, size, lighting, furnishings, and most importantly, its rules (e.g., 'no devices,' 'only music without words,' 'must contain something living'). What specific activities would you do there? What state of mind does this space architecturally encourage? How would visiting it regularly change the rhythm of your weeks?"
|
||||
},
|
||||
{
|
||||
"prompt07": "Describe a skill or piece of knowledge you possess that you learned in an unconventional, self-taught, or accidental way. Detail the messy, non-linear process of that learning. Who or what were your unlikely teachers? Celebrate the inefficiency and personal quirks of your method. How does this 'uncurated' knowledge differ in feel and application from something you were formally taught?"
|
||||
},
|
||||
{
|
||||
"prompt08": "Think of a skill or piece of knowledge you possess that feels almost instinctual, something you can do without conscious thought (like riding a bike, typing, or a native language's grammar). Deconstruct this automatic competence. Describe the first clumsy attempts to learn it, the plateau of frustration, the moment it 'clicked' into muscle memory. Explore the duality of this knowledge: how it is both a part of you and a separate tool. What does this ingrained ability allow you to forget, and what freedom does that forgetfulness grant?"
|
||||
},
|
||||
{
|
||||
"prompt09": "Choose a natural element you feel a kinship with\u2014fire, stone, water, wind, or earth. Personify it deeply: give it desires, memories, a voice. Write a monologue from its perspective about its ancient, slow existence and its observations of human brevity and frenzy. Then, write about a moment in your life when you felt most aligned with this element's essence. How does connecting with this primal force alter your sense of time and scale?"
|
||||
},
|
||||
{
|
||||
"prompt10": "Imagine you could preserve one hour from your recent memory in a vial, to be re-experienced fully at a future date. Which hour would you choose? Describe it not just as events, but as a full sensory immersion: the light, the sounds, the emotional texture, the quality of the air. Why is this particular slice of time worth encapsulating? What fears or hopes do you have about opening that vial years from now? Write about the desire to hold onto a fleeting feeling, and the wisdom or melancholy that might come from revisiting it."
|
||||
},
|
||||
{
|
||||
"prompt11": "Contemplate the concept of 'enough.' In our culture of more, what does sufficiency feel like in your body and mind? Describe a recent moment when you felt truly, deeply 'enough'\u2014not in lack, not in excess. It could be related to time, accomplishment, possessions, or love. What were the conditions? How did it settle in your posture or breath? Then, contrast this with a sphere of your life where the feeling of 'not enough' persistently hums. Explore the tension between these two states. What would it take to cultivate more of the former?"
|
||||
},
|
||||
{
|
||||
"prompt12": "Recall a piece of bad advice you once received and followed. Who gave it and why did you trust them? Walk through the consequences, large or small. Now, reframe that experience not as a mistake, but as a necessary detour. What did you learn about yourself, about advice, or about the gap between theory and practice that you couldn't have learned any other way? Write the thank-you note you would send to that advisor today, acknowledging the unexpected gift of their misguidance."
|
||||
},
|
||||
{
|
||||
"prompt13": "You are tasked with composing a guided audio meditation for a stranger experiencing intense anxiety. Write the script. Use your voice to lead them through a physical space\u2014a forest path, a quiet beach, a cozy room. Describe not just visuals, but textures, sounds, temperatures, and the rhythm of breathing. What reassurance would you offer without being trite? What simple, grounding observations would you point out? Craft a verbal sanctuary meant to hold someone's fragile attention."
|
||||
},
|
||||
{
|
||||
"prompt14": "Recall a piece of clothing you once owned and loved, but have since lost, given away, or worn out. Recreate it stitch by stitch in words\u2014its fabric, its fit, its smell, the way it moved with you. Narrate its life with you: the occasions it witnessed, the stains it earned, the comfort it provided. What did wearing it allow you to feel or project? Write an ode to this second skin, and explore what its absence represents."
|
||||
},
|
||||
{
|
||||
"prompt15": "Test prompt"
|
||||
},
|
||||
{
|
||||
"prompt16": "Observe the sky right now, in this exact moment. Describe its color, cloud formations, light quality, and movement with meticulous attention. Then, let this observation launch you into a reflection on scale and perspective. Consider the atmospheric phenomena occurring beyond your sight\u2014jet streams, weather systems, celestial motions. How does contemplating the vast, impersonal sky make you feel about your current concerns, joys, or plans? Write about the tension between the immediacy of your personal world and the silent, ongoing spectacle above."
|
||||
},
|
||||
{
|
||||
"prompt17": "Choose a machine or appliance in your home that has a distinct sound\u2014a refrigerator hum, a heater's click, a fan's whir. Close your eyes and listen to it for a full minute. Describe its rhythm, pitch, and constancy. Now, personify this sound. What is its personality? Is it a loyal guardian, a complaining old friend, a distant observer? Write a monologue from its perspective about the life it monitors within these walls. What has it learned about you from its unchanging post?"
|
||||
},
|
||||
{
|
||||
"prompt18": "Recall a public space you frequented often in the past but have not visited in years (a library, a park, a diner, a store). Reconstruct it from memory in vivid detail. Then, imagine returning to it today. Describe the inevitable changes\u2014the renovations, the new faces, the faded paint. But also, hunt for the one thing that remains exactly, miraculously the same. How does the coexistence of change and permanence in this space make you feel about the passage of your own time?"
|
||||
},
|
||||
{
|
||||
"prompt19": "\"newprompt3\": \"Recall a teacher, mentor, or elder who said something to you in passing that you have never forgotten. It might have been a compliment, a criticism, or an offhand observation. Reconstruct the scene. Why did their words carry such weight? How have you turned them over in your mind since? Explore the power of brief, seemingly casual utterances to shape a person's self-concept.\","
|
||||
},
|
||||
{
|
||||
"prompt20": "\"newprompt0\": \"Write a detailed portrait of a tree you know well\u2014not just its appearance, but its history in that spot, the way its branches move in different winds, the creatures that inhabit it, the shadows it casts at various hours. Imagine its perspective across seasons and years. What has it witnessed? What would it say about change, resilience, or stillness if it could speak? Let the tree become a mirror for your own sense of place and time.\","
|
||||
},
|
||||
{
|
||||
"prompt21": "Describe a memory you have that is tied to a specific smell. Don't just tell the story of the event; focus on describing the scent itself in as much detail as possible\u2014its texture, its weight in the air, its nuances. How does conjuring that smell now make you feel in your body? Let the description of the aroma lead you back into the memory's landscape."
|
||||
},
|
||||
{
|
||||
"prompt22": "Write a letter to your 15-year-old self. Be kind, be blunt, be humorous, or be stern. What do you know now that you desperately needed to hear then? What mystery about your future life could you tantalizingly hint at without giving it all away? Don't just give advice; try to capture the voice and tone you wish an older, wiser person had used with you."
|
||||
},
|
||||
{
|
||||
"prompt23": "You find a forgotten door in a place you know well\u2014your home, your workplace, your daily park. It wasn't there yesterday. You open it. Describe what is on the other side using only sensory details: sight, sound, temperature, smell. Do not explain its purpose or origin. Simply document the experience of crossing that threshold."
|
||||
},
|
||||
{
|
||||
"prompt24": "Make a list of ten tiny, perfect moments from the past month that no one else probably noticed or would remember. The way light fell on a spoon, a stranger's half-smile, the sound of rain stopping. Elaborate on at least three of them, expanding them into full vignettes. Why did these micro-moments stick with you?"
|
||||
},
|
||||
{
|
||||
"prompt25": "Invent a mythological creature for a modern urban setting. What does it look like? What is its behavior and habitat (e.g., subway tunnels, server farms, air vents)? What folklore do people whisper about it? What does it symbolize\u2014anxiety, forgotten connections, hope? Describe a recent 'sighting' of this creature in vivid detail."
|
||||
},
|
||||
{
|
||||
"prompt26": "Choose an object in your immediate line of sight that is not electronic. Write its biography. Where was it made? Who owned it before you? What conversations has it overheard? What secrets does it hold? What small damages or wear marks does it have, and what story does each tell? Give this ordinary item an epic history."
|
||||
},
|
||||
{
|
||||
"prompt27": "Describe your current emotional state as a weather system. Is it a still, high-pressure fog? A sudden, sharp hailstorm? A lingering, humid drizzle? Map its boundaries, its intensity, its forecast. What terrain does it move over\u2014the mountains of your responsibilities, the plains of your routine? How does it affect your internal climate?"
|
||||
},
|
||||
{
|
||||
"prompt28": "Recall a time you were deeply embarrassed. Write about it from the perspective of a sympathetic observer who was there\u2014or invent one. How might they have perceived the event? What context or kindness might they have seen that you, in your self-focused shame, completely missed? Reframe the memory through their eyes."
|
||||
},
|
||||
{
|
||||
"prompt29": "What skill or craft have you always wanted to learn but haven't? Immerse yourself in a detailed fantasy of mastering it. Describe the feel of the tools in your hands, the initial frustrations, the first small success, the growing muscle memory. What does the final, perfected product of your labor look or feel like? Live in that imagined\u6210\u5c31\u611f."
|
||||
},
|
||||
{
|
||||
"prompt30": "Write a dialogue between two aspects of yourself (e.g., Your Ambitious Self and Your Tired Self; Your Cynical Self and Your Hopeful Self). Give them distinct voices. What are they arguing about, negotiating, or planning? Don't just state positions; let them bicker, persuade, or sit in silence together. See where the conversation goes."
|
||||
},
|
||||
{
|
||||
"prompt31": "Describe your childhood home from the perspective of a small animal (a mouse, a squirrel, a bird) that lived there concurrently with you. What did this creature notice about your family's rhythms, the layout, the dangers, and the treasures (crumbs, cozy materials)? How did it perceive you, the giant human child?"
|
||||
},
|
||||
{
|
||||
"prompt32": "List five paths your life could have taken if you'd made one different choice. Briefly outline each alternate reality. Then, choose one and dive deep: write a journal entry from that version of you today. What are their worries, joys, and regrets? How is their voice similar to or different from your own?"
|
||||
},
|
||||
{
|
||||
"prompt33": "Think of a person you see regularly but do not know (a barista, a neighbor, a commuter). Invent a rich, secret inner life for them. What profound private mission are they on? What hidden talent do they possess? What great sorrow or hope are they carrying today as they serve your coffee or stand on the platform? Write from their perspective."
|
||||
},
|
||||
{
|
||||
"prompt34": "What is a belief you held strongly five or ten years ago that you have since questioned or abandoned? Trace the evolution of that change. Was it a sudden shattering or a slow erosion? What person, experience, or piece of information was the catalyst? Describe the feeling of the ground shifting under that particular piece of your worldview."
|
||||
},
|
||||
{
|
||||
"prompt35": "Describe a common, mundane process (making tea, tying your shoes, doing laundry) in extreme, almost absurdly epic detail, as if you were writing a sacred manual or a scientific treatise for an alien civilization. Break down every micro-action, every sensation, every potential variable. Find the profound in the procedural."
|
||||
},
|
||||
{
|
||||
"prompt36": "You are given a suitcase and told you must leave your home in one hour, not knowing if or when you'll return. You can only take what fits in the case. Describe, in real-time, the frantic and deliberate process of choosing. What practical items make the cut? What irreplaceable tokens? What do you leave behind, and what does that feel like?"
|
||||
},
|
||||
{
|
||||
"prompt37": "Write about water in three different forms: as a memory involving a body of water (ocean, river, bath), as a description of drinking a glass of water right now, and as a metaphor for an emotion. Move seamlessly between these three aspects. Let the fluidity of the theme connect them."
|
||||
},
|
||||
{
|
||||
"prompt38": "What does silence sound like in your current environment? Don't just say 'quiet.' Describe the layers of sound that actually constitute the silence\u2014the hums, ticks, distant rumbles, the sound of your own body. Now, project what this same space sounded like 100 years ago, and what it might sound like 100 years from now."
|
||||
},
|
||||
{
|
||||
"prompt39": "Create a recipe for a dish that represents your current life phase. List ingredients (e.g., \"two cups of transition,\" \"a pinch of anxiety,\" \"a steady base of routine\"). Write the instructions, including the method, cooking time, and necessary equipment. Describe the final product's taste, texture, and who it should be shared with."
|
||||
},
|
||||
{
|
||||
"prompt40": "Recall a dream from the past week, however fragmentary. Don't interpret it. Instead, expand it. Continue the narrative from where it left off. Describe the dream logic, the landscape, the characters. Let it become a story. Where does your dreaming mind take you when given free rein on the page?"
|
||||
},
|
||||
{
|
||||
"prompt41": "Make a list of everything that is blue in your immediate environment. Describe each shade specifically (slate, cobalt, robin's egg, faded denim). Then, choose one blue object and write about its journey to being here, in this blue state, in front of you. How did it get its color? What has it reflected?"
|
||||
},
|
||||
{
|
||||
"prompt42": "Write a eulogy for something you've lost that isn't a person\u2014a habit, a version of a city, a relationship dynamic, a part of your identity. Acknowledge its virtues and its flaws. Say goodbye properly, with humor, regret, and gratitude. What did it give you? What space has its departure created?"
|
||||
},
|
||||
{
|
||||
"prompt43": "Describe your hands. Not just their appearance, but their capabilities, their scars, their memories. What have they held, built, comforted, or torn down? What do their specific aches and strengths tell you about the life you've lived so far? If your hands could speak, what would they say they want to do next?"
|
||||
},
|
||||
{
|
||||
"prompt44": "Imagine you can overhear the conversation of the people at the table next to you in a caf\u00e9, but they are speaking in a language you don't understand. Based on their tone, gestures, pauses, and expressions, invent the dialogue. What crucial, funny, or tragic misunderstanding are they having? What are they *really* talking about?"
|
||||
},
|
||||
{
|
||||
"prompt45": "What is a piece of art (a song, painting, film, book) that fundamentally moved you? Describe the first time you encountered it. Don't just analyze why it's good; describe the physical and emotional reaction it provoked. Has its meaning changed for you over time? How does it live inside you now?"
|
||||
},
|
||||
{
|
||||
"prompt46": "You have one day completely alone, with no obligations and no possibility of communication. The power and internet are out. How do you spend the hours from waking to sleeping? Detail the rituals, the wanderings, the thoughts, the meals. Do you enjoy the solitude or chafe against it? What arises in the quiet?"
|
||||
},
|
||||
{
|
||||
"prompt47": "Personify a negative emotion you've been feeling lately (e.g., anxiety, envy, restlessness). Give it a name, a form, a voice. Write a character profile of it. What does it want? What does it fear? What flawed logic does it operate under? Then, write a short scene of you having a cup of tea with it, listening to its perspective."
|
||||
},
|
||||
{
|
||||
"prompt48": "Describe a city you've never been to, based solely on the stories, images, and snippets you've absorbed about it. Build it from imagination and second-hand clues. Then, contrast that with a description of your own street, seen with the hyper-attentive eyes of a first-time visitor. Make the familiar alien, and the alien familiar."
|
||||
},
|
||||
{
|
||||
"prompt49": "Think of a crossroads in your past. Now, imagine you see a ghost of your former self standing there, frozen in that moment of decision. What would you want to say to that ghost? Would you offer comfort, a warning, or just silent companionship? Write the encounter. Does the ghost speak back?"
|
||||
},
|
||||
{
|
||||
"prompt50": "What is a tradition in your family or community\u2014big or small\u2014that you find meaningful? Describe its sensory details, its rhythms, its players. Now, trace its origin. How did it start? Has it mutated over time? What does its continued practice say about what your family values, fears, or hopes for?"
|
||||
},
|
||||
{
|
||||
"prompt51": "Choose a year from your past. Catalog the soundtrack of that year: songs on the radio, albums you loved, jingles, background music. For each, describe a specific memory or feeling it evokes. How does the music of that time period color your memory of the entire era? What does it sound like to you now?"
|
||||
},
|
||||
{
|
||||
"prompt52": "Write instructions for a stranger on how to be you for a day. Include the essential routines, the internal dialogues to expect, the things to avoid, the small comforts to lean on, and the passwords to your various anxieties. Be brutally honest and surprisingly practical. What would they find hardest to mimic?"
|
||||
},
|
||||
{
|
||||
"prompt53": "Describe a moment of unexpected kindness, either given or received. Don't frame it as a grand gesture. Focus on a small, almost invisible act. What were the circumstances? Why was it so potent? How did it ripple out, changing the temperature of your day or your perception of someone?"
|
||||
},
|
||||
{
|
||||
"prompt54": "You discover you have a superpower, but it is frustratingly mundane and specific (e.g., the ability to always know exactly what time it is without a clock, to perfectly fold fitted sheets, to find lost buttons). Explore the practical uses, the minor heroics, the unexpected downsides, and the peculiar loneliness of this unique gift."
|
||||
},
|
||||
{
|
||||
"prompt55": "Go to a window. Describe the view in extreme detail, as if painting it with words, for five minutes. Then, close your eyes and describe the view from a window that was significant to you in the past (your childhood bedroom, a previous office, a grandparent's house). Juxtapose the two landscapes on the page."
|
||||
},
|
||||
{
|
||||
"prompt56": "What is a question you are tired of being asked? Write a rant about why it's so irritating, reductive, or painful. Then, flip it: write the question you wish people would ask you instead. Answer that new question fully and generously."
|
||||
},
|
||||
{
|
||||
"prompt57": "Describe a hobby or interest you have from the perspective of someone who finds it utterly baffling and boring. Then, defend it with the passionate zeal of a true devotee. Try to convey its magic and depth to this imagined skeptic. What is the core beauty you see that they miss?"
|
||||
},
|
||||
{
|
||||
"prompt58": "List ten things you would do if you were not afraid. They can be grand (quit my job) or small (sing karaoke). Choose one and vividly imagine doing it. Walk through every step, from decision to action to aftermath. How does the air feel different on the other side of that fear?"
|
||||
},
|
||||
{
|
||||
"prompt59": "Write about a time you got exactly what you wanted\u2014and it was not what you expected. Describe the desire, the anticipation, the moment of attainment, and the subtle (or not-so-subtle) disappointment or confusion that followed. What did that experience teach you about wanting?"
|
||||
}
|
||||
]
|
||||
@@ -1,3 +0,0 @@
|
||||
[
|
||||
"What is something you've been putting off and why?"
|
||||
]
|
||||
182
prompts_historic.json
Normal file
182
prompts_historic.json
Normal file
@@ -0,0 +1,182 @@
|
||||
[
|
||||
{
|
||||
"prompt00": "Choose a common phrase you use often (e.g., \"I'm fine,\" \"Just a minute,\" \"Don't worry about it\"). Dissect it. What does it truly mean when you say it? What does it conceal? What convenience does it provide? Now, for one day, vow not to use it. Chronicle the conversations that become longer, more awkward, or more honest as a result."
|
||||
},
|
||||
{
|
||||
"prompt01": "Recall a time you received a gift that was perfectly, inexplicably right for you. Describe the gift and the giver. What made it so resonant? Was it an understanding of a secret wish, a reflection of an unseen part of you, or a tool you didn't know you needed? Explore the magic of being seen and understood through the medium of an object."
|
||||
},
|
||||
{
|
||||
"prompt02": "Map a friendship as a shared garden. What did each of you plant in the initial soil? What has grown wild? What requires regular tending? Have there been seasons of drought or frost? Are there any beautiful, stubborn weeds? Write a gardener's diary entry about the current state of this plot, reflecting on its history and future."
|
||||
},
|
||||
{
|
||||
"prompt03": "Describe a skill you have that is entirely non-verbal\u2014perhaps riding a bike, kneading dough, tuning an instrument by ear. Attempt to write a manual for this skill using only metaphors and physical sensations. Avoid technical terms. Can you translate embodied knowledge into prose? What is lost, and what is poetically gained?"
|
||||
},
|
||||
{
|
||||
"prompt04": "Recall a scent that acts as a master key, unlocking a flood of specific, detailed memories. Describe the scent in non-scent words: is it sharp, round, velvety, brittle? Now, follow the key into the memory palace it opens. Don't just describe the memory; describe the architecture of the connection itself. How is scent wired so directly to the past?"
|
||||
},
|
||||
{
|
||||
"prompt05": "Imagine you are a translator for a species that communicates through subtle shifts in temperature. Describe a recent emotional experience as a thermal map. Where in your body did the warmth of joy concentrate? Where did the cold front of anxiety settle? How would you translate this silent, somatic language into words for someone who only understands degrees and gradients?"
|
||||
},
|
||||
{
|
||||
"prompt06": "Find a surface covered in a fine layer of dust\u2014a windowsill, an old book, a forgotten picture frame. Describe this 'residue' of time and neglect. What stories does the pattern of settlement tell? Write about the act of wiping it away. Is it an erasure of history or a renewal? What clean surface is revealed, and does it feel like a loss or a gain?"
|
||||
},
|
||||
{
|
||||
"prompt07": "Build a 'gossamer' bridge in your mind between two seemingly disconnected concepts: for example, baking bread and forgiveness, or traffic patterns and anxiety. Describe the fragile, translucent strands of logic or metaphor you use to connect them. Walk across this bridge. What new landscape do you find on the other side? Does the bridge hold, or dissolve after use?"
|
||||
},
|
||||
{
|
||||
"prompt08": "Map a personal 'labyrinth' of procrastination or avoidance. What are its enticing entryways (\"I'll just check...\")? Its circular corridors of rationalization? Its terrifying center (the task itself)? Describe one recent journey into this maze. What finally provided the thread to lead you out, or what made you decide to sit in the center and confront the Minotaur?"
|
||||
},
|
||||
{
|
||||
"prompt09": "Craft a mental 'effigy' of a piece of advice you were given that you've chosen to ignore. Give it form and substance. Do you keep it on a shelf, bury it, or ritually dismantle it? Write about the act of holding this representation of rejected wisdom. Does making it concrete help you understand your refusal, or simply honor the intention of the giver?"
|
||||
},
|
||||
{
|
||||
"prompt10": "Recall a decision point that felt like standing at the mouth of a 'labyrinth,' with multiple winding paths ahead. Describe the initial confusion and the method you used to choose an entrance (logic, intuition, chance). Now, with hindsight, map the path you actually took. Were there dead ends or unexpected centers? Did the labyrinth lead you out, or deeper into understanding?"
|
||||
},
|
||||
{
|
||||
"prompt11": "Contemplate a 'quasar'\u2014an immensely luminous, distant celestial object. Use it as a metaphor for a source of guidance or inspiration in your life that feels both incredibly powerful and remote. Who or what is this distant beacon? Describe the 'light' it emits and the long journey it takes to reach you. How do you navigate by this ancient, brilliant, but fundamentally untouchable signal?"
|
||||
},
|
||||
{
|
||||
"prompt12": "Describe a piece of music that left a 'residue' in your mind\u2014a melody that loops unbidden, a lyric that sticks, a rhythm that syncs with your heartbeat. How does this auditory artifact resurface during quiet moments? What emotional or memory-laden dust has it collected? Write about the process of this mental replay, and whether you seek to amplify it or gently brush it away."
|
||||
},
|
||||
{
|
||||
"prompt13": "Recall a 'failed' experiment from your past\u2014a recipe that flopped, a project abandoned, a relationship that didn't work. Instead of framing it as a mistake, analyze it as a valuable trial that produced data. What did you learn about the materials, the process, or yourself? How did the outcome diverge from your hypothesis? Write a lab report for this experiment, focusing on the insights gained rather than the desired product. How does this reframe 'failure'?"
|
||||
},
|
||||
{
|
||||
"prompt14": "Chronicle the life cycle of a rumor or piece of gossip that reached you. Where did you first hear it? How did it mutate as it passed to you? What was your role\u2014conduit, amplifier, skeptic, terminator? Analyze the social algorithm that governs such information transfer. What need did this rumor feed in its listeners? Write about the velocity and distortion of unverified stories through a community."
|
||||
},
|
||||
{
|
||||
"prompt15": "Recall a time you had to translate\u2014not between languages, but between contexts: explaining a job to family, describing an emotion to someone who doesn't share it, making a technical concept accessible. Describe the words that failed you and the metaphors you crafted to bridge the gap. What was lost in translation? What was surprisingly clarified? Explore the act of building temporary, fragile bridges of understanding between internal and external worlds."
|
||||
},
|
||||
{
|
||||
"prompt16": "You discover a forgotten corner of a digital space you own\u2014an old blog draft, a buried folder of photos, an abandoned social media profile. Explore this digital artifact as an archaeologist would a physical site. What does the layout, the language, the imagery tell you about a past self? Reconstruct the mindset of the person who created it. How does this digital echo compare to your current identity? Is it a charming relic or an unsettling ghost?"
|
||||
},
|
||||
{
|
||||
"prompt17": "You are tasked with archiving a sound that is becoming obsolete\u2014the click of a rotary phone, the chirp of a specific bird whose habitat is shrinking, the particular hum of an old appliance. Record a detailed description of this sound as if for a future museum. What are its frequencies, its rhythms, its emotional connotations? Now, imagine the silence that will exist in its place. What other, newer sounds will fill that auditory niche? Write an elegy for a vanishing sonic fingerprint."
|
||||
},
|
||||
{
|
||||
"prompt18": "Craft a mental effigy of a habit, fear, or desire you wish to understand better. Describe this symbolic representation in detail\u2014its materials, its posture, its expression. Now, perform a symbolic action upon it: you might place it in a drawer, bury it in the garden of your mind, or set it adrift on an imaginary river. Chronicle this ritual. Does the act of creating and addressing the effigy change your relationship to the thing it represents, or does it merely make its presence more tangible?"
|
||||
},
|
||||
{
|
||||
"prompt19": "Describe a labyrinth you have constructed in your own mind\u2014not a physical maze, but a complex, recurring thought pattern or emotional state you find yourself navigating. What are its winding corridors (rationalizations), its dead ends (frustrations), and its potential center (understanding or acceptance)? Map one recent journey through this internal labyrinth. What subtle tremor of insight or fear guided your turns? How do you find your way out, or do you choose to remain within, exploring its familiar, intricate paths?"
|
||||
},
|
||||
{
|
||||
"prompt20": "Examine a family tradition or ritual as if it were an ancient artifact. Break down its syntax: the required steps, the symbolic objects, the spoken phrases. Who are the keepers of this tradition? How has it mutated or diverged over generations? Participate in or recall this ritual with fresh eyes. What unspoken values and histories are encoded within its performance? What would be lost if it faded into oblivion?"
|
||||
},
|
||||
{
|
||||
"prompt21": "Observe a plant growing in an unexpected place\u2014a crack in the sidewalk, a gutter, a wall. Chronicle its struggle and persistence. Imagine the velocity of its growth against all odds. Write from the plant's perspective about its daily existence: the foot traffic, the weather, the search for sustenance. What can this resilient life form teach you about finding footholds and thriving in inhospitable environments?"
|
||||
},
|
||||
{
|
||||
"prompt22": "Imagine your creative process as a room with many thresholds. Describe the room where you generate raw ideas\u2014its mess, its energy. Then, describe the act of crossing the threshold into the room where you refine and edit. What changes in the atmosphere? What do you leave behind at the door, and what must you carry with you? Write about the architecture of your own creativity."
|
||||
},
|
||||
{
|
||||
"prompt23": "You are given a seed. It is not a magical seed, but an ordinary one from a fruit you ate. Instead of planting it, you decide to carry it with you for a week as a silent companion. Describe its presence in your pocket or bag. How does knowing it is there, a compact potential for an entire mycelial network of roots and a tree, subtly influence your days? Write about the weight of unactivated futures."
|
||||
},
|
||||
{
|
||||
"prompt24": "Recall a time you had to learn a new system or language quickly\u2014a job, a software, a social circle. Describe the initial phase of feeling like an outsider, decoding the basic algorithms of behavior. Then, focus on the precise moment you felt you crossed the threshold from outsider to competent insider. What was the catalyst? A piece of understood jargon? A successfully completed task? Explore the subtle architecture of belonging."
|
||||
},
|
||||
{
|
||||
"prompt25": "You find an old, annotated map\u2014perhaps in a book, or a tourist pamphlet from a trip long ago. Study the marks: circled sites, crossed-out routes, notes in the margin. Reconstruct the journey of the person who held this map. Where did they plan to go? Where did they actually go, based on the evidence? Write the travelogue of that forgotten expedition, blending the cartographic intention with the likely reality."
|
||||
},
|
||||
{
|
||||
"prompt26": "You encounter a door that is usually locked, but today it is slightly ajar. This is not a grand, mysterious portal, but an ordinary door\u2014to a storage closet, a rooftop, a neighbor's garden gate. Write about the potent allure of this minor threshold. Do you push it open? What mundane or profound discovery lies on the other side? Explore the magnetism of accessible secrets in a world of usual boundaries."
|
||||
},
|
||||
{
|
||||
"prompt27": "Recall a piece of practical advice you received that functioned like a simple life algorithm: 'When X happens, do Y.' Examine a recent situation where you deliberately chose not to follow that algorithm. What prompted the deviation? What was the outcome? Describe the feeling of operating outside of a previously trusted internal program. Did the mutation feel like a mistake or an evolution?"
|
||||
},
|
||||
{
|
||||
"prompt28": "Describe a piece of clothing you own that has been altered or mended multiple times. Trace the history of each repair. Who performed them, and under what circumstances? How does the garment's story of damage and restoration mirror larger cycles of wear and renewal in your own life? What does its continued use, despite its patched state, say about your relationship with impermanence and care?"
|
||||
},
|
||||
{
|
||||
"prompt29": "You find an old, hand-drawn map that leads to a place in your neighborhood. Follow it. Does it lead you to a spot that still exists, or to a location now utterly changed? Describe the journey of reconciling the cartography of the past with the terrain of the present. What has been erased? What endures? What ghosts of previous journeys do you feel along the way?"
|
||||
},
|
||||
{
|
||||
"prompt30": "Consider a skill you are learning. Break down its initial algorithm\u2014the basic, rigid steps you must follow. Now, describe the moment when practice leads to mutation: the algorithm begins to dissolve into intuition, muscle memory, or personal style. Where are you in this process? Can you feel the old, clunky code still running beneath the new, fluid performance? Write about the uncomfortable, fruitful space between competence and mastery."
|
||||
},
|
||||
{
|
||||
"prompt31": "Analyze the unspoken social algorithm of a group you belong to\u2014your family, your friend circle, your coworkers. What are the input rules (jokes that are allowed, topics to avoid)? What are the output expectations (laughter, support, problem-solving)? Now, imagine introducing a mutation: you break a minor, unwritten rule. Chronicle the system's response. Does it self-correct, reject the input, or adapt?"
|
||||
},
|
||||
{
|
||||
"prompt32": "Imagine your daily routine is a genetic sequence. Identify a habitual behavior that feels like a dominant gene. Now, imagine a spontaneous mutation occurring in this sequence\u2014one small, random change in the order or execution of your day. Follow the consequences. Does this mutation prove beneficial, harmful, or neutral? Does it replicate and become part of your new code? Write about the evolution of a personal habit through chance."
|
||||
},
|
||||
{
|
||||
"prompt33": "Your memory is a vast, dark archive. Choose a specific memory and imagine you are its archivist. Describe the process of retrieving it: locating the correct catalog number, the feel of the storage medium, the quality of the playback. Now, describe the process of conservation\u2014what elements are fragile and in need of repair? Do you restore it to its original clarity, or preserve its current, faded state? What is the ethical duty of a self-archivist?"
|
||||
},
|
||||
{
|
||||
"prompt34": "Examine a mended object in your possession\u2014a book with tape, a garment with a patch, a glued-together mug. Describe the repair not as a flaw, but as a new feature, a record of care and continuity. Write the history of its breaking and its fixing. Who performed the repair, and what was their state of mind? How does the object's value now reside in its visible history of damage and healing?"
|
||||
},
|
||||
{
|
||||
"prompt35": "Imagine you are a cartographer of sound. Map the auditory landscape of your current environment. Label the persistent drones, the intermittent rhythms, the sudden percussive events. What are the quiet zones? Where do sounds overlap to create new harmonies or dissonances? Now, imagine mutating one sound source\u2014silencing a hum, amplifying a whisper, changing a rhythm. How does this single alteration redraw the entire sonic map and your emotional response to the space?"
|
||||
},
|
||||
{
|
||||
"prompt36": "Contemplate the concept of a 'watershed'\u2014a geographical dividing line. Now, identify a watershed moment in your own life: a decision, an event, or a realization that divided your experience into 'before' and 'after.' Describe the landscape of the 'before.' Then, detail the moment of the divide itself. Finally, look out over the 'after' territory. How did the paths available to you fundamentally diverge at that ridge line? What rivers of consequence began to flow in new directions?"
|
||||
},
|
||||
{
|
||||
"prompt37": "Observe a spiderweb, a bird's nest, or another intricate natural construction. Describe it not as a static object, but as the recorded evidence of a process\u2014a series of deliberate actions repeated to create a functional whole. Imagine you are an archaeologist from another planet discovering this artifact. What hypotheses would you form about the builder's intelligence, needs, and methods? Write your field report."
|
||||
},
|
||||
{
|
||||
"prompt38": "Walk through a familiar indoor space (your home, your office) in complete darkness, or with your eyes closed if safe. Navigate by touch, memory, and sound alone. Describe the experience. Which objects and spaces feel different? What details do you notice that vision usually overrides? Write about the knowledge held in your hands and feet, and the temporary oblivion of the visual world. How does this shift in primary sense redefine your understanding of the space?"
|
||||
},
|
||||
{
|
||||
"prompt39": "You discover a single, worn-out glove lying on a park bench. Describe it in detail\u2014its color, material, signs of wear. Write a speculative history for this artifact. Who owned it? How was it lost? From the glove's perspective, narrate its journey from a department store shelf to this moment of abandonment. What human warmth did it hold, and what does its solitary state signify about loss and separation?"
|
||||
},
|
||||
{
|
||||
"prompt40": "Find a body of water\u2014a puddle after rain, a pond, a riverbank. Look at your reflection, then disturb the surface with a touch or a thrown pebble. Watch the image shatter and slowly reform. Use this as a metaphor for a period of personal disruption in your life. Describe the 'shattering' event, the chaotic ripple period, and the gradual, never-quite-identical reformation of your sense of self. What was lost in the distortion, and what new facets were revealed?"
|
||||
},
|
||||
{
|
||||
"prompt41": "You are handed a map of a city you know well, but it is from a century ago. Compare it to the modern layout. Which streets have vanished into oblivion, paved over or renamed? Which buildings are ghosts on the page? Choose one lost place and imagine walking its forgotten route today. What echoes of its past life\u2014sounds, smells, activities\u2014can you almost perceive beneath the contemporary surface? Write about the layers of history that coexist in a single geographic space."
|
||||
},
|
||||
{
|
||||
"prompt42": "What is something you've been putting off and why?"
|
||||
},
|
||||
{
|
||||
"prompt43": "Recall a piece of art\u2014a painting, song, film\u2014that initially confused or repelled you, but that you later came to appreciate or love. Describe your first, negative reaction in detail. Then, trace the journey to understanding. What changed in you or your context that allowed a new interpretation? Write about the value of sitting with discomfort and the rewards of having your internal syntax for beauty challenged and expanded."
|
||||
},
|
||||
{
|
||||
"prompt44": "Imagine your life as a vast, intricate tapestry. Describe the overall scene it depicts. Now, find a single, loose thread\u2014a small regret, an unresolved question, a path not taken. Write about gently pulling on that thread. What part of the tapestry begins to unravel? What new pattern or image is revealed\u2014or destroyed\u2014by following this divergence? Is the act one of repair or deconstruction?"
|
||||
},
|
||||
{
|
||||
"prompt45": "Recall a dream that felt more real than waking life. Describe its internal logic, its emotional palette, and its lingering aftertaste. Now, write a 'practical guide' for navigating that specific dreamscape, as if for a tourist. What are the rules? What should one avoid? What treasures might be found? By treating the dream as a tangible place, what insights do you gain about the concerns of your subconscious?"
|
||||
},
|
||||
{
|
||||
"prompt46": "Describe a public space you frequent (a library, a cafe, a park) at the exact moment it opens or closes. Capture the transition from emptiness to potential, or from activity to stillness. Focus on the staff or custodians who facilitate this transition\u2014the unseen architects of these daily cycles. Write from the perspective of the space itself as it breathes in or out its human occupants. What residue of the day does it hold in the quiet?"
|
||||
},
|
||||
{
|
||||
"prompt47": "Listen to a piece of music you know well, but focus exclusively on a single instrument or voice that usually resides in the background. Follow its thread through the entire composition. Describe its journey: when does it lead, when does it harmonize, when does it fall silent? Now, write a short story where this supporting element is the main character. How does shifting your auditory focus create a new narrative from familiar material?"
|
||||
},
|
||||
{
|
||||
"prompt48": "Describe your reflection in a window at night, with the interior light creating a double exposure of your face and the dark world outside. What two versions of yourself are superimposed? Write a conversation between the 'inside' self, defined by your private space, and the 'outside' self, defined by the anonymous night. What do they want from each other? How does this liminal artifact\u2014the glass\u2014both separate and connect these identities?"
|
||||
},
|
||||
{
|
||||
"prompt49": "Imagine you are a diver exploring the deep ocean of your own memory. Choose a specific, vivid memory and describe it as a submerged landscape. What creatures (emotions) swim there? What is the water pressure (emotional weight) like? Now, imagine a small, deliberate act of forgetting\u2014letting a single detail of that memory dissolve into the murk. How does this selective oblivion change the entire ecosystem of that recollection? Does it create space for new growth, or does it feel like a loss of truth?"
|
||||
},
|
||||
{
|
||||
"prompt50": "Recall a conversation that ended in a misunderstanding that was never resolved. Re-write the exchange, but introduce a single point of divergence\u2014one person says something slightly different, or pauses a moment longer. How does this tiny change alter the entire trajectory of the conversation and potentially the relationship? Explore the butterfly effect in human dialogue."
|
||||
},
|
||||
{
|
||||
"prompt51": "Spend 15 minutes in complete silence, actively listening for the absence of a specific sound that is usually present (e.g., traffic, refrigerator hum, birds). Describe the quality of this crafted silence. What smaller sounds emerge in the void? How does your mind and body react to the deliberate removal of this sonic artifact? Explore the concept of oblivion as an active, perceptible state rather than a mere lack."
|
||||
},
|
||||
{
|
||||
"prompt52": "Describe a skill or talent you possess that feels like it's fading from lack of use\u2014a language getting rusty, a sport you no longer play, an instrument gathering dust. Perform or practice it now, even if clumsily. Chronicle the physical and mental sensations of re-engagement. What echoes of proficiency remain? Is the knowledge truly gone, or merely dormant? Write about the relationship between mastery and oblivion."
|
||||
},
|
||||
{
|
||||
"prompt53": "Choose a common word (e.g., 'home,' 'work,' 'friend') and dissect its personal syntax. What rules, associations, and exceptions have you built around its meaning? Now, deliberately break one of those rules. Use the word in a context or with a definition that feels wrong to you. Write a paragraph that forces this new usage. How does corrupting your own internal language create space for new understanding?"
|
||||
},
|
||||
{
|
||||
"prompt54": "Contemplate a personal habit or pattern you wish to change. Instead of focusing on breaking it, imagine it diverging\u2014mutating into a new, slightly different pattern. Describe the old habit in detail, then design its evolved form. What small, intentional twist could redirect its energy? Write about a day living with this divergent habit. How does a shift in perspective, rather than eradication, alter your relationship to it?"
|
||||
},
|
||||
{
|
||||
"prompt55": "Describe a routine journey you make (a commute, a walk to the store) but narrate it as if you are a traveler in a foreign, slightly surreal land. Give fantastical names to ordinary landmarks. Interpret mundane events as portents or rituals. What hidden narrative or mythic structure can you impose on this familiar path? How does this reframing reveal the magic latent in the everyday?"
|
||||
},
|
||||
{
|
||||
"prompt56": "Imagine a place from your childhood that no longer exists in its original form\u2014a demolished building, a paved-over field, a renovated room. Reconstruct it from memory with all its sensory details. Now, write about the process of its erasure. Who decided it should change? What was lost in the transition, and what, if anything, was gained? How does the ghost of that place still influence the geography of your memory?"
|
||||
},
|
||||
{
|
||||
"prompt57": "You find an old, functional algorithm\u2014a recipe card, a knitting pattern, a set of instructions for assembling furniture. Follow it to the letter, but with a new, meditative attention to each step. Describe the process not as a means to an end, but as a ritual in itself. What resonance does this deliberate, prescribed action have? Does the final product matter, or has the value been in the structured journey?"
|
||||
},
|
||||
{
|
||||
"prompt58": "Imagine knowledge and ideas spread through a community not like a virus, but like a mycelium\u2014subterranean, cooperative, nutrient-sharing. Recall a time you learned something profound from an unexpected or unofficial source. Trace the hidden network that brought that wisdom to you. How many people and experiences were unknowingly part of that fruiting? Write a thank you to this invisible web."
|
||||
},
|
||||
{
|
||||
"prompt59": "Imagine your creative or problem-solving process is a mycelial network. A question or idea is dropped like a spore onto this vast, hidden web. Describe the journey of this spore as it sends out filaments, connects with distant nodes of memory and knowledge, and eventually fruits as an 'aha' moment or a new creation. How does this model differ from a linear, step-by-step algorithm? What does it teach you about patience and indirect growth?"
|
||||
}
|
||||
]
|
||||
4
prompts_pool.json
Normal file
4
prompts_pool.json
Normal file
@@ -0,0 +1,4 @@
|
||||
[
|
||||
"Describe preparing and eating a meal alone with the attention of a sacred ritual. Focus on each step: selecting ingredients, the sound of chopping, the aromas, the arrangement on the plate, the first bite. Write about the difference between eating for fuel and eating as an act of communion with yourself. What thoughts arise in the space of this deliberate solitude?",
|
||||
"Recall a rule you were taught as a child\u2014a practical safety rule, a social manner, a household edict. Examine its original purpose. Now, trace how your relationship to that rule has evolved. Do you follow it rigidly, have you modified it, or do you ignore it entirely? Write about the journey from external imposition to internalized (or rejected) law."
|
||||
]
|
||||
16
run.sh
16
run.sh
@@ -36,7 +36,6 @@ fi
|
||||
# Parse command line arguments
|
||||
INTERACTIVE=false
|
||||
STATS=false
|
||||
POOL_STATS=false
|
||||
FILL_POOL=false
|
||||
HELP=false
|
||||
|
||||
@@ -50,10 +49,6 @@ while [[ $# -gt 0 ]]; do
|
||||
STATS=true
|
||||
shift
|
||||
;;
|
||||
--pool-stats)
|
||||
POOL_STATS=true
|
||||
shift
|
||||
;;
|
||||
--fill-pool)
|
||||
FILL_POOL=true
|
||||
shift
|
||||
@@ -75,26 +70,21 @@ if [ "$HELP" = true ]; then
|
||||
echo ""
|
||||
echo "Options:"
|
||||
echo " -i, --interactive Run in interactive mode (with rich interface)"
|
||||
echo " --stats Show prompt history statistics"
|
||||
echo " --pool-stats Show prompt pool statistics"
|
||||
echo " --stats Show combined statistics (pool and history)"
|
||||
echo " --fill-pool Fill prompt pool using AI (makes API call)"
|
||||
echo " -h, --help Show this help message"
|
||||
echo ""
|
||||
echo "Examples:"
|
||||
echo " ./run.sh # Draw prompts from pool (default)"
|
||||
echo " ./run.sh -i # Interactive mode"
|
||||
echo " ./run.sh --stats # Show history statistics"
|
||||
echo " ./run.sh --pool-stats # Show pool statistics"
|
||||
echo " ./run.sh --stats # Show combined statistics"
|
||||
echo " ./run.sh --fill-pool # Fill prompt pool using AI"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$STATS" = true ]; then
|
||||
echo "📊 Showing history statistics..."
|
||||
echo "📊 Showing combined statistics..."
|
||||
python3 generate_prompts.py --stats
|
||||
elif [ "$POOL_STATS" = true ]; then
|
||||
echo "📊 Showing pool statistics..."
|
||||
python3 generate_prompts.py --pool-stats
|
||||
elif [ "$FILL_POOL" = true ]; then
|
||||
echo "🔄 Filling prompt pool using AI..."
|
||||
python3 generate_prompts.py --fill-pool
|
||||
|
||||
230
test_parsing.py
230
test_parsing.py
@@ -1,230 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Consolidated test file for parsing AI responses and format handling.
|
||||
Combines tests from:
|
||||
- test_final_fix.py (AttributeError fix for list responses)
|
||||
- test_new_format.py (new list format with locally generated keys)
|
||||
- test_valid_response.py (valid JSON response handling)
|
||||
"""
|
||||
|
||||
import json
|
||||
import sys
|
||||
import os
|
||||
|
||||
# Add the current directory to the Python path
|
||||
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
from generate_prompts import JournalPromptGenerator
|
||||
|
||||
|
||||
def test_attribute_error_fix():
|
||||
"""Test the fix for AttributeError when API returns list instead of dict."""
|
||||
print("\n=== Test: AttributeError fix for list responses ===")
|
||||
|
||||
# Create a mock generator
|
||||
generator = JournalPromptGenerator()
|
||||
|
||||
# Test with empty list []
|
||||
list_response = json.dumps([]) # Empty list
|
||||
print("\n1. Testing with empty list []:")
|
||||
try:
|
||||
result = generator._parse_ai_response(list_response)
|
||||
print(f" Result: Successfully parsed {len(result)} prompts (no AttributeError)")
|
||||
except AttributeError as e:
|
||||
print(f" ERROR: AttributeError occurred: {e}")
|
||||
return False
|
||||
except Exception as e:
|
||||
print(f" Other error: {type(e).__name__}: {e}")
|
||||
return False
|
||||
|
||||
# Test with list containing dictionaries
|
||||
list_with_dicts = json.dumps([
|
||||
{"some_key": "some value"},
|
||||
{"another_key": "another value"}
|
||||
])
|
||||
|
||||
print("\n2. Testing with list of dictionaries:")
|
||||
try:
|
||||
result = generator._parse_ai_response(list_with_dicts)
|
||||
print(f" Result: Successfully parsed {len(result)} prompts (no AttributeError)")
|
||||
except AttributeError as e:
|
||||
print(f" ERROR: AttributeError occurred: {e}")
|
||||
return False
|
||||
except Exception as e:
|
||||
print(f" Other error: {type(e).__name__}: {e}")
|
||||
return False
|
||||
|
||||
print("\n✅ AttributeError fix tests passed!")
|
||||
return True
|
||||
|
||||
|
||||
def test_new_list_format():
|
||||
"""Test the new format where AI returns a list and keys are generated locally."""
|
||||
print("\n=== Test: New list format with locally generated keys ===")
|
||||
|
||||
# Create a mock generator
|
||||
generator = JournalPromptGenerator()
|
||||
|
||||
# Create a mock AI response in the new list format
|
||||
mock_ai_response = [
|
||||
"Write about a childhood memory that still makes you smile.",
|
||||
"Describe your perfect day from start to finish.",
|
||||
"What is something you've been putting off and why?",
|
||||
"Imagine you could have a conversation with any historical figure.",
|
||||
"Write a letter to your future self one year from now.",
|
||||
"Describe a place that feels like home to you."
|
||||
]
|
||||
|
||||
# Convert to JSON string
|
||||
json_response = json.dumps(mock_ai_response)
|
||||
|
||||
print("\n1. Testing _parse_ai_response with list format:")
|
||||
result = generator._parse_ai_response(json_response)
|
||||
print(f" Result type: {type(result)}")
|
||||
print(f" Number of prompts: {len(result)}")
|
||||
print(f" First prompt: {result[0][:50]}...")
|
||||
|
||||
# Verify it's a list of strings
|
||||
assert isinstance(result, list), "Result should be a list"
|
||||
assert all(isinstance(prompt, str) for prompt in result), "All items should be strings"
|
||||
|
||||
print("\n2. Testing add_prompts_to_pool with list of strings:")
|
||||
|
||||
# Get initial pool size
|
||||
initial_pool_size = len(generator.pool_prompts)
|
||||
print(f" Initial pool size: {initial_pool_size}")
|
||||
|
||||
# Add prompts to pool
|
||||
generator.add_prompts_to_pool(result)
|
||||
|
||||
# Check new pool size
|
||||
new_pool_size = len(generator.pool_prompts)
|
||||
print(f" New pool size: {new_pool_size}")
|
||||
print(f" Added {new_pool_size - initial_pool_size} prompts")
|
||||
|
||||
print("\n✅ New list format tests passed!")
|
||||
return True
|
||||
|
||||
|
||||
def test_valid_json_responses():
|
||||
"""Test with valid JSON responses in various formats."""
|
||||
print("\n=== Test: Valid JSON response handling ===")
|
||||
|
||||
# Create a mock generator
|
||||
generator = JournalPromptGenerator()
|
||||
|
||||
# Create a valid response with 4 prompts as a list (new format)
|
||||
valid_response = [
|
||||
"Write about a time when you felt truly at peace.",
|
||||
"Describe your ideal morning routine in detail.",
|
||||
"What are three things you're grateful for today?",
|
||||
"Reflect on a recent challenge and what you learned from it."
|
||||
]
|
||||
|
||||
# Convert to JSON string
|
||||
json_response = json.dumps(valid_response)
|
||||
|
||||
print("\n1. Testing with valid JSON response (list format):")
|
||||
result = generator._parse_ai_response(json_response)
|
||||
print(f" Number of prompts extracted: {len(result)}")
|
||||
print(f" Type of result: {type(result)}")
|
||||
|
||||
for i, prompt_text in enumerate(result):
|
||||
print(f" Prompt {i+1}: {prompt_text[:50]}...")
|
||||
|
||||
# Test with backticks
|
||||
print("\n2. Testing with valid JSON response with backticks:")
|
||||
backticks_response = f"```json\n{json_response}\n```"
|
||||
result = generator._parse_ai_response(backticks_response)
|
||||
print(f" Number of prompts extracted: {len(result)}")
|
||||
|
||||
# Test with "json" prefix
|
||||
print("\n3. Testing with valid JSON response with 'json' prefix:")
|
||||
json_prefix_response = f"json\n{json_response}"
|
||||
result = generator._parse_ai_response(json_prefix_response)
|
||||
print(f" Number of prompts extracted: {len(result)}")
|
||||
|
||||
# Test fallback for old dictionary format
|
||||
print("\n4. Testing fallback for old dictionary format:")
|
||||
old_format_response = {
|
||||
"newprompt0": "Write about a time when you felt truly at peace.",
|
||||
"newprompt1": "Describe your ideal morning routine in detail.",
|
||||
"newprompt2": "What are three things you're grateful for today?",
|
||||
"newprompt3": "Reflect on a recent challenge and what you learned from it."
|
||||
}
|
||||
json_old_response = json.dumps(old_format_response)
|
||||
result = generator._parse_ai_response(json_old_response)
|
||||
print(f" Number of prompts extracted: {len(result)}")
|
||||
|
||||
print("\n✅ Valid JSON response tests passed!")
|
||||
return True
|
||||
|
||||
|
||||
def test_clean_ai_response():
|
||||
"""Test the _clean_ai_response method."""
|
||||
print("\n=== Test: _clean_ai_response method ===")
|
||||
|
||||
generator = JournalPromptGenerator()
|
||||
|
||||
# Test cases
|
||||
test_cases = [
|
||||
("```json\n[1, 2, 3]\n```", "[1, 2, 3]"),
|
||||
("```\n[1, 2, 3]\n```", "[1, 2, 3]"),
|
||||
("json\n[1, 2, 3]", "[1, 2, 3]"),
|
||||
("JSON\n[1, 2, 3]", "[1, 2, 3]"),
|
||||
(" [1, 2, 3] ", "[1, 2, 3]"),
|
||||
("```json\n{\"a\": 1}\n```", "{\"a\": 1}"),
|
||||
]
|
||||
|
||||
all_passed = True
|
||||
for i, (input_text, expected) in enumerate(test_cases):
|
||||
cleaned = generator._clean_ai_response(input_text)
|
||||
if cleaned == expected:
|
||||
print(f" Test {i+1} passed: '{input_text[:20]}...' -> '{cleaned}'")
|
||||
else:
|
||||
print(f" Test {i+1} FAILED: '{input_text[:20]}...' -> '{cleaned}' (expected: '{expected}')")
|
||||
all_passed = False
|
||||
|
||||
if all_passed:
|
||||
print("\n✅ _clean_ai_response tests passed!")
|
||||
return True
|
||||
else:
|
||||
print("\n❌ _clean_ai_response tests failed!")
|
||||
return False
|
||||
|
||||
|
||||
def main():
|
||||
"""Run all parsing tests."""
|
||||
print("=" * 60)
|
||||
print("Running Consolidated Parsing Tests")
|
||||
print("=" * 60)
|
||||
|
||||
all_passed = True
|
||||
|
||||
# Run all tests
|
||||
if not test_attribute_error_fix():
|
||||
all_passed = False
|
||||
|
||||
if not test_new_list_format():
|
||||
all_passed = False
|
||||
|
||||
if not test_valid_json_responses():
|
||||
all_passed = False
|
||||
|
||||
if not test_clean_ai_response():
|
||||
all_passed = False
|
||||
|
||||
print("\n" + "=" * 60)
|
||||
if all_passed:
|
||||
print("✅ ALL PARSING TESTS PASSED!")
|
||||
else:
|
||||
print("❌ SOME TESTS FAILED!")
|
||||
print("=" * 60)
|
||||
|
||||
return all_passed
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
success = main()
|
||||
sys.exit(0 if success else 1)
|
||||
|
||||
@@ -1,98 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Test script to verify the prompt numbering logic.
|
||||
"""
|
||||
|
||||
import json
|
||||
import configparser
|
||||
|
||||
def get_num_prompts():
|
||||
"""Get the number of prompts from settings.cfg or default."""
|
||||
config = configparser.ConfigParser()
|
||||
num_prompts = 6 # Default value
|
||||
|
||||
try:
|
||||
config.read('settings.cfg')
|
||||
if 'prompts' in config and 'num_prompts' in config['prompts']:
|
||||
num_prompts = int(config['prompts']['num_prompts'])
|
||||
except (FileNotFoundError, ValueError):
|
||||
pass
|
||||
|
||||
return num_prompts
|
||||
|
||||
def test_renumbering():
|
||||
"""Test the renumbering logic."""
|
||||
|
||||
# Get number of prompts from config
|
||||
num_prompts = get_num_prompts()
|
||||
|
||||
# Create a sample historic prompts list
|
||||
historic_prompts = []
|
||||
for i in range(60):
|
||||
historic_prompts.append({
|
||||
f"prompt{i:02d}": f"Old prompt {i}"
|
||||
})
|
||||
|
||||
print(f"Original prompts: {len(historic_prompts)}")
|
||||
print(f"First prompt key: {list(historic_prompts[0].keys())[0]}")
|
||||
print(f"Last prompt key: {list(historic_prompts[-1].keys())[0]}")
|
||||
print(f"Number of prompts from config: {num_prompts}")
|
||||
|
||||
# Simulate adding new prompts (as the current code would create them)
|
||||
new_prompts = []
|
||||
for i in range(num_prompts):
|
||||
new_prompts.append({
|
||||
f"prompt{len(historic_prompts) + i:02d}": f"New prompt {i}"
|
||||
})
|
||||
|
||||
print(f"\nNew prompts to add: {len(new_prompts)}")
|
||||
for i, prompt in enumerate(new_prompts):
|
||||
print(f" New prompt {i}: {list(prompt.keys())[0]}")
|
||||
|
||||
# Prepend new prompts (reverse to maintain order)
|
||||
for prompt in reversed(new_prompts):
|
||||
historic_prompts.insert(0, prompt)
|
||||
|
||||
print(f"\nAfter prepending: {len(historic_prompts)} prompts")
|
||||
print(f"First 3 prompts keys:")
|
||||
for i in range(3):
|
||||
print(f" {i}: {list(historic_prompts[i].keys())[0]}")
|
||||
|
||||
# Renumber all prompts
|
||||
renumbered_prompts = []
|
||||
for i, prompt_dict in enumerate(historic_prompts):
|
||||
prompt_key = list(prompt_dict.keys())[0]
|
||||
prompt_text = prompt_dict[prompt_key]
|
||||
|
||||
new_prompt_key = f"prompt{i:02d}"
|
||||
renumbered_prompts.append({
|
||||
new_prompt_key: prompt_text
|
||||
})
|
||||
|
||||
print(f"\nAfter renumbering: {len(renumbered_prompts)} prompts")
|
||||
print(f"First 10 prompts keys:")
|
||||
for i in range(10):
|
||||
print(f" prompt{i:02d}: {list(renumbered_prompts[i].keys())[0]} = {renumbered_prompts[i][f'prompt{i:02d}'][:30]}...")
|
||||
|
||||
# Keep only first 60
|
||||
if len(renumbered_prompts) > 60:
|
||||
renumbered_prompts = renumbered_prompts[:60]
|
||||
|
||||
print(f"\nAfter keeping only first 60: {len(renumbered_prompts)} prompts")
|
||||
print(f"First prompt: {list(renumbered_prompts[0].keys())[0]} = {renumbered_prompts[0]['prompt00'][:30]}...")
|
||||
print(f"Last prompt: {list(renumbered_prompts[-1].keys())[0]} = {renumbered_prompts[-1]['prompt59'][:30]}...")
|
||||
|
||||
# Verify the range
|
||||
for i in range(60):
|
||||
expected_key = f"prompt{i:02d}"
|
||||
actual_key = list(renumbered_prompts[i].keys())[0]
|
||||
if expected_key != actual_key:
|
||||
print(f"ERROR: Expected {expected_key}, got {actual_key}")
|
||||
return False
|
||||
|
||||
print("\n✅ All tests passed! Prompt numbering is correct.")
|
||||
return True
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_renumbering()
|
||||
|
||||
@@ -7,8 +7,8 @@ import json
|
||||
import sys
|
||||
import os
|
||||
|
||||
# Add the current directory to the Python path
|
||||
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
||||
# Add the parent directory to the Python path
|
||||
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
|
||||
from generate_prompts import JournalPromptGenerator
|
||||
|
||||
55
tests/test_feedback_integration.py
Normal file
55
tests/test_feedback_integration.py
Normal file
@@ -0,0 +1,55 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Test script to verify feedback_words integration
|
||||
"""
|
||||
|
||||
import sys
|
||||
import os
|
||||
|
||||
# Add the parent directory to the Python path
|
||||
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
|
||||
from generate_prompts import JournalPromptGenerator
|
||||
|
||||
def test_feedback_words_loading():
|
||||
"""Test that feedback_words are loaded correctly."""
|
||||
print("Testing feedback_words integration...")
|
||||
|
||||
try:
|
||||
# Initialize the generator
|
||||
generator = JournalPromptGenerator()
|
||||
|
||||
# Check if feedback_words were loaded
|
||||
print(f"Number of feedback words loaded: {len(generator.feedback_words)}")
|
||||
|
||||
if generator.feedback_words:
|
||||
print("Feedback words loaded successfully:")
|
||||
for i, feedback in enumerate(generator.feedback_words):
|
||||
print(f" {i+1}. {feedback}")
|
||||
else:
|
||||
print("No feedback words loaded (this might be expected if file is empty)")
|
||||
|
||||
# Test _prepare_prompt_with_count method
|
||||
print("\nTesting _prepare_prompt_with_count method...")
|
||||
prompt_with_count = generator._prepare_prompt_with_count(3)
|
||||
print(f"Prompt with count length: {len(prompt_with_count)} characters")
|
||||
|
||||
# Check if feedback words are included in the prompt with count
|
||||
if generator.feedback_words and "Feedback words:" in prompt_with_count:
|
||||
print("✓ Feedback words are included in the prompt with count")
|
||||
else:
|
||||
print("✗ Feedback words are NOT included in the prompt with count")
|
||||
|
||||
print("\n✅ All tests passed!")
|
||||
return True
|
||||
|
||||
except Exception as e:
|
||||
print(f"\n❌ Error during testing: {e}")
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
return False
|
||||
|
||||
if __name__ == "__main__":
|
||||
success = test_feedback_words_loading()
|
||||
sys.exit(0 if success else 1)
|
||||
|
||||
67
tests/test_valid_response.py
Normal file
67
tests/test_valid_response.py
Normal file
@@ -0,0 +1,67 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Test the error handling with a valid response.
|
||||
"""
|
||||
|
||||
import sys
|
||||
import os
|
||||
import json
|
||||
|
||||
# Add the parent directory to the Python path
|
||||
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
|
||||
from generate_prompts import JournalPromptGenerator
|
||||
|
||||
def test_valid_response():
|
||||
"""Test with a valid JSON response."""
|
||||
|
||||
# Create a mock generator
|
||||
generator = JournalPromptGenerator(config_path=".env")
|
||||
|
||||
# Create a valid response with 4 prompts as a list (new format)
|
||||
valid_response = [
|
||||
"Write about a time when you felt truly at peace.",
|
||||
"Describe your ideal morning routine in detail.",
|
||||
"What are three things you're grateful for today?",
|
||||
"Reflect on a recent challenge and what you learned from it."
|
||||
]
|
||||
|
||||
# Convert to JSON string
|
||||
json_response = json.dumps(valid_response)
|
||||
|
||||
print("\n=== Test: Valid JSON response (list format) ===")
|
||||
result = generator._parse_ai_response(json_response)
|
||||
print(f"Number of prompts extracted: {len(result)}")
|
||||
print(f"Type of result: {type(result)}")
|
||||
|
||||
for i, prompt_text in enumerate(result):
|
||||
print(f"Prompt {i+1}: {prompt_text[:50]}...")
|
||||
|
||||
# Test with backticks
|
||||
print("\n=== Test: Valid JSON response with backticks ===")
|
||||
backticks_response = f"```json\n{json_response}\n```"
|
||||
result = generator._parse_ai_response(backticks_response)
|
||||
print(f"Number of prompts extracted: {len(result)}")
|
||||
|
||||
# Test with "json" prefix
|
||||
print("\n=== Test: Valid JSON response with 'json' prefix ===")
|
||||
json_prefix_response = f"json\n{json_response}"
|
||||
result = generator._parse_ai_response(json_prefix_response)
|
||||
print(f"Number of prompts extracted: {len(result)}")
|
||||
|
||||
# Test fallback for old dictionary format
|
||||
print("\n=== Test: Fallback for old dictionary format ===")
|
||||
old_format_response = {
|
||||
"newprompt0": "Write about a time when you felt truly at peace.",
|
||||
"newprompt1": "Describe your ideal morning routine in detail.",
|
||||
"newprompt2": "What are three things you're grateful for today?",
|
||||
"newprompt3": "Reflect on a recent challenge and what you learned from it."
|
||||
}
|
||||
json_old_response = json.dumps(old_format_response)
|
||||
result = generator._parse_ai_response(json_old_response)
|
||||
print(f"Number of prompts extracted: {len(result)}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_valid_response()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user