Update main.py

This commit is contained in:
FatihMakes authored and GitHub committed 2025-12-15 18:58:00 +03:00
1 parent 4f9dc8edaa
commit f19f516f25
1 file changed
+5 -12
+5 -12
View File
@@ -2,8 +2,8 @@ import asyncio
import threading
from voice_player import VoiceImagePlayer, edge_speak
from speech_to_text import record_voice
#from recognition import record_voice
from groq_ai import get_response
from aircraft_module import handle_aircraft_command
async def get_voice_input():
return await asyncio.to_thread(record_voice)
@@ -15,26 +15,18 @@ async def ai_loop(player):
if not user_text:
continue
print("User:", user_text)
lowered = user_text.lower().strip()
if lowered in ["exit", "quit", "goodbye", "bye", "stop","mute"]:
edge_speak("Goodbye sir.", player)
player.root.after(300, player.root.destroy)
break
handled = handle_aircraft_command(user_text, player)
if handled:
continue
response = get_response(user_text)
print("AI:", response)
edge_speak(response, player)
player.write_log(f"You: {user_text}")
player.write_log(f"AI: {response}")
def main_loop():
print("")
player = VoiceImagePlayer("face.png", size=(900, 900))
def thread_target():
@@ -43,5 +35,6 @@ def main_loop():
threading.Thread(target=thread_target, daemon=True).start()
player.root.mainloop()
if __name__ == "__main__":
main_loop()