IA.chati / memoria.py
ander19's picture
Upload 9 files
da41d5f verified
raw
history blame contribute delete
421 Bytes
import json
import os
ARCHIVO = "historial.json"
# Cargar historial si existe
def cargar_historial():
if os.path.exists(ARCHIVO):
with open(ARCHIVO, "r", encoding="utf-8") as f:
return json.load(f)
return []
# Guardar historial
def guardar_historial(historial):
with open(ARCHIVO, "w", encoding="utf-8") as f:
json.dump(historial, f, ensure_ascii=False, indent=2)