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
This commit is contained in:
gantnocap 2025-03-09 13:11:44 +08:00
parent e6ed98e53c
commit 85bd75d236

View File

@ -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...")