Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions backend/utils/conversations/process_conversation.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ def _get_structured(
conversation.started_at,
language_code,
tz,
uid,
calendar_meeting_context=calendar_context,
output_language_code=user_language,
)
Expand Down Expand Up @@ -194,6 +195,7 @@ def _get_structured(
conversation.started_at,
language_code,
tz,
uid,
photos=conversation.photos,
calendar_meeting_context=calendar_context,
output_language_code=user_language,
Expand Down
7 changes: 7 additions & 0 deletions backend/utils/llm/conversation_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from langchain_core.prompts import ChatPromptTemplate
from pydantic import BaseModel, Field

from database.auth import get_user_name
from models.app import App
from models.calendar_context import CalendarMeetingContext
from models.conversation import Conversation
Expand Down Expand Up @@ -590,6 +591,7 @@ def get_transcript_structure(
started_at: datetime,
language_code: str,
tz: str,
uid: str,
photos: List[ConversationPhoto] = None,
calendar_meeting_context: 'CalendarMeetingContext' = None,
output_language_code: str = None,
Expand All @@ -599,6 +601,11 @@ def get_transcript_structure(
return Structured() # Should be caught by discard logic, but as a safeguard.

response_language = output_language_code or language_code
try:
user_name = get_user_name(uid)
except Exception as e:
logger.warning(f'Failed to load user name for transcript structuring (uid={uid}): {e}')
user_name = 'The User'
Comment on lines +604 to +608
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Redundant fallback — get_user_name already returns "The User" by default

get_user_name(uid) is called with use_default=True (the default), so it already returns 'The User' when no name is found. The try/except here catches only genuine runtime failures (Redis/Firestore I/O errors), which is fine for resilience — but the fallback value is already guaranteed by the function itself. Consider adding a comment explaining that the wrapper guards against network exceptions propagating out of get_user_from_uid, so future readers don't assume it is unnecessary.


# First system message: task-specific instructions (static prefix enables cross-conversation caching)
# NOTE: language instructions are in context_message (second message) to keep this prefix fully static.
Expand Down