Skip to content
Merged
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
5 changes: 3 additions & 2 deletions backend/database/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -997,7 +997,7 @@ def get_user_transcription_preferences(uid: str) -> dict:
Get the user's transcription preferences.

Returns:
dict with 'single_language_mode' (bool) and 'vocabulary' (List[str])
dict with 'single_language_mode' (bool), 'vocabulary' (List[str]), and 'language' (str)
"""
user_ref = db.collection('users').document(uid)
user_doc = user_ref.get()
Expand All @@ -1008,9 +1008,10 @@ def get_user_transcription_preferences(uid: str) -> dict:
return {
'single_language_mode': prefs.get('single_language_mode', False),
'vocabulary': prefs.get('vocabulary', []),
'language': user_data.get('language', ''),
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need to make changes to the backend? How has the mobile app been working with language detection without any of these backend changes?

Copy link
Member Author

Choose a reason for hiding this comment

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

mobile app:

When a user changes their language in the app, INFO: 192.168.1.25:58408 - "PATCH /v1/users/language HTTP/1.1" 200 OK change the language, but when building the socket url for transcription, the app reads language directly from local SharedPreferences on the device. It never asks the backend for it.

web:

It fetches language from GET /v1/users/transcription-preferences at recording time. The problem was that endpoint never returned a language field, so prefs.language was always undefined, causing the recorder to fall back to language=multi, adding language to that response, so the web recorder can read what the user actually chose, PATCH /v1/users/language already saved it correctly to firestore

}

return {'single_language_mode': False, 'vocabulary': []}
return {'single_language_mode': False, 'vocabulary': [], 'language': ''}


def get_agent_vm(uid: str) -> Optional[dict]:
Expand Down
1 change: 1 addition & 0 deletions backend/routers/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,7 @@ def set_user_language(data: dict, uid: str = Depends(auth.get_current_user_uid))
class TranscriptionPreferencesResponse(BaseModel):
single_language_mode: bool = False
vocabulary: List[str] = []
language: str = ''


class TranscriptionPreferencesUpdate(BaseModel):
Expand Down