""" CRANE AI - Basit Çalıştırma Scripti """ import asyncio import sys import logging from pathlib import Path # Proje kök dizinini Python path'ine ekle project_root = Path(__file__).parent sys.path.insert(0, str(project_root)) # Logging ayarları logging.basicConfig( level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s' ) logger = logging.getLogger(__name__) async def run_crane_ai(): """CRANE AI sistemini çalıştırır""" try: logger.info("🚀 CRANE AI Başlatılıyor...") # Ana sistemi import et from main import crane_system # Sistemi başlat await crane_system.initialize() # Interaktif mod logger.info("💬 Interaktif mod başlatıldı. 'quit' yazarak çıkabilirsiniz.") while True: try: # Kullanıcı girdisini al user_input = input("\n🤖 Siz: ") # Çıkış kontrolü if user_input.lower() in ['quit', 'exit', 'çıkış', 'q']: break # Boş girdi kontrolü if not user_input.strip(): continue # Sorguyu işle result = await crane_system.process_query(user_input) # Sonucu göster if "error" in result: print(f"❌ Hata: {result['error']}") else: print(f"🤖 CRANE AI: {result['response']}") # Sistem bilgilerini göster module_used = result.get('module_used', 'unknown') confidence = result.get('confidence', 0.0) exec_time = result.get('execution_time', 0.0) print(f" 📊 Modül: {module_used} | Güven: {confidence:.2f} | Süre: {exec_time:.2f}s") except KeyboardInterrupt: break except Exception as e: logger.error(f"İşlem hatası: {str(e)}") print(f"❌ Bir hata oluştu: {str(e)}") # Sistemi kapat await crane_system.shutdown() logger.info("👋 CRANE AI Kapatıldı") except Exception as e: logger.error(f"Sistem hatası: {str(e)}") print(f"❌ Sistem başlatma hatası: {str(e)}") sys.exit(1) def main(): """Ana fonksiyon""" try: asyncio.run(run_crane_ai()) except KeyboardInterrupt: logger.info("👋 Program kullanıcı tarafından sonlandırıldı") except Exception as e: logger.error(f"Beklenmeyen hata: {str(e)}") sys.exit(1) if __name__ == "__main__": main()