fix: hide attachment path markers in chat UI

This commit is contained in:
AJV20
2026-05-31 20:52:33 -04:00
committed by nesquena-hermes
parent 36fac9d0a3
commit ec704356ac
5 changed files with 50 additions and 4 deletions

View File

@@ -2858,6 +2858,10 @@ def all_sessions(diag=None):
return result
def _strip_attached_files_marker(text: str) -> str:
return re.sub(r"\n\n\[Attached files: [^\]]+\]$", "", str(text or "")).strip()
def title_from(messages, fallback: str='Untitled'):
"""Derive a session title from the first user message."""
for m in messages:
@@ -2865,7 +2869,7 @@ def title_from(messages, fallback: str='Untitled'):
c = m.get('content', '')
if isinstance(c, list):
c = ' '.join(p.get('text', '') for p in c if isinstance(p, dict) and p.get('type') == 'text')
text = str(c).strip()
text = _strip_attached_files_marker(str(c))
if text:
return text[:64]
return fallback