Skip to content

fix: pass user_name to all transcript callers (not just summaries) #5532

@beastoin

Description

@beastoin

Problem

Conversation transcripts show generic "User: ..." instead of the user's actual configured name (e.g. "Stephen: ...") across multiple code paths. The user_name parameter exists in segments_as_string() but most callers don't pass it.

PR #5369 by @bzanghi correctly fixes the two highest-impact paths (_get_structured and _trigger_apps), but 4 other callers of get_transcript() and 6 direct callers of segments_as_string() still use the generic "User" label.

Affected paths (not covered by #5369)

get_transcript() callers still missing user_name:

File Function Impact
backend/utils/llm/trends.py:39 Trends extraction Low — analytical feature
backend/utils/llm/chat.py:865 RAG context retrieval Medium — affects chat context
backend/utils/llm/chat.py:899 Emotional message generation Medium — daily summaries
backend/models/conversation.py:397 conversations_to_string() Low — bulk display

segments_as_string() direct callers still missing user_name:

File Line Function
backend/utils/llm/followup.py 9 Follow-up question generation
backend/utils/llm/chat.py 216 Chunk extraction for RAG
backend/utils/llm/chat.py 1331 Question generation
backend/utils/llm/chat.py 1352 Emotional context retrieval
backend/utils/retrieval/rag.py 57 Conversation chunk retrieval
backend/scripts/rag/app.py 219 RAG app script

Suggested fix

Thread user_name through all callers, not just the summarization paths. The pattern from #5369 works well — fetch get_user_name(uid, use_default=False) once per request and pass it down.

For segments_as_string() direct callers that don't have access to uid, consider adding user_name as a parameter to the calling function signatures (same approach as #5369).

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestp3Priority: Backlog (score <14)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions