Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A way to stop executing of "y -100" without killing the program #1472

Closed
1 task done
james-coder opened this issue Apr 15, 2023 · 11 comments
Closed
1 task done

A way to stop executing of "y -100" without killing the program #1472

james-coder opened this issue Apr 15, 2023 · 11 comments
Labels
enhancement New feature or request

Comments

@james-coder
Copy link

Duplicates

  • I have searched the existing issues

Summary 💡

I'd like to press some keyboard shortcut like "Ctrl-Y" (Not Ctrl-C to kill the process, not Ctrl-Z to background it.)

GPT-4 tells me that the keyboard module should work in Windows and Mac.

Example:

import keyboard
import time

pause = False

def toggle_pause(e):
    global pause
    # Check if the 'ctrl' modifier is pressed
    if e.event_type == 'down' and keyboard.is_pressed('ctrl'):
        pause = not pause
        keyboard.suppress_event(e)  # Suppress the key event if 'ctrl' is pressed

# Bind the 'y' key to the toggle_pause function
keyboard.on_press_key('y', toggle_pause)

print("Press Ctrl-Y to pause and resume the program.")

while True:
    if not pause:
        print("Running...")
    else:
        print("Paused...")
    time.sleep(1)

(You have to be sudo to use "keyboard" unfortunately... Which seems like a bad idea. Also, it will break your venv to run as sudo.)

Maybe similar to:

Examples 🌈

Enter 'y' to authorise command, 'y -N' to run N continuous commands, 'n' to exit program, or enter feedback for AGI-GPT...
Input:y -1000
...
(AutoGPT starts saying dumb things and it would be nice to give it feedback...)
...
(Ctrl-Y)
Ctrl-Y pressed. Stopping previous y -1000
Enter 'y' to authorise command, 'y -N' to run N continuous commands, 'n' to exit program, or enter feedback for AGI-GPT...
Input: Don't say the things you were saying.

Motivation 🔦

Wasting OpenAI $$$ is terrible.

@richbeales
Copy link
Contributor

What's wrong with Ctrl-C ?

@normanlove222
Copy link

What's wrong with Ctrl-C ?

It stops the program completely and it has to restart from scratch. The brilliant idea suggested here allows for the code just to pause to receive input to consider, and continue from where it left off. Depending on where it is and on what task, Control C may flush hours of work down the drain just to start over again

@JoeKanaan0
Copy link

JoeKanaan0 commented Apr 15, 2023

I think it could be solved if the memory of the AI doesn't get wiped out every time you start the program. That way, CTRL+C wouldn't cause any problems and you will be able to shutdown the AI and then continue where you left off. But the code currently doesn't do that.

@Pwuts
Copy link
Member

Pwuts commented Apr 18, 2023

Related to #150

@ram-sh
Copy link

ram-sh commented Apr 29, 2023

is there a working solution for the issue?

@Boostrix
Copy link
Contributor

Boostrix commented May 1, 2023

I think it could be solved if the memory of the AI doesn't get wiped out every time you start the program. That way, CTRL+C wouldn't cause any problems and you will be able to shutdown the AI and then continue where you left off. But the code currently doesn't do that.
is there a working solution for the issue?

There seem to be at least 5+ different issues related to the underlying idea of being able to suspend/resume or terminate/restart execution of an agent/sub-agent while retaining at least some of its intermediate state: #3382 (comment)

@Boostrix
Copy link
Contributor

Hi, just a short update - thanks for taking the time to update your PR, your PR was today discussed on Discord by several devs and it's being assigned to be reviewed right now!

So, given that there seem to be at least 5+ different PRs in the pipeline currently using similar but still a different method, it is likely that we're going to take parts from each and every one of these PRs, to ensure that the feature is well-aligned with the ongoing re-arch effort.

This means, you will end up in the credits automagically - but won't have to do any more work from now on.

If there are remaining questions, someone is going to contact you, the PR is being reviewed by @gravelBridge

@gravelBridge
Copy link
Contributor

Hello! Thank you so much for your contribution and feature suggestion! I have finished implementing our version of this feature here: #4230. Once again, thank you!

@github-project-automation github-project-automation bot moved this from 🔖 Ready to ✅ Done in AutoGPT development kanban May 16, 2023
@jacobgrass
Copy link

This was fixed in #4230. The feature works in 4.0.0. However, in the most recent stable releases, it has not worked.

@Boostrix
Copy link
Contributor

Boostrix commented Jul 9, 2023

if you've got access to autogpt 4.0, I would be willing to pay ...

@Pwuts
Copy link
Member

Pwuts commented Jul 17, 2023

Should be fixed again by #4997, which will be merged into master as a part of #4799. :')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Archived in project
10 participants