refactor: Migrate file-based data storage to database

This commit is contained in:
2026-02-22 10:23:40 -05:00
parent b4058f9f1f
commit 51b98c9399
9 changed files with 108 additions and 80 deletions

View File

@@ -157,10 +157,12 @@ def update_persona_sample(bp, folder):
author_name = meta.get('author', 'Unknown Author')
# Use a local file mirror for the engine context (runs outside Flask app context)
_personas_file = os.path.join(config.PERSONAS_DIR, "personas.json")
personas = {}
if os.path.exists(config.PERSONAS_FILE):
if os.path.exists(_personas_file):
try:
with open(config.PERSONAS_FILE, 'r') as f: personas = json.load(f)
with open(_personas_file, 'r') as f: personas = json.load(f)
except: pass
if author_name not in personas:
@@ -189,4 +191,4 @@ def update_persona_sample(bp, folder):
if filename not in personas[author_name]['sample_files']:
personas[author_name]['sample_files'].append(filename)
with open(config.PERSONAS_FILE, 'w') as f: json.dump(personas, f, indent=2)
with open(_personas_file, 'w') as f: json.dump(personas, f, indent=2)