babyagi icon indicating copy to clipboard operation
babyagi copied to clipboard

Stop code and give human feedback

Open juanfradb opened this issue 1 year ago • 6 comments

It will be great if with a command or keyboard I can stop babyagi and provide some feedback

juanfradb avatar Apr 13 '23 22:04 juanfradb

yah. And it just keeps running and runnning. Where does it end and how does it summarize all the findings up?

Hoodie2389 avatar Apr 16 '23 05:04 Hoodie2389

Add the following code to your babyagi.py file. It will turn the continuous mode off and prompt you at the end of each task to modify the task, proceed, or exit.

Add user interactions to the task list

def user_interaction():
    while True:
        print("\033[96m\033[1m" + "\n*****USER INPUT*****\n" + "\033[0m\033[0m")
        print("Select an option:")
        print("1. Modify tasks")
        print("2. Proceed")
        print("3. Stop and exit")
        user_input = input("Enter the number corresponding to your choice: ")

        if user_input == "1":
            return "modify_tasks"
        elif user_input == "2":
            return "proceed"
        elif user_input == "3":
            return "stop"
        else:
            print("Invalid input. Please enter a valid number.")

DonTido avatar Apr 19 '23 08:04 DonTido

where do we put user_interaction() to use in the main code?

Hoodie2389 avatar Apr 19 '23 09:04 Hoodie2389

Add it before the Main Loop. Screenshot 2023-04-19 at 8 28 03 AM

DonTido avatar Apr 19 '23 15:04 DonTido

I forgot to mention to add the following section. You will also need to add the following code to the end of the Main Loop.

Step 6: User interaction

    user_choice = user_interaction()
    if user_choice == "modify_tasks":
        new_task_name = input("Enter the new task to be added: ")
        new_task = {
            "task_id": tasks_storage.next_task_id(),
            "task_name": new_task_name
        }
        tasks_storage.append(new_task)
        prioritization_agent()
    elif user_choice == "stop":
        break

The whole last section should look like this.

Screenshot 2023-04-19 at 9 15 24 AM

DonTido avatar Apr 19 '23 16:04 DonTido

Something akin to a "Pause" Button would be appreciated

AllyourBaseBelongToUs avatar May 12 '24 11:05 AllyourBaseBelongToUs