|
|
"""
|
|
|
CRANE AI - Basit Çalıştırma Scripti
|
|
|
"""
|
|
|
|
|
|
import asyncio
|
|
|
import sys
|
|
|
import logging
|
|
|
from pathlib import Path
|
|
|
|
|
|
|
|
|
project_root = Path(__file__).parent
|
|
|
sys.path.insert(0, str(project_root))
|
|
|
|
|
|
|
|
|
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...")
|
|
|
|
|
|
|
|
|
from main import crane_system
|
|
|
|
|
|
|
|
|
await crane_system.initialize()
|
|
|
|
|
|
|
|
|
logger.info("💬 Interaktif mod başlatıldı. 'quit' yazarak çıkabilirsiniz.")
|
|
|
|
|
|
while True:
|
|
|
try:
|
|
|
|
|
|
user_input = input("\n🤖 Siz: ")
|
|
|
|
|
|
|
|
|
if user_input.lower() in ['quit', 'exit', 'çıkış', 'q']:
|
|
|
break
|
|
|
|
|
|
|
|
|
if not user_input.strip():
|
|
|
continue
|
|
|
|
|
|
|
|
|
result = await crane_system.process_query(user_input)
|
|
|
|
|
|
|
|
|
if "error" in result:
|
|
|
print(f"❌ Hata: {result['error']}")
|
|
|
else:
|
|
|
print(f"🤖 CRANE AI: {result['response']}")
|
|
|
|
|
|
|
|
|
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)}")
|
|
|
|
|
|
|
|
|
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() |