From fb7b3bbe01b57e10ec5a52ba11e991f3c60152fb Mon Sep 17 00:00:00 2001 From: DinoMalin Date: Thu, 6 Mar 2025 19:54:14 +0100 Subject: [PATCH] i fucking don't know why but it sometimes works --- ai.py | 13 ++----------- sketch/sketch.ino | 6 ++++-- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/ai.py b/ai.py index 97b0102..aee423c 100644 --- a/ai.py +++ b/ai.py @@ -93,7 +93,6 @@ def ask_ai(prompt): } } ) - print(response) data = json.loads(response.choices[0].message.content); if (not "content" in data) or (not "emotion" in data) or (not "score" in data): print("Error: AI failed to fill the corresponding fields.") @@ -101,21 +100,13 @@ def ask_ai(prompt): add_content("assistant", data["content"]) send_emotion(data["emotion"]) - # say_out_loud(data["content"]) + say_out_loud(data["content"]) print(data["emotion"]) print(data["score"]) i = 0 while True: - if i == 0: - ask_ai("Mais la terre, elle est ronde !") - elif i == 1: - ask_ai("Je suis pas d'accord du tout avec toi !") - elif i == 2: - ask_ai("Ok, tu as totalement raison, je suis completement d'accord avec toi.") - elif i == 3: - i = 0 - # ask_ai(listen_voice()) + ask_ai(listen_voice()) i += 1 diff --git a/sketch/sketch.ino b/sketch/sketch.ino index 1fae7b2..ab0eb40 100644 --- a/sketch/sketch.ino +++ b/sketch/sketch.ino @@ -1,7 +1,7 @@ #include "Face.h" #include "characters.h" -hd44780_I2Cexp lcd; // auto-detects the I2C address +hd44780_I2Cexp lcd; LCD _lcd(&lcd); Face face(_lcd); char last = 0; @@ -28,8 +28,10 @@ void loop() { if (Serial.available() > 0) { char c = Serial.read(); - if (c != last && c >= '1' && c <= '5') + if (c != last && c >= '1' && c <= '5') { + Serial.println(c); lcd.clear(); + } if (c < '1' || c > '5') // repeat c = last; else