Initial commit.
Basic docker deployment with Local LLM integration and simple game state.
This commit is contained in:
44
interface.py
Normal file
44
interface.py
Normal file
@@ -0,0 +1,44 @@
|
||||
#!/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()
|
||||
Reference in New Issue
Block a user