39 lines
1.0 KiB
Python
39 lines
1.0 KiB
Python
# terminal_chat.py
|
|
from src.llm.orchestrator import DroneBot, Message # Adjust import path as needed
|
|
|
|
async def terminal_chat():
|
|
print("🚁 DroneBot Terminal Chat")
|
|
print("Type 'exit' to quit.\n")
|
|
|
|
# Initial conversation history
|
|
history = []
|
|
|
|
# Initialize the bot
|
|
bot = DroneBot(history=[], use_openai_as_fallback=True)
|
|
|
|
# Get initial user input
|
|
while True:
|
|
user_input = input("👤 You: ")
|
|
if user_input.lower() in ("exit", "quit"):
|
|
print("👋 Exiting DroneBot. Goodbye!")
|
|
break
|
|
|
|
# Add user message to history
|
|
history.append(Message(role="human", content=user_input))
|
|
|
|
# Update bot's history
|
|
bot.history = history
|
|
|
|
# Get bot response
|
|
response = bot.chat(user_input)
|
|
|
|
# Add bot response to history
|
|
history.append(Message(role="ai", content=response["final_message"]))
|
|
|
|
# Print bot response
|
|
print(f"🤖 DroneBot: {response['final_message']}\n")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
terminal_chat()
|