i fucking don't know why but it sometimes works

This commit is contained in:
DinoMalin 2025-03-06 19:54:14 +01:00
parent 4f64be0b6d
commit fb7b3bbe01
2 changed files with 6 additions and 13 deletions

13
ai.py
View File

@ -93,7 +93,6 @@ def ask_ai(prompt):
} }
} }
) )
print(response)
data = json.loads(response.choices[0].message.content); data = json.loads(response.choices[0].message.content);
if (not "content" in data) or (not "emotion" in data) or (not "score" in data): if (not "content" in data) or (not "emotion" in data) or (not "score" in data):
print("Error: AI failed to fill the corresponding fields.") print("Error: AI failed to fill the corresponding fields.")
@ -101,21 +100,13 @@ def ask_ai(prompt):
add_content("assistant", data["content"]) add_content("assistant", data["content"])
send_emotion(data["emotion"]) send_emotion(data["emotion"])
# say_out_loud(data["content"]) say_out_loud(data["content"])
print(data["emotion"]) print(data["emotion"])
print(data["score"]) print(data["score"])
i = 0 i = 0
while True: while True:
if i == 0: ask_ai(listen_voice())
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())
i += 1 i += 1

View File

@ -1,7 +1,7 @@
#include "Face.h" #include "Face.h"
#include "characters.h" #include "characters.h"
hd44780_I2Cexp lcd; // auto-detects the I2C address hd44780_I2Cexp lcd;
LCD _lcd(&lcd); LCD _lcd(&lcd);
Face face(_lcd); Face face(_lcd);
char last = 0; char last = 0;
@ -28,8 +28,10 @@ void loop() {
if (Serial.available() > 0) { if (Serial.available() > 0) {
char c = Serial.read(); char c = Serial.read();
if (c != last && c >= '1' && c <= '5') if (c != last && c >= '1' && c <= '5') {
Serial.println(c);
lcd.clear(); lcd.clear();
}
if (c < '1' || c > '5') // repeat if (c < '1' || c > '5') // repeat
c = last; c = last;
else else