Releases: chrisrude/oobabot
v0.2.3
Release v.0.2.3
Note: version 0.2.2 only updated oobabot-plugin, not oobabot. This
shows changes to oobabot since the prior release, v0.2.1.
What's Changed
Mainly a bugfix update for 0.2.1, with a few fixes and configuration
parameters.
New Features
- Option to disable unsolicited replies entirely
Unsolicited replies are still enabled by default, but you can now disable them entirely by changing this setting in your config.yml:
# If set, the bot will not reply to any messages that do not @-mention it or include a
# wakeword. If unsolicited replies are disabled, the unsolicited_channel_cap setting will
# have no effect.
# default: False
disable_unsolicited_replies: true
The objective of this change is to support cases where
unsolicited replies are not desired, such as when the bot is used in a
channel with a high volume of messages.
Bug Fixes / Tech Improvements
-
Unicode logging reliability fix ooba_client.py
Unicode bugs in oobabooga seem to be a moving target, so
this fix gates the fix applied in 0.2.1 to only be applied
in cases where oobabooga is known to be broken. -
Security fix: Bump aiohttp from 3.8.4 to 3.8.5
Update dependency aiohttp to v3.8.5. This fixes a security
issue in aiohttp. On a quick scan it doesn't seem to be something
a user could exploit within oobabot, but better to update anyway. -
Preserve newlines when prompting the bot
In some cases the whitespace in user messages is important. One case is
described in the issue 76, reported by @xydreen.When sending a prompt to the bot, we will now preserve any newlines
that the bot itself had generated in the past.We will still strip newlines from messages from user-generated messages,
as otherwise they would have the ability to imitate our prompt format.
This would let users so inclined to fool the bot into thinking a
message was sent by another user, or even itself.
Full Changelog
v0.2.1
Release v.0.2.1
What's Changed
True to the version, his is a small bug-fix release. I had been wanting to get a few more small features in, but a few urgent bugs came up, and I wanted to get them out to users as soon as possible. My priority is to make sure things keep working well first, before adding new features.
New Contributors
This is the first release to feature pull requests from the community! Thanks to everyone who took the time out to make oobabot
better!
- @clintkittiesmeow (with help from @jmoney7823956789378) made their first contribution in PR 61
- @harlyh made their first contribution in PR 66
New Features
- Stable Diffusion Parameters in Prompt by @clintkittiesmeow
A discord user, with your permission, can now customize pretty much any aspect of Stable Diffusion generation within the prompt. For example:
Make me a picture of a cat wearing a hat width=512 height=512 steps=10 seed=10
The syntax is just <param>=<value>
and you can include as many as you want.
A parameter must pass two checks before they are passed to Stable Diffusion:
- It must be included in the new
user_override_params
setting - It must have a default in the
request_params
dictionary. We use this to know the type of the parameter, and to provide a default value if the user doesn't specify one.
The new yaml setting for user_override_params
looks like this, and will enable these settings by default:
# These parameters can be overridden by the Discord user by including them in their image
# generation request. The format for this is: param_name=value This is a whitelist of
# parameters that can be overridden. They must be simple parameters (strings, numbers,
# booleans), and they must be in the request_params dictionary. The value the user inputs
# will be checked against the type from the request_params dictionary, and if it doesn't
# match, the default value will be used instead. Otherwise, this value will be passed
# through to Stable Diffusion without any changes, so be mindful of what you allow here.
# It could potentially be used to inject malicious values into your SD server. For
# example, steps=1000000 could be bad for your server.
user_override_params:
- cfg_scale
- enable_hr
- model
- negative_prompt
- sampler_name
- seed
- height
- width
Thanks to @jmoney7823956789378 and @clintkittiesmeow for the idea and the initial implementation! It would not have happened without you. :)
Bug Fixes / Tech Improvements
- Fixed the Unicode logging issue in ooba_client.py
A Windows 11 update has reportedly caused an issue with the --log-all-the-things
parameter. This fix should resolve that issue. Thanks @harlyh for the quick fix.
- Fixed an urgent bug with streaming responses
When using streaming responses, the bot would not be able to see its own messages in the history. This was due to a mistake in how the messages were edited when updates came in. This is now fixed.
- Removed the ai-generated keywords feature, which was never finished and didn't really work right. It would cause issues with the new Stable Diffusion keyword parsing, so it's better to just remove it for now.
Full Changelog
Version 0.2.0!
Release v.0.2.0
Long time since the last release, but tons of work!
New Features
Backend changes for AUDIO SUPPORT 🥳 (coming soon)
This release includes a lot of work to support audio
channels. This still needs to be documented and packaged,
but it is a thing that works! Look for full support in
version 0.2.1, but here's a preview of what's coming:
- oobabot will be able to join audio channels using the
/join_voice
command - it will transcribe audio from the channel, recording which user said what
- it will listen to wake-words, and respond using voice synthesis
- if you're using
oobabot-plugin
, you'll get a pretty transcript of the
conversation
This has been a ton of work, and I'm eager to get to putting on the finishing
touches and get it out. In the meantime, I wanted to release the now-unified
backend, so that I can make sure that it is stable, so that I can focus on
polishing the audio work. Also, a few important bugs have been reported in
the meantime, and I don't want to hold those back.
Add new .yaml settings
stream_responses_speed_limit
When in "streaming" mode (i.e. when stream_responses is set to True), this will limit the
rate at which we update the streaming message in Discord. We need this setting because Discord has rate-limiting logic, and if we send updates "too fast" then it will slow down our updates drastically, which will appear as jerky streaming.
This value is the minimum delay in seconds in between updates. That is -- we will update Discord no more than once this number of seconds. The updates may come slower than this, perhaps on systems that take a long time to generate tokens. It's only guaranteed that they won't be any faster than this.
Previously, this value was hard-coded to 0.5. Now the default is 0.7, which was determined by user testing. Thanks to @jmoney7823956789378 for helping make this happen!
discrivener_location
and discrivener_model_location
These are new settings to add voice support to oobabot. Voice support means that the bot
can join voice chat channels, transcribe what is said, hear wakewords, and generate voice
responses in those channels. All of the audio processing -- text to speech, and speech to
text -- is handled in a binary called "discrivener", whose source lives at github.com/chrisrude/discrivener.
I've tested this to work on Linux and OSX, but there is still more work to do in documenting and packaging the software. So for now, these settings are blank by default, which will leave oobabot in text-only mode, as it has been.
command_lobotomize_response
A user noticed that there was no setting to customize the text that gets shown when you use the /lobotomize
command. Whoops! Now here it is. This is of particular interest because the bot will see this text after a lobotomize occurs, so if you have specific character styling you want to keep it from getting confused about, then you might want to put in custom text of your choosing here.
You can also use variables {AI_NAME}
and {USER_NAME}
to represent the name of the AI, and the name of the user who ran the /lobotomize
command.
Show an error if a custom .yaml file could not be loaded
Previously, we would ignore any errors that occurred when loading a custom .yaml file, and just proceed with defaults if we could. Now, we will show an error message to the user displaying the full path to the yaml file we could not load, and the bot will not start.
This should help users self-diagnose a number of configuration issues, such as accidentally having a syntax error in their .yaml file.
Bug Fixes / Tech Improvements
-
Fix bug 38: the bot will now only
mark messages as replies if it was directly mentioned (by an @-mention or keyword). Also,
if it is configured to reply across several messages, it will only mark the first message
in the series as a reply. This reduces notification noise to users when using mobile clients. -
Increase default token space back to 2048. Users who have not set a custom a token space value (aka
truncation_length
) will just have this updated automatically. -
Add new oobabooga request params:
"epsilon_cutoff",
"eta_cutoff",
"tfs",
"top_a",
"mirostat_mode",
"mirostat_tau", and
"mirostat_eta" -
If the user forgets to enable either
SERVER MEMBERS INTENT
orMESSAGE CONTENT INTENT
for their bot's Discord account, show a specific error message letting them know.
Full Changelog
v0.1.9
Release v.0.1.9
Very minor release, mainly want to get this out to support a big pending update in the new Oobabot-plugin GUI for Oobaboog's Text Generation WebUI.
New Features
Unsolicited Reply Cap
There's a new unsolicited_channel_cap
option in
discord
section of config.yml
. It does this:
FEATURE PREVIEW: Adds a limit to the number of channels
the bot will post unsolicited messages in at the same
time. This is to prevent the bot from being too noisy
in large servers.
When set, only the most recent N channels the bot has
been summoned in will have a chance of receiving an
unsolicited message. The bot will still respond to
@-mentions and wake words in any channel it can access.
Set to 0 to disable this feature.
Breaking Changes
Remove deprecated command-line options
The following CLI arguments have been removed:
diffusion_steps
image_height
image_width
stable_diffusion_sampler
sd_negative_prompt
sd_negative_prompt_nsfw
All of these settings are still changeable via the config file.
If you don't have a config file, you can generate one first on your previous version by using:
``oobabot [all your normal CLI arguments] --generate-config > config.yml
From the directory you run oobabot from. Now all your CLI arguments are stored in the yml file,
and you don't need to pass them anymore.
Bug Fixes / Tech Improvements
-
add a method to generate / load yml config files from another package
-
Discord's own logs are now included in the standard logging output, in a purple background
Full Changelog
v0.1.8
Release v.0.1.8
Lots of bugfixes in this release, and a lot of behind-the-scenes work to support a proper plugin to Oobabooga. Coming Soon (tm)!
However, there a number of small new features as well.
New Features
Reading Personas from a File
In config.yml
, in persona
> persona_file
, you can now specify a path to a .yml, .json or .txt file containing a persona.
This file can be just a single string, a json file in the common "tavern" formats, or a yaml file in the Oobabooga format.
With a single string, the persona will be set to that string. Otherwise, the ai_name and persona will be overwritten with the values in the file. Also, the wakewords will be extended to include the character's own name.
Regex-based message splitting
This new setting is in oobabooga
> message_regex
.
Some newer chat-specific models are trained to generate specific delimiters to separate their response into individual messages.
This adds a setting to tell the bot what regex to use to split such responses into individual messages.
If this is set, it will only effect how message-splitting happens, not whether it happens. By default, the bot will still split messages. But if stream_responses
or dont_split_responses
is enabled, this setting will be ignored, as the messages won't be split anyway.
--invite-url
command line option
This will generate an invite URL for the bot, and print it to the console. This is useful for when you have a new bot, or want to generate a new invite URL to add it to a new server. It will also automatically be printed if we notice the bot is listening on zero servers.
Configurable logging level
In config.yml
, in discord
> log_level
, you can now specify the logging level.
Breaking Changes
Reminder that the deprecated CLI methods are going away soon.
Bug Fixes / Tech Improvements
-
replace
<@___user_id___>
with the user's display name in history. This would confuse the AI, and leak syntax into its regular chat. -
Add "draw me" to the list of words that will trigger a picture
-
Inline stop tokens
With this change, we'll now look for stop tokens even if they're not on a separate line.
Also, automatically add anything fromoobabot
>request_params
>stopping_strings
into the list of stop tokens to look for. -
Don't allow the bot to @-mention anyone but the user who it's replying
to. This is to prevent users from tricking the bot into pinging broad
groups, should the admin have granted them permission to do so.
@-mentions will still work when used via the /say command, which I am
presuming will be used by trusted users -
The bot will now mark its responses to @-mentions or keywords by showing an explicit reply in Discord. When this happens, the bot will not see any history "after" the summon. Unsolicited replies will see the full message history, and will not show an explicit reply. This is to help make it clear when the bot is responding to a specific message, and when it's responding to the channel in general.
-
turn 'token space too small' message from error into warning
This is to allow users to crank it super high if they want, and let messages be dropped if they run out of space.
Full Changelog
v0.1.7
Release v.0.1.7
New Features
-
Configure All the Things
You can now configure every setting passed to Oobabooga
and Stable Diffusion, and more, via a config.yml file. -
Streaming Responses
That's right! It's a little janky, but you can now have the
bot stream its response into a single message. Just pass
the--stream-responses
flag, or enable thestream_responses
flag in the config.yml file.This works by continuously editing the bot's response message.
-
Stop Markers
Some models were generating tokens that were appearing in the chat
output. There is a new config setting,stop_markers
. We'll watch
the response for these markers, and if we see any one on its own line
we'll stop responding.
# A list of strings that will cause the bot to stop generating a response when
# encountered.
# default: ['### end of transcript ###<|endoftext|>', '<|endoftext|>']
stop_markers:
- '### End of Transcript ###<|endoftext|>'
- <|endoftext|>
-
Extra Prompt Text for Stable Diffusion
You can now add extra prompt text to every prompt sent to Stable Diffusion.
This could help customize the image generation to be more appropriate for
your character's persona, or influence the type of images generated in ways
that are more subtle than allowed by other settings.To use it, generate or regenerate the config.yml file and then set
# This will be appended to every image generation prompt sent to Stable Diffusion.
# default:
extra_prompt_text: "as a tattoo"
in the stable_diffusion:
section.
Breaking Changes
The following command line arguments have been deprecated:
diffusion_steps
image_height
image_width
stable_diffusion_sampler
sd_negative_prompt
sd_negative_prompt_nsfw
They're deprecated because they're more naturally included in the
stable_diffusion: request_params:
section in the new config file, and it would be
confusing to have the same setting in two places.
I'll keep them around for a while, but they will be removed in a
future release.
If you were generating a new config file anyway, then there's no
impact to you.
New Feature Q&A
What is in the new config file?
You can now configure every parameter sent to Oobabooga
and Stable Diffusion to generate responses. Some notable ones are:
- truncation_length (aka "max tokens")
- temperature (controls bot creativitiy)
- repetition_penalty
- early_stopping flag
In addition, this is done in a way so that anything in the
sections is just "passed through" to the underlying service.
This means that if a new release of Oobabooga or Stable Diffusion
adds a new parameter, you can just add it to the config.yml,
without needing a software update.
Creating a new config.yml
file
Pass --generate-config
to the CLI to print a fesh new config.yml
file to sdout. You can then redirect this to a file.
This file will include any other settings you've supplied on the
command line. So if you're upgrading from an earlier version,
all you have to do is:
If you've been running with the CLI alone, all you need to do is:
oobabot {your normal args} --generate-config > config.yml
and then
oobabot
Where to place config.yml
oobabot
will look for a config.yml file in the current
directory by default. If you want to place it somewhere
else, you can specify a different location with the
--config-file
flag. e.g.
oobabot --config-file /path/to/config.yml
Upgrading from an earlier version
If you ever upgrade and want to regenerate the config.yml,
you can just do this:
cp config.yml config.yml.backup &&
oobabot --config config.yml.backup --generate-config > config.yml
Note: it's important to make a backup copy of your config.yml first,
because the pipe command in the second line will overwrite it!
Your previous config.yml file will be read before generating the new one,
and the new one will include all the settings from the old one, plus
any new settings that have been added since the last time you generated
the config.yml file.
Your previous config.yml file will be read before generating the new one,
and the new one will include all the settings from the old one, plus
any new settings that have been added since the last time you generated
the config.yml file.
Notes on Streaming Response Jankeyness
It's janky in the following ways:
-
there are rate limits on how fast edits can be made,
so it's not silky smooth. We will wait at least 0.2 seconds
between edits, but it may be longer. The actual speed will depend
on how fast Discord allows edits. -
you'll see an "edited" tag on the message. But if you can
ignore that, that's cool. -
you won't be notified when the bot responds this way. This is
because Discord sends new message notifications immediately
on message send, so the notification would only contain a single
token. This would be annoying, so we don't do it.
I'm just impressed it works at all.
Bug Fixes / Tech Improvements
-
Fixed an issue with an "image regeneration failed"
when regenerating images against SD servers which took more than 5
seconds to render -
Fixed an issue where regenerating an image while simultaneously
the bot was generating a second reply in the channel would cause
an "image regeneration failed" error, sometimes. -
improve heuristic for detecting our own image posts. Sometimes
the bot would pick up on the UI elements of its own image posts.
This should be fixed now. -
Do a better job at logging exceptions that happen during
message responses -
new over-engineered config file parsing, should afford
easier paramater adding in the future -
fixes for pylint, added to precommit hooks
Full Changelog
v0.1.6
Release 0.1.6
New Features
Discord Hygiene Choices
I want the bot to act like an A+ human participant in your Discord server. Different servers have different behavior conventions, though, so I've added some options to change how it acts:
-
--dont-split-responses
With this, the bot will bundle everything into a single response, rather than splitting responses by sentences.
-
--reply-in-thread
With this, the bot will create a new thread to respond into. This can be great to keeping multiple conversational tracks organized on busy channels.
A few caveats:
- the user who summoned the bot must have "create public thread" permissions. If they don't, the bot will ignore their summon.
- when creating a thread, the bot will only be able to see the message that summoned it, and then any further replies in its thread. This might be useful in some circumstances. But it also means the bot will not have context about the conversation before the summon.
Slash commands
slash commands~
/lobotomize -- make the bot forget everything in the channel before the command is run
/say "message" -- speak as the bot
/command |
what it does |
---|---|
/lobotomize |
make the bot forget everything in the channel before the command is run |
/say "message" |
speak as the bot |
Breaking Changes
- Oobabot doesn't add any restrictions on who can run these commands, but luckily Discord does! You can find this inside Discord by visiting "Server Settings" -> Integrations -> Bots and Apps -> hit the icon which looks like [/] next to your bot
If you're running on a large server, you may want to restrict who can run these commands. I suggest creating a new role, and only allowing that role to run the commands.
-
The hard-coded token budget has been decreased from 2048 to 730. This was based on reports from users who were running models which didn't actually support 2048 tokens, myself included. This will be configurable in the future, but for now this a safer default.
-
The default number of history lines has decreased from 15 to 7. This was because of the smaller token budget, but also because 15 tokens increased infrence times a lot for those running on CPUs. This is configurable with the
--history-lines
command line argument.
Notable Bugfixes
- if people are using nicknames, use them instead of their discord username
- fix regression in 0.1.5 which caused stable diffusion image generation to fail unless it ran in less than 5 seconds
- fix a regression when running on python <3.10. Python 3.8.1+ should now work.
Help Make Oobabot Better
Looking to help add to the bot? Check out our new CONTRIBUTING.md. You can also use the instructions there if you want the bleeding-edge changes from github, rather than waiting for a release.
Full Changelog: v0.1.5...v0.1.6
v0.1.5 release
Lots of work in this release. A few new features, but a lot of under-the-hood changes to support more in the future.
If you've forked and started to make changes, you might have trouble merging. My apologies!
BREAKING CHANGES
The command-line arguments
--stable-diffusion-negative-prompt
--stable-diffusion-negative-prompt-nsfw
have been shortened to
--sd-negative-prompt
--sd-negative-prompt-nsfw
The old ones were just annoyingly long. :)
NEW FEATURES
- More Customization
A number of command-line arguments have been added to customize more aspects of the bot's behavior:
--history-lines HISTORY_LINES
Number of lines of history to supply to the AI. This is the number
of lines of history that the AI will see when generating a response.
The default is 20.
--diffusion-steps DIFFUSION_STEPS
Number of diffusion steps to take when generating an image. The
default is 30.
--image-height IMAGE_HEIGHT
Size of images to generate. This is the height of the image in
pixels. The default is 512.
--image-width IMAGE_WIDTH
Size of images to generate. This is the width of the image in
pixels. The default is 512.
--image-words [IMAGE_WORDS ...]
One or more words that will indicate the user is requeting an image
to be generated.
--stable-diffusion-sampler STABLE_DIFFUSION_SAMPLER, --sd-sampler STABLE_DIFFUSION_SAMPLER
Sampler to use when generating images. If not specified, the one set
on the AUTOMATIC1111 server will be used.
- add FAQ
Major Bugfixes
There was a bug earlier with unsolicited replies, which would cause the bot to respond to every message in a channel for the first 2 minutes after it was pinged. The intended behavior was for it to only have a percentage chance of replies.
This has been fixed, and the bot is a bit less chatty. I've tweaked the response changes a bit as a result to keep some of the chattiness, but now it will chill sometimes, which is nice.
Internal Changes
If you've been looking at contributing, this might be a good time. I've made some changes to make the code a bit more easier to understand and maintain, at least in my opinion.
The purpose of these changes was to:
- make the code easier to contribute to, maintain, and write tests for
- limit discord-specific logic to a small number of files, so that things are easier in the future if we add other messaging integrations
- centralize all settings to afford even more user customization later
Here's a quick tour of the main bits in the new structure:
important but nonexciting parts
- oobabot.py - main, sets up and runs everything
- ooba_client.py - oobabooga client http API <> python
- sd_client.py - stable diffusion client http API <> python
- settings.py - reads user-customizable settings
Bot brains
- discord_bot.py - connects to Discord, monitors for messages, sends replies
- image_generator.py - generates images and posts them, UI to redo images
- decide_to_respond.py - chooses which messages to reply to
- prompt_generator.py - generates the prompt sent to Oobabooga
- repetition_tracker.py - watches for bot loops and tries to stop them
Utilities
- http_client.py - http client, used by both sd_client and ooba_client
- response_stats.py - logs operational stats
- sentence_splitter.py - splits a stream of tokens into sentences
- types.py - defines generic versions messaging objects
- templates.py - creates all UI messages and bot prompts
Hopefully this will make things easier to understand!
Immediate upcoming work which will be supported by this change is:
- allowing users full control over the prompt sent to the bot
- exposing more knobs about the bot's responsiveness, temperature, etc.
Full Changelog: v0.1.4...v0.1.5
v0.1.4
** New Features **
*** image generation via Stable Diffusion! ***
oobabot can now connect to a Stable Diffusion server running AUTOMATIC1111's web ui, and generate images based on user requests. See README.md for more.
** Improvements / Bugfixes **
- move from websockets library to using aiohttp for everything. This allows us to pipeline requests, which should fix the problem of OOM errors when multiple requests come in at once.
- AI deadlock detection -- notice when the AI is stuck in a "loop", repeating the same message over and over again, and remove chat context to get it into a "fresh" state
- removed --local-repl feature, which was becoming increasingly difficult to support as more features were added. Improved the startup-time tests, which should be able to report well if things are not configured correctly
Full Changelog: v0.1.3...v0.1.4
v0.1.3 release
add "unsolicited reply" feature. Oobabot now has a chance of continuing an active conversation once it's started without the need for a wake-word in every message.
add tests, improve code formatting
awareness of the token budget of the LLM, will throw an error if the persona prompt is too long
Full Changelog: v0.1.2...v0.1.3