remove the cycle
This commit is contained in:
parent
8755452e67
commit
af8023de43
26
main.py
26
main.py
@ -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: ")
|
||||||
prompt = input("Enter your prompt (or 'exit'/'quit' to quit): ")
|
if not prompt.strip():
|
||||||
prompt_lower = prompt.lower()
|
logger.warning("Empty prompt provided.")
|
||||||
if prompt_lower in ["exit", "quit"]:
|
return
|
||||||
logger.info("Goodbye!")
|
|
||||||
break
|
logger.warning("Processing your request...")
|
||||||
if not prompt.strip():
|
await agent.run(prompt)
|
||||||
logger.warning("Skipping empty prompt.")
|
logger.info("Request processing completed.")
|
||||||
continue
|
except KeyboardInterrupt:
|
||||||
logger.warning("Processing your request...")
|
logger.warning("Operation interrupted.")
|
||||||
await agent.run(prompt)
|
|
||||||
except KeyboardInterrupt:
|
|
||||||
logger.warning("Goodbye!")
|
|
||||||
break
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
61
run_flow.py
61
run_flow.py
@ -12,41 +12,38 @@ async def run_flow():
|
|||||||
"manus": Manus(),
|
"manus": Manus(),
|
||||||
}
|
}
|
||||||
|
|
||||||
while True:
|
try:
|
||||||
|
prompt = input("Enter your prompt: ")
|
||||||
|
|
||||||
|
if prompt.strip().isspace() or not prompt:
|
||||||
|
logger.warning("Empty prompt provided.")
|
||||||
|
return
|
||||||
|
|
||||||
|
flow = FlowFactory.create_flow(
|
||||||
|
flow_type=FlowType.PLANNING,
|
||||||
|
agents=agents,
|
||||||
|
)
|
||||||
|
logger.warning("Processing your request...")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
prompt = input("Enter your prompt (or 'exit' to quit): ")
|
start_time = time.time()
|
||||||
if prompt.lower() == "exit":
|
result = await asyncio.wait_for(
|
||||||
logger.info("Goodbye!")
|
flow.execute(prompt),
|
||||||
break
|
timeout=3600, # 60 minute timeout for the entire execution
|
||||||
|
)
|
||||||
flow = FlowFactory.create_flow(
|
elapsed_time = time.time() - start_time
|
||||||
flow_type=FlowType.PLANNING,
|
logger.info(f"Request processed in {elapsed_time:.2f} seconds")
|
||||||
agents=agents,
|
logger.info(result)
|
||||||
|
except asyncio.TimeoutError:
|
||||||
|
logger.error("Request processing timed out after 1 hour")
|
||||||
|
logger.info(
|
||||||
|
"Operation terminated due to timeout. Please try a simpler request."
|
||||||
)
|
)
|
||||||
if prompt.strip().isspace():
|
|
||||||
logger.warning("Skipping empty prompt.")
|
|
||||||
continue
|
|
||||||
logger.warning("Processing your request...")
|
|
||||||
|
|
||||||
try:
|
except KeyboardInterrupt:
|
||||||
start_time = time.time()
|
logger.info("Operation cancelled by user.")
|
||||||
result = await asyncio.wait_for(
|
except Exception as e:
|
||||||
flow.execute(prompt),
|
logger.error(f"Error: {str(e)}")
|
||||||
timeout=3600, # 60 minute timeout for the entire execution
|
|
||||||
)
|
|
||||||
elapsed_time = time.time() - start_time
|
|
||||||
logger.info(f"Request processed in {elapsed_time:.2f} seconds")
|
|
||||||
logger.info(result)
|
|
||||||
except asyncio.TimeoutError:
|
|
||||||
logger.error("Request processing timed out after 1 hour")
|
|
||||||
logger.info(
|
|
||||||
"Operation terminated due to timeout. Please try a simpler request."
|
|
||||||
)
|
|
||||||
|
|
||||||
except KeyboardInterrupt:
|
|
||||||
logger.info("Operation cancelled by user.")
|
|
||||||
except Exception as e:
|
|
||||||
logger.error(f"Error: {str(e)}")
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
Loading…
x
Reference in New Issue
Block a user