chrisrude / oobabot

A Discord bot which talks to Large Language Model AIs running on oobabooga's text-generation-webui
MIT License
101 stars 33 forks source link

feature request: Sleep or kill phrase #54

Open wiredzax opened 1 year ago

wiredzax commented 1 year ago

Some kind of set phrase like the wake phrases that stop the bot. I don't know for sure if the stopping_strings is that setting or if there is something i'm missing.

jmoney7823956789378 commented 1 year ago

+1 here, sometimes my bot goes on a schizophrenic rampage and it would be great to have a /stop that would function similarly to the one in the webui.

chrisrude commented 1 year ago

Thanks for the suggestion!

In terms of automatic stopping, you can use either stop_markers (under discord) or stopping_strings (under oobabooga > request_params). They both do basically the same thing, as anything you add to stopping_strings will be propagated to stop_markers internally.

For /stop, are you looking for what's in the web ui -- to stop a bot's immediate response generation... or are you looking to "time out" the bot and not have it respond automatically for some period?

I've been thinking of a /timeout command might be useful, which would tell the bot to just not respond for a period of time.

jmoney7823956789378 commented 1 year ago

Thanks for the suggestion!

In terms of automatic stopping, you can use either stop_markers (under discord) or stopping_strings (under oobabooga > request_params). They both do basically the same thing, as anything you add to stopping_strings will be propagated to stop_markers internally.

For /stop, are you looking for what's in the web ui -- to stop a bot's immediate response generation... or are you looking to "time out" the bot and not have it respond automatically for some period?

I've been thinking of a /timeout command might be useful, which would tell the bot to just not respond for a period of time.

My intended use is something along the lines of:

(Bot is typing a huge 500 token response filled with nothing meaningful) (I type /stop) (oobabot calls /api/v1/stop-stream on oobabooga server) https://github.com/oobabooga/text-generation-webui/blob/main/extensions/api/blocking_api.py#L97 (Bot stops ALL generation)

jmoney7823956789378 commented 1 year ago

Adding to that, a few lines down there is also a _continue function in the same file: https://github.com/oobabooga/text-generation-webui/blob/3c076c3c8096fa83440d701ba4d7d49606aaf61f/extensions/api/blocking_api.py#L77C1-L77C1

wiredzax commented 1 year ago

I think it would be better as a set able word like the wake words just in reverse. I run a stable diffusion bot on top of the text gen bot, so i can only use one set of / commands at a time. i can either have the /lobotomize or my /draw command with ever more options that what are present in oobabot.

jmoney7823956789378 commented 1 year ago

@chrisrude I've very roughly implemented my own /stop command into bot_commands.py and ooba_client.py (with my limited knowledge) and I'm wondering how far into it you are. I can make a PR now, but my current implementation is simply a hardcoded URL to my oobabooga server, so it wouldn't work out of the box. I'm sure I could bash the keyboard and eventually I'll have it pulling the host from the config.yml like it should, but I just thought I'd ask. Current issues with my implementation are:

chrisrude commented 1 year ago

Feel free to have a stab at it if you like! I was rushing to get other features out so haven't started on this yet. Or if you want you could also just send over a work in progress PR and then I can polish off things you're unsure about.

Thanks for your help!

jmoney7823956789378 commented 1 year ago

Feel free to have a stab at it if you like! I was rushing to get other features out so haven't started on this yet. Or if you want you could also just send over a work in progress PR and then I can polish off things you're unsure about.

Thanks for your help!

I sure gave it a stab! https://github.com/chrisrude/oobabot/pull/62 feel free to berate me for my code's mediocrity.

chrisrude commented 1 year ago

Still interested in this feature, and it's one of the priorities to be implemented sooner rather than later. My time has been split between a few projects recently, though, so it may still be a few weeks before I'm able to get it more packaged.

@jmoney7823956789378 if you're comfortable with a larger change, the main work that needs to be done from the PR above is:

In particular, I'm curious about testing the case where there are multiple replies in the queue and /stop is invoked. I would hope it would simply cancel the in-progress request without affecting the others, but it's also possible that something would break there.

You'd be totally welcome to step in more if you're interested, if not I'll work on getting to it in the next few updates. Those may be somewhat delayed to to commitments I have on other projects.

Thanks again for all your help so far!

jmoney7823956789378 commented 1 year ago
  • add a configuration setting for the synchronous API port, defaulting to 5000, in the oobabooga section of the config.yml.
  • testing the change to make sure things don't break

In all honesty I'm totally clueless about how the settings are pulled from config.yml, and I also have some important stuff coming up that might keep me off the project for a few weeks.

In particular, I'm curious about testing the case where there are multiple replies in the queue and /stop is invoked. I would hope it would simply cancel the in-progress request without affecting the others, but it's also possible that something would break there.

So far I believe it stops only the current message in queue, so maybe it should be renamed to /cancel :)

chrisrude commented 1 year ago

No worries! I appreciate having non-github priorities as well. :)

Thanks again for all your help so far, and don't worry I'll get this in at some point. :)

dakky221 commented 1 year ago

So... did you get to this, is now /timeout a reality or still not? People in my server are complaining it's talking too much and responding to everyone once it starts, timeout command is necessary to make it stop talking unless addressed (tagged) again.

jmoney7823956789378 commented 1 year ago

So... did you get to this, is now /timeout a reality or still not? People in my server are complaining it's talking too much and responding to everyone once it starts, timeout command is necessary to make it stop talking unless addressed (tagged) again.

You might be better off disabling unsolicited replies.