fix: multi-user distillation + datetime in context + session log labels
Distillation was silently operating on scott/inara for all users due to ContextVar defaults. All three distill endpoints now require ?user=&persona= query params and validate them via persona.validate(). Memory distiller signatures changed from Optional to required positional args — no more global settings fallback. Scheduler now iterates all users/personas instead of hardcoding the primary user. - context_loader: inject current date/time as first system prompt section - session_logger: use get_user()/get_persona() from context instead of settings globals so Holly/Brian sessions show correct speaker labels - memory_distiller: system prompts now reference u.title()/p.title() instead of settings.user_name/settings.agent_name - distill router: Query(...) enforces params; _resolve() validates persona - scheduler: _all_personas() helper iterates every user/persona for distill - app.js: runDistill() now appends ?user=&persona= via _fileParams Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
from datetime import datetime
|
||||
from config import settings
|
||||
from persona import persona_path
|
||||
from persona import persona_path, get_user, get_persona
|
||||
|
||||
|
||||
def log_turn(
|
||||
@@ -21,11 +20,15 @@ def log_turn(
|
||||
meta_parts = [p for p in [backend_label, host] if p]
|
||||
meta = f" · {' / '.join(meta_parts)}" if meta_parts else ""
|
||||
|
||||
# Use the actual user/persona names from the current request context
|
||||
user_label = get_user().title()
|
||||
persona_label = get_persona().title()
|
||||
|
||||
with open(log_file, "a") as f:
|
||||
if is_new:
|
||||
f.write(f"# Session Log — {today}\n")
|
||||
f.write(
|
||||
f"\n### [{timestamp}] `{session_id}`{meta}\n"
|
||||
f"**{settings.user_name}:** {user_msg}\n\n"
|
||||
f"**{settings.agent_name}:** {assistant_msg}\n"
|
||||
f"**{user_label}:** {user_msg}\n\n"
|
||||
f"**{persona_label}:** {assistant_msg}\n"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user