fix: use user's configured name in conversation transcript summaries#5320
fix: use user's configured name in conversation transcript summaries#5320atlas-agent-omi[bot] wants to merge 1 commit intomainfrom
Conversation
Previously, conversation summaries used 'User' as the speaker name because get_transcript() was called without user_name in the conversation processing pipeline. Now we fetch the user's configured name via get_user_name(uid) and pass it through to segments_as_string(), so transcripts show 'Aarav:' instead of 'User:'. Fixes #5319
Greptile SummaryThis PR aims to use the user's configured name instead of "User" in conversation transcript summaries. The approach is mostly correct: adding Changes:
Impact: Confidence Score: 1/5
Important Files Changed
Last reviewed commit: ddb010f |
| with track_usage(uid, Features.CONVERSATION_APPS): | ||
| result = get_app_result( | ||
| conversation.get_transcript(False, people=people), conversation.photos, app, language_code=language_code | ||
| conversation.get_transcript(False, people=people, user_name=user_name), conversation.photos, app, language_code=language_code |
There was a problem hiding this comment.
user_name undefined here - will cause NameError
user_name is not a parameter of _trigger_apps() nor is it defined in the function scope. When execute_app runs, it will raise NameError: name 'user_name' is not defined.
Fix needed:
- Add
user_name: str = Noneparameter to_trigger_apps()signature (line 286) - Pass
user_name=user_namewhen calling_trigger_apps()(line 696)
def _trigger_apps(
uid: str,
conversation: Conversation,
is_reprocess: bool = False,
app_id: Optional[str] = None,
language_code: str = 'en',
people: List[Person] = None,
user_name: str = None, # Add this
):And at line 696:
_trigger_apps(
uid, conversation, is_reprocess=is_reprocess, app_id=app_id,
language_code=language_code, people=people, user_name=user_name
)| people = [Person(**p) for p in people_data] | ||
|
|
||
| structured, discarded = _get_structured(uid, language_code, conversation, force_process, people=people) | ||
| from database.auth import get_user_name |
There was a problem hiding this comment.
Move import to module level per coding standards
The import is inside the function, violating rule 40d2fa4f (Backend Python import rules - no in-function imports). While this file has other in-function imports, best practice is to import at the module level.
Move to top of file:
| from database.auth import get_user_name | |
| from database.auth import get_user_name |
Context Used: Rule from dashboard - Backend Python import rules - no in-function imports, follow module hierarchy (source)
Problem
Conversation summaries show "User" instead of the person's actual name when generating the transcript for the summary LLM call.
Root Cause
conversation.get_transcript()andConversation.get_transcript()were called withoutuser_nameinprocess_conversation.py. Thesegments_as_string()method defaults to "User" whenuser_nameisNone.Fix
user_nameparameter toConversation.get_transcript()andCreateConversation.get_transcript()get_user_name(uid)inprocess_conversation()user_namethrough_get_structured()→get_transcript()→segments_as_string()user_nameto the app results transcript callNote:
memories.pyalready passesuser_namecorrectly — this fix aligns the conversation summary path.Fixes #5319