Files
ds_drone_bot/test.py
T

45 lines
1.3 KiB
Python
Raw Normal View History

2025-08-15 17:33:43 +01:00
from src.llm.orchestrator import DroneBot, Message # Adjust import path as needed
2025-08-18 14:43:03 +01:00
import json
2025-08-18 21:21:08 +01:00
async def terminal_chat():
2025-08-15 17:33:43 +01:00
print("🚁 DroneBot Terminal Chat")
print("Type 'exit' to quit.\n")
2025-08-11 23:16:48 +01:00
2025-08-15 17:33:43 +01:00
# Initial conversation history
history = []
2025-08-11 23:16:48 +01:00
2025-08-15 17:33:43 +01:00
# Initialize the bot
customer_metadata = {
"customer_name": "John Doe",
"customer_email": "john.doe@example.com",
"customer_phone": "+1-555-0123",
"user_id": "12345"
}
bot = DroneBot(history=[], use_openai_as_fallback=True, customer_metadata=customer_metadata)
2025-08-11 23:16:48 +01:00
2025-08-15 17:33:43 +01:00
# Get initial user input
while True:
user_input = input("👤 You: ")
if user_input.lower() in ("exit", "quit"):
print("👋 Exiting DroneBot. Goodbye!")
break
2025-08-11 23:16:48 +01:00
2025-08-15 17:33:43 +01:00
# Add user message to history
history.append(Message(role="human", content=user_input))
2025-08-11 23:16:48 +01:00
2025-08-15 17:33:43 +01:00
# Update bot's history
bot.history = history
2025-08-11 23:16:48 +01:00
2025-08-15 17:33:43 +01:00
# Get bot response
2025-08-18 21:21:08 +01:00
response = await bot.chat(user_input)
2025-08-11 23:16:48 +01:00
2025-08-15 17:33:43 +01:00
# Add bot response to history
2025-08-18 21:21:08 +01:00
history.append(Message(role="ai", content=json.dumps(response)))
2025-08-11 23:16:48 +01:00
2025-08-15 17:33:43 +01:00
# Print bot response
2025-08-18 21:21:08 +01:00
print(f"🤖 DroneBot: {response}\n")
2025-08-11 23:16:48 +01:00
if __name__ == "__main__":
2025-08-18 21:21:08 +01:00
import asyncio
asyncio.run(terminal_chat())