Fix display user not updating locally until app restart
Engines now read user.name from the config object at transcription time instead of caching it at init, so name changes take effect immediately. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -36,18 +36,16 @@ class DeepgramTranscriptionEngine:
|
||||
# Construction / configuration
|
||||
# ------------------------------------------------------------------ #
|
||||
|
||||
def __init__(self, config, user_name: str = "User", input_device_index: Optional[int] = None):
|
||||
def __init__(self, config, input_device_index: Optional[int] = None):
|
||||
"""
|
||||
Initialise the engine from a :class:`client.config.Config` object.
|
||||
|
||||
Args:
|
||||
config: Application ``Config`` instance.
|
||||
user_name: Display name attached to transcriptions.
|
||||
input_device_index: Index of the audio input device to use
|
||||
(``None`` for the system default).
|
||||
"""
|
||||
self.config = config
|
||||
self.user_name = user_name
|
||||
self.input_device_index = input_device_index
|
||||
|
||||
# Mode: 'managed' (proxy) or 'byok' (direct Deepgram)
|
||||
@@ -454,7 +452,7 @@ class DeepgramTranscriptionEngine:
|
||||
text=text,
|
||||
is_final=is_final,
|
||||
timestamp=datetime.now(),
|
||||
user_name=self.user_name,
|
||||
user_name=self.config.get('user.name', 'User'),
|
||||
)
|
||||
if is_final:
|
||||
if self.final_callback:
|
||||
@@ -505,7 +503,7 @@ class DeepgramTranscriptionEngine:
|
||||
text=transcript,
|
||||
is_final=is_final,
|
||||
timestamp=datetime.now(),
|
||||
user_name=self.user_name,
|
||||
user_name=self.config.get('user.name', 'User'),
|
||||
)
|
||||
if is_final:
|
||||
if self.final_callback:
|
||||
@@ -536,10 +534,6 @@ class DeepgramTranscriptionEngine:
|
||||
pass
|
||||
self._ws = None
|
||||
|
||||
def set_user_name(self, user_name: str):
|
||||
"""Update the user name attached to future transcriptions."""
|
||||
self.user_name = user_name
|
||||
|
||||
def is_recording_active(self) -> bool:
|
||||
"""Return ``True`` if audio is currently being captured."""
|
||||
return self._is_recording
|
||||
|
||||
Reference in New Issue
Block a user