Server side implementation for interactive entry edits

This commit is contained in:
2024-11-23 15:34:33 +01:00
parent bb74fd3621
commit dbc0068a82
28 changed files with 749 additions and 553 deletions

View File

@@ -3,6 +3,8 @@ from pathlib import Path
import xml.etree.ElementTree as ET
import hashlib
from .util import format_timestamp
class IterationLogger:
"""Logs agent iterations to XML files"""
@@ -20,6 +22,7 @@ class IterationLogger:
def log_iteration(
self,
timestamp: datetime,
context: str,
response: str,
):
@@ -30,8 +33,7 @@ class IterationLogger:
context: The context as ElementTree
response: Raw response from LLM
"""
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S_%f")[:-3]
filename = f"iteration_{timestamp}.xml"
filename = f"iteration_{format_timestamp(timestamp)}.xml"
filepath = self.iterations_dir / filename
root = ET.Element("iteration")