Further improve detail display and work on inline latency display

This commit is contained in:
2026-02-15 20:08:02 +00:00
parent 1ebd565f44
commit 63af5d234e
17 changed files with 1223 additions and 239 deletions

View File

@@ -629,6 +629,56 @@ def _compose_page_url_for_person(user, person):
return f"{reverse('compose_page')}?{query}"
def _participant_feedback_display(conversation, person):
payload = conversation.participant_feedback or {}
if not isinstance(payload, dict):
return None
raw = payload.get(str(person.id)) or {}
if not isinstance(raw, dict):
return None
state_key = str(raw.get("state") or "").strip().lower()
state_label = {
"withdrawing": "Withdrawing",
"overextending": "Overextending",
"balanced": "Balanced",
}.get(state_key, "Unknown")
state_icon = {
"withdrawing": "fa-regular fa-face-frown",
"overextending": "fa-regular fa-face-meh",
"balanced": "fa-regular fa-face-smile",
}.get(state_key, "fa-regular fa-face-meh-blank")
state_class = {
"withdrawing": "has-text-danger",
"overextending": "has-text-warning",
"balanced": "has-text-success",
}.get(state_key, "has-text-grey")
updated_label = ""
updated_raw = raw.get("updated_at")
if updated_raw:
try:
dt_value = datetime.fromisoformat(str(updated_raw))
if dt_value.tzinfo is None:
dt_value = dt_value.replace(tzinfo=timezone.utc)
updated_label = dj_timezone.localtime(dt_value).strftime("%Y-%m-%d %H:%M")
except Exception:
updated_label = str(updated_raw)
return {
"state_key": state_key or "unknown",
"state_label": state_label,
"state_icon": state_icon,
"state_class": state_class,
"inbound_messages": raw.get("inbound_messages"),
"outbound_messages": raw.get("outbound_messages"),
"sample_messages": raw.get("sample_messages"),
"sample_days": raw.get("sample_days"),
"updated_at_label": updated_label,
}
def _message_rows_for_person(user, person, limit):
sessions = ChatSession.objects.filter(user=user, identifier__person=person)
identifiers = set(
@@ -3302,6 +3352,9 @@ class AIWorkspacePersonWidget(LoginRequiredMixin, View):
"widget_options": 'gs-w="8" gs-h="11" gs-x="4" gs-y="0" gs-min-w="4"',
"person": person,
"workspace_conversation": conversation,
"participant_feedback_display": _participant_feedback_display(
conversation, person
),
"limit": limit,
"ai_operations": [
("artifacts", "Plan"),
@@ -3454,6 +3507,10 @@ class AIWorkspaceInformation(LoginRequiredMixin, View):
"ai_workspace_insight_graphs",
kwargs={"type": "page", "person_id": person.id},
),
"information_url": reverse(
"ai_workspace_information",
kwargs={"type": "page", "person_id": person.id},
),
"help_url": reverse(
"ai_workspace_insight_help",
kwargs={"type": "page", "person_id": person.id},
@@ -3734,9 +3791,7 @@ class AIWorkspaceRunOperation(LoginRequiredMixin, View):
limit = max(5, min(limit, 200))
user_notes = request.GET.get("user_notes", "")
messages = AIWorkspacePersonWidget()._recent_messages(
request.user, person, limit
)
messages = _recent_messages_for_person(request.user, person, limit)
owner_name = (
request.user.first_name
or request.user.get_full_name().strip()