Skip to content

Commit 05c6429

Browse files
fix: merge metadata from audio into metadata from asr_result
1 parent bccbe82 commit 05c6429

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

interface/ten_ai_base/asr.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def __init__(self, name: str):
4646
self.stopped = False
4747
self.ten_env: AsyncTenEnv = None # type: ignore
4848
self.session_id = None
49-
self.metadata = None
49+
self.metadata: dict | None = None
5050
self.finalize_id = None
5151
self.sent_buffer_length = 0
5252
self.buffered_frames = asyncio.Queue[AudioFrame]()
@@ -209,8 +209,11 @@ async def send_asr_result(self, asr_result: ASRResult) -> None:
209209
"""
210210
asr_result.id = self.uuid
211211
# Only set metadata if asr_result doesn't already have metadata and self.metadata is available
212-
if self.metadata is not None and not asr_result.metadata:
213-
asr_result.metadata = self.metadata
212+
if self.metadata is not None:
213+
if not asr_result.metadata:
214+
asr_result.metadata = self.metadata
215+
else:
216+
asr_result.metadata.update(self.metadata)
214217

215218
# If this is the first result and there is a timestamp for the first
216219
# audio sent, calculate and send TTFW.

manifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"type": "system",
33
"name": "ten_ai_base",
4-
"version": "0.7.3",
4+
"version": "0.7.34",
55
"package": {
66
"include": [
77
"manifest.json",
@@ -18,4 +18,4 @@
1818
}
1919
],
2020
"api": {}
21-
}
21+
}

0 commit comments

Comments
 (0)