working checkpoint before caching attempt
This commit is contained in:
@@ -4,11 +4,29 @@ Test script to verify the prompt numbering logic.
|
||||
"""
|
||||
|
||||
import json
|
||||
import configparser
|
||||
from datetime import datetime
|
||||
|
||||
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):
|
||||
@@ -19,10 +37,11 @@ def test_renumbering():
|
||||
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 6 new prompts (as the current code would create them)
|
||||
# Simulate adding new prompts (as the current code would create them)
|
||||
new_prompts = []
|
||||
for i in range(6):
|
||||
for i in range(num_prompts):
|
||||
new_prompts.append({
|
||||
f"prompt{len(historic_prompts) + i:02d}": f"New prompt {i}"
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user