Skip to content

Commit 499aa97

Browse files
committed
Model differential response support.
1 parent 20579ef commit 499aa97

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

lidya/core.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,21 @@
2323
sys.path.append("./")
2424

2525
# Load configuration
26+
print('[*] Loading config... ')
2627
CONF = config.Config("./config")
2728

2829
# Init STT & TTS
30+
print('[*] Loading STT & TTS... ')
2931
r = sr.Recognizer()
3032
tts = tts.TTS(CONF.get_lang(), CONF.get_tts_model())
3133

3234
# Load plugins:
35+
print('[*] Loading plugins... ')
3336
pm = pluginmanager.PluginManager()
37+
pm.load_plugins()
3438

3539
# Init LLM
40+
print('[*] Loading LLM... ')
3641
llm = llm_con.Connector(
3742
CONF.get_main_model(),
3843
CONF.get_main_service(),
@@ -41,6 +46,7 @@
4146
)
4247

4348
# Main func
49+
print('[*] Starting... ')
4450
def listen_and_repeat(last_communication):
4551
"""Main listen & repeat function"""
4652
with sr.Microphone() as source:
@@ -49,7 +55,7 @@ def listen_and_repeat(last_communication):
4955

5056
#user_message = "ok lydia execute la commande 'weather' pour récupérer la météo."
5157

52-
if (time.time() - last_communication) < 5:
58+
if (time.time() - last_communication) < 10:
5359
present = True
5460
message = user_message
5561
else:
@@ -96,7 +102,11 @@ def listen_and_repeat(last_communication):
96102
)
97103

98104
print("[*] Generating audio... ")
99-
tts.play_generate_audio(llm_result["message"])
105+
if type(llm_result) == dict and "message" in llm_result.keys():
106+
tts.play_generate_audio(llm_result["message"])
107+
else:
108+
playsound('./lidya/ressources/sounds/fail_blip.mp3')
109+
tts.play_generate_audio(llm_result)
100110

101111
print("[*] Process finished. ")
102112
last_communication = time.time()

lidya/libs/pluginmanager.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,8 @@ def process_actions(self, actions):
3030
if action["args"] == {}:
3131
result = self.execute_plugin_action(action_name)
3232
else:
33-
print(action)
3433
mapping = {action['name']: action['value']}
3534

36-
print(mapping)
3735
result = self.execute_plugin_action(action_name, args=mapping)
3836

3937
if result is not None:
@@ -59,6 +57,4 @@ def load_plugins(self):
5957

6058
plugin_manager_json.append(plugin_json_conf)
6159

62-
print(plugin_manager_json)
63-
6460
return plugin_manager_json

0 commit comments

Comments
 (0)