From 3478e892aed03f8e4ce05d133126fa017ae81c65 Mon Sep 17 00:00:00 2001 From: Chris Rude Date: Tue, 23 May 2023 18:58:35 -0700 Subject: [PATCH] add release notes for 0.1.8, update readme and sample yaml --- README.md | 42 +++++++++---- docs/RELEASE-0.1.8.md | 63 ++++++++++++++++++++ docs/config.sample.yml | 132 +++++++++++++++++++++++++++++++---------- 3 files changed, 192 insertions(+), 45 deletions(-) create mode 100644 docs/RELEASE-0.1.8.md diff --git a/README.md b/README.md index 0cf29d68..bfa43de9 100644 --- a/README.md +++ b/README.md @@ -73,15 +73,17 @@ Real motivation: I wanted a chatbot in my discord that would act like my cat. A You should now be able to run oobabot from wherever pip installed it. ```none -usage: oobabot [-h] [-c CONFIG] [--generate-config] [--ai-name AI_NAME] [--persona PERSONA] - [--wakewords [WAKEWORDS ...]] [--discord-token DISCORD_TOKEN] - [--dont-split-responses] [--history-lines HISTORY_LINES] [--ignore-dms] - [--reply-in-thread] [--stream-responses] [--base-url BASE_URL] - [--log-all-the-things] [--image-words [IMAGE_WORDS ...]] +  ³ oobabot  ~/oobabot       oobabot --help 383ms  Tue May 23 18:56:42 2023 +usage: oobabot [-h] [-c CONFIG] [--generate-config] [--invite-url] [--ai-name AI_NAME] + [--persona PERSONA] [--wakewords [WAKEWORDS ...]] + [--discord-token DISCORD_TOKEN] [--dont-split-responses] + [--history-lines HISTORY_LINES] [--ignore-dms] [--reply-in-thread] + [--stream-responses] [--base-url BASE_URL] [--log-all-the-things] + [--message-regex MESSAGE_REGEX] [--image-words [IMAGE_WORDS ...]] [--stable-diffusion-url STABLE_DIFFUSION_URL] - [--extra-prompt-text EXTRA_PROMPT_TEXT] + [--extra-prompt-text EXTRA_PROMPT_TEXT] [--use-ai-generated-keywords] -oobabot v0.1.7: Discord bot for oobabooga's text-generation-webui +oobabot v0.1.8: Discord bot for oobabooga's text-generation-webui General Settings: @@ -92,6 +94,8 @@ General Settings: --generate-config If set, oobabot will print its configuration as a .yml file, then exit. Any command-line settings also passed will be reflected in this file. (default: False) + --invite-url Print a URL which can be used to invite the bot to a Discord + server. Requires that the Discord token is set. (default: False) Persona: @@ -102,7 +106,7 @@ Persona: variable. (default: ) --wakewords [WAKEWORDS ...] One or more words that the bot will listen for. The bot will listen - in all discord channels can access for one of these words to be + in all discord channels it can access for one of these words to be mentioned, then reply to any messages it sees with a matching word. The bot will always reply to @-mentions and direct messages, even if no wakewords are supplied. (default: ['oobabot']) @@ -115,7 +119,7 @@ Discord: variable instead, if possible. (default: ) --dont-split-responses Post the entire response as a single message, rather than splitting - it into seperate messages by sentence. (default: False) + it into separate messages by sentence. (default: False) --history-lines HISTORY_LINES Number of lines of chat history the AI will see when generating a response. (default: 7) @@ -123,8 +127,8 @@ Discord: False) --reply-in-thread If set, the bot will generate a thread to respond in if it is not already in one. (default: False) - --stream-responses Stream responses into a single message as they are generated. - (default: False) + --stream-responses FEATURE PREVIEW: Stream responses into a single message as they are + generated. Note: may be janky (default: False) Oobabooga: @@ -133,18 +137,30 @@ Oobabooga: wss://hostname[:port] for websocket connections over TLS. (default: ws://localhost:5005) --log-all-the-things Print all AI input and output to STDOUT. (default: False) + --message-regex MESSAGE_REGEX + A regex that will be used to extract message lines from the AI's + output. The first capture group will be used as the message. If + this is not set, the entire output will be used as the message. + (default: ) Stable Diffusion: --image-words [IMAGE_WORDS ...] When one of these words is used in a message, the bot will generate - an image. (default: ['drawing', 'photo', 'pic', 'picture', 'image', - 'sketch']) + an image. (default: ['draw me', 'drawing', 'photo', 'pic', + 'picture', 'image', 'sketch']) --stable-diffusion-url STABLE_DIFFUSION_URL URL for an AUTOMATIC1111 Stable Diffusion server. (default: ) --extra-prompt-text EXTRA_PROMPT_TEXT This will be appended to every image generation prompt sent to Stable Diffusion. (default: ) + --use-ai-generated-keywords + FEATURE PREVIEW: If set, the bot will ask Oobabooga to generate + image keywords from a user's message. It will then pass the + keywords that Oobabooga produces to Stable Diffusion to finally + generate an image. Otherwise, the bot will simply extract keywords + directly from the user's message using a simple regex. (default: + False) Additional settings can be set in config.yml. Use the --generate-config option to print a diff --git a/docs/RELEASE-0.1.8.md b/docs/RELEASE-0.1.8.md new file mode 100644 index 00000000..7bf414f2 --- /dev/null +++ b/docs/RELEASE-0.1.8.md @@ -0,0 +1,63 @@ +# 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 from `oobabot` > `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 + +[Changes from 0.1.7 to 0.1.8](https://github.com/chrisrude/oobabot/compare/v0.1.7...v0.1.8) diff --git a/docs/config.sample.yml b/docs/config.sample.yml index 7ba1ce3e..6135077a 100644 --- a/docs/config.sample.yml +++ b/docs/config.sample.yml @@ -6,7 +6,7 @@ # "config.yml" from the current directory when it is run. # -version: 0.1.6 +version: 0.1.8 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # persona @@ -15,20 +15,27 @@ persona: # Name the AI will use to refer to itself # default: oobabot - ai_name: oobabot + ai_name: # This prefix will be added in front of every user-supplied request. This is useful for # setting up a 'character' for the bot to play. Alternatively, this can be set with the # OOBABOT_PERSONA environment variable. - persona: '' + persona: + + # Path to a file containing a persona. This 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. + # default: + persona_file: # One or more words that the bot will listen for. The bot will listen in all discord - # channels can access for one of these words to be mentioned, then reply to any messages - # it sees with a matching word. The bot will always reply to @-mentions and direct - # messages, even if no wakewords are supplied. + # channels it can access for one of these words to be mentioned, then reply to any + # messages it sees with a matching word. The bot will always reply to @-mentions and + # direct messages, even if no wakewords are supplied. # default: ['oobabot'] wakewords: - - oobabot # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # discord @@ -41,31 +48,35 @@ discord: # Post the entire response as a single message, rather than splitting it into separate # messages by sentence. - # default: false - dont_split_responses: false + # default: False + dont_split_responses: # Number of lines of chat history the AI will see when generating a response. # default: 7 - history_lines: 7 + history_lines: # If set, the bot will not respond to direct messages. - # default: false - ignore_dms: false + # default: False + ignore_dms: + + # Set the log level. Valid values are: + # CRITICAL, ERROR, WARNING, INFO, DEBUG + # default: DEBUG + log_level: # If set, the bot will generate a thread to respond in if it is not already in one. - # default: false - reply_in_thread: false + # default: False + reply_in_thread: # A list of strings that will cause the bot to stop generating a response when # encountered. - # default: ['### end of transcript ###<|endoftext|>', '<|endoftext|>'] + # default: ['### End of Transcript ###<|endoftext|>', '<|endoftext|>'] stop_markers: - - '### End of Transcript ###<|endoftext|>' - - <|endoftext|> - # Stream responses into a single message as they are generated. - # default: false - stream_responses: false + # FEATURE PREVIEW: Stream responses into a single message as they are generated. Note: may + # be janky + # default: False + stream_responses: # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # oobabooga @@ -75,11 +86,17 @@ oobabooga: # Base URL for the oobabooga instance. This should be ws://hostname[:port] for plain # websocket connections, or wss://hostname[:port] for websocket connections over TLS. # default: ws://localhost:5005 - base_url: ws://localhost:5005 + base_url: # Print all AI input and output to STDOUT. - # default: false - log_all_the_things: false + # default: False + log_all_the_things: + + # A regex that will be used to extract message lines from the AI's output. The first + # capture group will be used as the message. If this is not set, the entire output will + # be used as the message. + # default: + message_regex: # A dictionary which will be passed straight through to Oobabooga on every request. Feel # free to add additional simple parameters here as Oobabooga's API evolves. See @@ -111,22 +128,16 @@ oobabooga: stable_diffusion: # When one of these words is used in a message, the bot will generate an image. - # default: ['drawing', 'photo', 'pic', 'picture', 'image', 'sketch'] + # default: ['draw me', 'drawing', 'photo', 'pic', 'picture', 'image', 'sketch'] image_words: - - drawing - - photo - - pic - - picture - - image - - sketch # URL for an AUTOMATIC1111 Stable Diffusion server. # default: - stable_diffusion_url: '' + stable_diffusion_url: # This will be appended to every image generation prompt sent to Stable Diffusion. # default: - extra_prompt_text: '' + extra_prompt_text: # A dictionary which will be passed straight through to Stable Diffusion on every request. # Feel free to add additional simple parameters here as Stable Diffusion's API evolves. @@ -140,3 +151,60 @@ stable_diffusion: width: 512 height: 512 sampler: '' + + # FEATURE PREVIEW: If set, the bot will ask Oobabooga to generate image keywords from a + # user's message. It will then pass the keywords that Oobabooga produces to Stable + # Diffusion to finally generate an image. Otherwise, the bot will simply extract keywords + # directly from the user's message using a simple regex. + # default: False + use_ai_generated_keywords: + +# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # +# template +# . +template: + + # Path to a file containing the prompt template. + # The main prompt sent to Oobabooga to generate a response from the bot AI. The AI's + # reply to this prompt will be sent to discord as the bot's response. + # . + # Allowed tokens: {AI_NAME}, {IMAGE_COMING}, {MESSAGE_HISTORY}, {PERSONA} + # . + # default: You are in a chat room with multiple participants. Below is a transcript of + # recent messages in the conversation. Write the next one to three messages that you would + # send in this conversation, from the point of view of the participant named {AI_NAME}. + # {PERSONA} All responses you write must be from the point of view of {AI_NAME}. ### + # Transcript: {MESSAGE_HISTORY} {IMAGE_COMING} + prompt: + + # Path to a file containing the prompt_history_line template. + # Part of the AI response-generation prompt, this is used to render a single line of chat + # history. A list of these, one for each past chat message, will become {MESSAGE_HISTORY} + # and inserted into the main prompt + # . + # Allowed tokens: {USER_MESSAGE}, {USER_NAME} + # . + # default: {USER_NAME} says: {USER_MESSAGE} + prompt_history_line: + + # Path to a file containing the prompt_image_coming template. + # Part of the AI response-generation prompt, this is used to inform the AI that it is in + # the process of generating an image. + # . + # Allowed tokens: {AI_NAME} + # . + # default: {AI_NAME}: is currently generating an image, as requested. + prompt_image_coming: + + # Path to a file containing the prompt_image_keywords template. + # Sent to Oobabooga, along with the user's image request, to generate image + # keywords. The AI's response to this prompt will then be sent to Stable + # Diffusion to generate an image. + # . + # Allowed tokens: {AI_NAME}, {USER_MESSAGE} + # . + # default: Below is an instruction that describes a task, paired with an input that + # provides further context. Write a response that appropriately completes the request. + # ### Instruction: The input text asks for an image to be created. Please create a list + # of keywords to describe that image. ### Input: {USER_MESSAGE} ### Response: + prompt_image_keywords: