From 6afb7f9f12e0d4453f8e7c48d94c36e3716feb27 Mon Sep 17 00:00:00 2001 From: Dmytro Bogovych Date: Tue, 22 Aug 2023 18:15:51 +0300 Subject: [PATCH] - use cached audio before backend's one --- src/agent_gsm.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/agent_gsm.py b/src/agent_gsm.py index d049e08..8de470b 100644 --- a/src/agent_gsm.py +++ b/src/agent_gsm.py @@ -312,14 +312,14 @@ def run_caller_task(t): os.remove(LOADED_AUDIO) audio_id = t["audio_id"] - if not BackendServer.load_audio(audio_id, LOADED_AUDIO): - utils.log_error(f'Failed to load reference audio with ID {audio_id}.') - if CACHE.get_reference_audio(audio_id, LOADED_AUDIO): - utils.log(f' Found in cache.') - else: - utils.log(f' Failed to find the audio in cache.') - raise RuntimeError(f'Reference audio (ID: {audio_id}) is not available.') + if CACHE.get_reference_audio(audio_id, LOADED_AUDIO): + utils.log(f'Reference audio {audio_id} found in cache.') else: + utils.log(f'Reference audio {audio_id} not found in cache.') + if not BackendServer.load_audio(audio_id, LOADED_AUDIO): + utils.log_error(f'Failed to load reference audio with ID {audio_id}.') + raise RuntimeError(f'Reference audio (ID: {audio_id}) is not available.') + # Cache loaded audio CACHE.add_reference_audio(audio_id, LOADED_AUDIO)