From 85bd75d2366aa995019ddcaac184c12a9452025c Mon Sep 17 00:00:00 2001 From: gantnocap Date: Sun, 9 Mar 2025 13:11:44 +0800 Subject: [PATCH] feat: improve input handling - Add support for 'quit' command alongside 'exit' - Update input prompt to show both exit options - Enhance empty input handling to catch both empty strings and whitespace - Replace isspace() check with more robust empty string validation - Optimize command checking by storing lowercase result - Improve code readability and user experience --- main.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index 56c9f7a..0e5c52a 100644 --- a/main.py +++ b/main.py @@ -8,11 +8,12 @@ async def main(): agent = Manus() while True: try: - prompt = input("Enter your prompt (or 'exit' to quit): ") - if prompt.lower() == "exit": + prompt = input("Enter your prompt (or 'exit'/'quit' to quit): ") + prompt_lower = prompt.lower() + if prompt_lower in ["exit", "quit"]: logger.info("Goodbye!") break - if prompt.strip().isspace(): + if not prompt.strip(): logger.warning("Skipping empty prompt.") continue logger.warning("Processing your request...")