remove the cycle

This commit is contained in:
liangxinbing 2025-03-12 13:16:05 +08:00
parent 8755452e67
commit af8023de43
2 changed files with 40 additions and 47 deletions

16
main.py
View File

@ -6,21 +6,17 @@ from app.logger import logger
async def main(): async def main():
agent = Manus() agent = Manus()
while True:
try: try:
prompt = input("Enter your prompt (or 'exit'/'quit' to quit): ") prompt = input("Enter your prompt: ")
prompt_lower = prompt.lower()
if prompt_lower in ["exit", "quit"]:
logger.info("Goodbye!")
break
if not prompt.strip(): if not prompt.strip():
logger.warning("Skipping empty prompt.") logger.warning("Empty prompt provided.")
continue return
logger.warning("Processing your request...") logger.warning("Processing your request...")
await agent.run(prompt) await agent.run(prompt)
logger.info("Request processing completed.")
except KeyboardInterrupt: except KeyboardInterrupt:
logger.warning("Goodbye!") logger.warning("Operation interrupted.")
break
if __name__ == "__main__": if __name__ == "__main__":

View File

@ -12,20 +12,17 @@ async def run_flow():
"manus": Manus(), "manus": Manus(),
} }
while True:
try: try:
prompt = input("Enter your prompt (or 'exit' to quit): ") prompt = input("Enter your prompt: ")
if prompt.lower() == "exit":
logger.info("Goodbye!") if prompt.strip().isspace() or not prompt:
break logger.warning("Empty prompt provided.")
return
flow = FlowFactory.create_flow( flow = FlowFactory.create_flow(
flow_type=FlowType.PLANNING, flow_type=FlowType.PLANNING,
agents=agents, agents=agents,
) )
if prompt.strip().isspace():
logger.warning("Skipping empty prompt.")
continue
logger.warning("Processing your request...") logger.warning("Processing your request...")
try: try: