Files
text-adventure-llm/interface.py
Aodhan Collins 912b205699 Initial commit.
Basic docker deployment with Local LLM integration and simple game state.
2025-08-17 19:31:33 +01:00

44 lines
1.1 KiB
Python

#!/usr/bin/env python3
"""
Text interface for the LLM interaction system.
Handles input/output operations with the user.
"""
class TextInterface:
"""Handles text-based input and output operations."""
def __init__(self):
"""Initialize the text interface."""
pass
def get_user_input(self):
"""Get input from the user.
Returns:
str: The user's input text
"""
try:
user_input = input("> ")
return user_input
except EOFError:
# Handle Ctrl+D (EOF) gracefully
return "quit"
def display_response(self, response):
"""Display the LLM response to the user.
Args:
response (str): The response text to display
"""
print(response)
print() # Add a blank line for readability
def display_system_message(self, message):
"""Display a system message to the user.
Args:
message (str): The system message to display
"""
print(f"[System] {message}")
print()