in chat.py [0:0]
def get_user_input():
"""
Prompt the user to input a question.
Returns:
str: The user's input question, or special commands like 'CTRL_D'.
"""
try:
question = input("You: ").strip()
if not question:
print("Error: Input cannot be empty.")
return None
return question
except EOFError:
# Ctrl+D pressed
return 'CTRL_D'
except KeyboardInterrupt:
print("\nOperation cancelled by user.")
sys.exit(0)