- 1.6.x: 1.6.0, 1.6.1
- 1.5.x: 1.5.0
- 1.4.x: 1.4.0
- 1.3.x: 1.3.0
- 1.2.x: 1.2.0, 1.2.1
- 1.1.x: 1.1.0, 1.1.1, 1.1.2
- 1.0.x: 1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4
- 0.18.x: 0.18.0 - 0.18.1
- 0.17.x: 0.17.0
- 0.16.x: 0.16.0
- 0.15.x: 0.15.0 - 0.15.1
- 0.14.x: 0.14.0
- 0.13.x: 0.13.0
- 0.12.x: 0.12.0
- 0.11.x: 0.11.0 - 0.11.1 - 0.11.2 - 0.11.3
- 0.10.x: 0.10.0 - 0.10.1 - 0.10.2
- 0.9.x: 0.9.0
- 0.8.x: 0.8.0
- 0.7.x: 0.7.0 - 0.7.1
- 0.6.x: 0.6.0 - 0.6.1 - 0.6.2 - 0.6.3 - 0.6.4
- 0.5.x: 0.5.0
- 0.4.x: 0.4.0 - 0.4.1 - 0.4.2 - 0.4.3 - 0.4.20 - 0.4.21 - 0.4.22 - 0.4.23 - 0.4.24
- 0.3.x: 0.3.0 - 0.3.1
- 0.2.x: 0.2.0
- 0.1.x: 0.1.0
- Issue #154 - Resolved
- Added support for
gpt-4o-mini
, set as default model.
- Added support for
- I took a long break from my projects due to a big home move. This project is not dead!
- Updated configurable OpenAI models to
gpt-4o
,gpt-4
,gpt-4-turbo
,gpt-3.5-turbo
- Updated dependencies to clear dependabot alerts on
undici
,braces
, andws
. - Pinned
typescript
to5.4.x
as 5.5 introduces an issue withEventEmitter
that I haven't figured out yet. I only see one other report online. (edit 2024-07-08: found the issue being discussed).
- Issue #147 - Resolved
- Added support for
gpt-4-0125-preview
,gpt-4-turbo-preview
, andgpt-3.5-turbo-0125
. - Pruned support for
gpt-4-0314
,gpt-4-32k-0314
, andgpt-3.5-turbo-0301
.
- Added support for
- Updated dependencies:
openai
4.20.0 => 4.27.0
- Issue #143 - Resolved
- Substantially refactored
CreateImage
, and will work on similar refactors for other code soon.- Types/interfaces will belong to a
*.types.ts
file, reducing the large number of 5-10 line[type].ts
files the project has.
- Types/interfaces will belong to a
- Fully implemented create image options.
- Added configuration settings:
openai_createImage_dalle2_size
(default:1024x1024
)openai_createImage_dalle3_quality
(default:standard
)openai_createImage_dalle3_size
(default:1024x1024
)openai_createImage_dalle3_style
(default:vidid
)
- Added configuration settings:
- Enhanced Discord image embeds with additional information
dall-e-3
embeds will include:- Model/quality/style
revised_prompt
- generated by the API, so the art collabs are actually collabs now
dall-e-2
embeds will include the model
- Substantially refactored
- Updated dependencies:
openai
4.19.0 => 4.20.0
- Resolved multiple issues:
- Issue #131
- Added
openai_api_timeoutSec
configuration setting, default is 15.
- Added
- Issue #132
- Issue #133
- Issue #134
- Issue #131
- Updated
devDependencies
- Issue #129 - Resolved
- Updated coding style in
DiscordBot.ts
for readability, and since it's the biggest file (by a lot) I updated the rest of the project.
- Updated coding style in
- Issue #126 - Resolved
- Removed retry logic from OpenAI function calls, as the library handles these natively now. Now it will bubble up the original error.
- Removed
src/lib/OpenAI/Errors/*
OpenAIError
OpenAIBadRequestError
OpenAIRetriesExceededError
OpenAIUnexpectedError
- Removed
axios
dependency. It was only in place to parse the errors returned byopenai-node
3.x to support retry logic.
- Issue #113 - Resolved
- Minor fix:
CreateImage
token logging used display name, switched to username to align with token spending/refunding. - Updated
devDependencies
- Minor fix:
- Issue #123 - Resolved
- Updated dependencies:
axios
1.6.0 => 1.6.2discord.js
14.13.0 => 14.14.1 (resolvesundici
CVE-2023-45143)openai
4.16.1 => 4.19.0
- Minor fixes:
- Issue #112 - Resolved
- Issue #118 - Resolved (thank you @divyakelaskar!)
- Issue #116 - added support for DALL-E 3 image API
- Added
openai_createImage_model
config variable to allow selection betweendall-e-2
ordall-e-3
. - Updated
openai_chatCompletion_model
config variable with new models (untested). Legacy models are on the bottom line of each model-version grouping.
- Added
- Updated dependencies:
axios
1.4.0 => 1.6.0discord.js
14.11.0 => 14.13.0openai
3.3.0 => 4.16.1- All
devDependencies
- Issue #107 - Re-opened due to bug after converting async functions to synchronous and using
fs/promises
foraccess()
onDEBUG
file. Resolved again.
- Issue #107 - Resolved; see issue for notes.
- Issue #105 - Resolved; see issue for notes.
- Updated dependencies:
@typescript-eslint/eslint-plugin
=> 5.61.0@typescript-eslint/parser
=> 5.61.0eslint
=> 8.44.0- Resolves vulnerability found in
eslint#optionator#word-wrap
dependency (info)
- Resolves vulnerability found in
typescript
=> 5.1.6
- All pre-release issues have been resolved - launching v1.0!
- Issue #23 - Resolved; documentation completed.
- Issue #101 - Resolved; see issue for notes.
- Issue #85 - Resolved; code blocks continue correctly after being split for Discord maximum message length (2000 characters).
- Solved undocumented chat completion response truncation issue, caused by a misunderstanding of how
openai_chatCompletion_maxTokens
functions. Super long bot responses are now possible!- Updated configuration defaults:
openai_chatCompletion_maxTokens
1024 => 4096openai_chatCompletion_model
gpt-3.5-turbo-0613 => gpt-3.5-turbo-16k-0613
- Updated configuration defaults:
- Updated dependencies.
- Issue #97 - Resolved.
- Bot can now intelligently determine message intent rather than relying on tags like
{ai-image}
. See issue notes for implementation details. - Removed
bot_createImage_tag
configuration setting.
- Bot can now intelligently determine message intent rather than relying on tags like
- Issue #87 - Resolved; see issue for notes.
- Issue #95 - Resolved. Added enhanced debug logging.
- Issue #93 - Resolved. Was casting an enum for
ConversationMode
incorrectly, causingundefined
to be used as aConversationKey
.
- Issue #60 - Resolved. Using
yarn
instead ofnpm
for package installation, scripts, andDockerfile
.
- Issue #76 - Resolved; see issue for notes.
- Updated
README.md
to reflect new config setting names/values. - Increased default for
openai_chatCompletion_maxTokens
600 => 1024.
- Updated
- Issue #88 - Resolved, updated avialable and default chat model. See issue for notes.
- Updated npm dependencies:
- Production:
openai
3.2.1 => 3.3.0
- Development:
@typescript-eslint/eslint-plugin
5.59.9 => 5.59.11@typescript-eslint/parser
5.59.9 => 5.59.11
- Production:
- Issue #75 - Resolved, ended up doing a larger refactor.
- Created a
DiscordBotMessage
class that contains DiscordMessage
objects and bot metadata and functionality, and moved that fromDiscordBot
. This reduces the amount ofdiscordMessage
passing that was happening inDiscordBot
as the functionality has moved toDiscordBotMessage
properties. - Reorganized files into a better directory and import/export structure.
- Configuration variable changes:
BOT_CONVO_MODE
renamed toBOT_CONVERSATION_MODE
BOT_CONVO_RETAIN_SEC
renamed toBOT_CONVERSATION_RETAIN_SEC
- Created a
- Issue #74 - Resolved; see issue for notes.
- Minor updates to package dependencies.
- Issue #79 - Resolved.
_embedImageFromPromptMessage()
now supports base64 encoded file attachments and URL images, and is using base64 encoded attachments for persistence.
- Issue #70 - Implemented the OpenAI
CreateImage
API:- New configuration variables:
BOT_CREATE_IMAGE_FEATURE
: enabled/disabled (default: disabled)BOT_CREATE_IMAGE_TAG
: string (default:{ai-image}
)BOT_CREATE_IMAGE_USER_TOKENS
: number (default: 3)BOT_CREATE_IMAGE_USER_TOKENS_EXPIRE_SEC
: number (default: 3600)
- Implemented a token/bucket system for rate-limiting users, as the CreateImage API call is pretty expensive compared to chat completions.
- New configuration variables:
- Issue #68 - fixed by adding inner try/catch blocks to
.forEach()
inDiscordBot._handleMessageCreate()
andDiscordBot._probablyReactToMessage()
.
- Issue #63 - added regex check and character replacement to
PayloadMessage.name
- Issue #64 - added error checks for all calls to
OpenAI.requestChatCompletion()
- Issue #13:
- Updated
_probablyEngageInConversation()
and_probablyReactToMessage()
:- Got rid of
MessageHistory.isDirectEngagement
flag, as it was used for filtering context to direct engagements only, which is unnecessary. - Both functions send better prompts to OpenAI API now.
- Number of emojis in reactions reduced from 2 to 1.
- Got rid of
- Updated
- Fixed broken error handling in
lib/OpenAI/OpenAI.ts
- Cleanup:
- Making better use of interfaces for constructing
HistoryMessage
,PromptPayload
, andLog
entries.
- Making better use of interfaces for constructing
0.9.0 (2023-05-29) ⬆️ Back to top
- Issue #57 - Renamed thread signature to "conversation key" throughout code.
- Configuration variable changes:
BOT_THREAD_MODE
renamed toBOT_CONVO_MODE
BOT_THREAD_RETAIN_SEC
renamed toBOT_CONVO_RETAIN_SEC
- Configuration variable changes:
- Issue #50 - Improved DiscordAPIError logging in
DiscordBot._probablyReactToMessage()
. - Issue #36 - Changed pagination delimiter from
\n\n
to\n
to resolve issues with long responses with single line breaks between paragraphs. - Cleanup:
- Changed all instances of
parseInt(*.toString())
andparseFloat(*.toString())
toNumber(*)
. - Changed all instances of
*.toString()
toString(*)
. app.ts/Main()
changeddiscordBot.Events.on(BotEvents.BotReady, ...
todiscordBot.Events.once(BotEvents.BotReady, ...
Dockerfile
runsCMD ["npm", "start"]
instead ofCMD ["npm", "run", "start"]
- Changed all instances of
- Issue #51 - Ported the entire codebase to TypeScript, and refactored using object-oriented design principals.
- Directory structure improved to support
tsc
builds:- Moved source code under
./src
tsc
transpilation goes to./dist
- Restructured
/lib
- Moved source code under
- Modified dev dependencies to support TypeScript development.
- Using new
.eslintrc
and.eslintignore
files.
- Using new
- Updated
Dockerfile
to perform a multi-stage build.
- Directory structure improved to support
- Config updates:
- Renamed
lib-config-template.js
(configTemplate) to./lib/Config
(Config). - Moved
.config-template.json
from./
to./lib/ConfigTemplate/ConfigTemplate.json
. - Updated configuration defaults:
BOT_AUTO_ENGAGE_PROBABILITY
from0.2
to0.05
BOT_AUTO_REACT_PROBABILITY
from0.2
to0.05
BOT_THREAD_RETAIN_SEC
from600
to900
OPENAI_PARAM_MAX_TOKENS
from500
to600
- Renamed
- Updated npm dependencies.
- Cleaned up incorrect instructions in
README.md
. - Lots of other changes under the hood to enable faster feature development.
- Issue #52 - fixed new bug discovered after errors were handled correctly.
- Issue #52 - 429 errors were not considered retryable; fixed.
- Issue #13 - Bots will now engage and react to channel comments, unprompted!
- Added new config settings:
BOT_AUTO_ENGAGE_MIN_MESSAGES
- a minimum number of messages required for a bot to automatically engage in conversation.BOT_AUTO_ENGAGE_PROBABILITY
- a decimal percentage value from 0.0-1.0 defining the probability that a bot will engage in comments.BOT_AUTO_REACT_PROBABILITY
- a decimal percentage value from 0.0-1.0 defining the probability that a bot will react to comments.
- I expect this will be a funky release, so upgrade at your own peril. I'll be running for a while and fine-tuning the behavior.
- Added new config settings:
- Issue #46 - A bot @-mention with additional bots tagged will now strip the other bot tags instead of translating to name.
- Sometimes bots take other bot names into consideration in their prompt responses, which is undesired behavior.
- Issue #39 - Moved libDiscord.pruneOldThreadMessages() from the message received handler to a 15 second timer job to prevent extraneous executions and debug logging.
- Issue #42 - Bot now replies to the comment that prompted its response in channels.
- Issue #36 - Fixed OpenAI response >2000 characters being rejected by Discord channel.send().
- Breaks multi-paragraph responses >2000 characters into a channel.send() paragraph.
- There are still some possibilities for issues, like long code blocks being broken, or >2000 character unbroken paragraphs being too long. Will monitor and address later if needed.
- Issue #9 - Added bot direct message support. You can now DM the bot, no @-mention needed!
- Issue #33 - Rebuilt startup environment checking. It was clunky and not extensible.
- Created
.config-template.json
to store and define attributes for expected environment variables/settings.name
: (string) The name of the environment variable, e.g.BOT_LOG_DEBUG
.allowedValues
: (string/list) Pre-defined acceptable input values.defaultValue
: (string/number) Pre-defined default value, so it doesn't need to be provided at runtime!required
: (bool) Whether or not the user must provide the value, e.g. API keys.secret
: (bool) Whether or not the configured value is a secret - causes it to be displayed masked, e.g. API keys. with allowed values, default values, and whether the values are required as inputs or are secrets.
- Updated
README.md
launch instructions.
- Created
- Issue #34 -
DISCORD_APP_TOKEN
in code actually required the Discord bot token from the Discord Developer Portal. Fixed naming for clarity.
- Issue #30 -
OPENAI_ORG_ID
was not fully removed from settings causing failed startup checks. Cleaned up.
- FR issue #24 - Have OpenAI API generate try-again messages sent as chat responses.
- Cleanup:
- Removed
OPENAI_ORG_ID
from environment settings.
- Removed
- Added
HistoryMessageAnalysis
class that performs mood, sentiment, and tone analysis ofHistoryMessage
messages. - Added support for one-off prompt payloads and responses. Meant for internal use by the application for generating message analysis and things like error responses sent to chat.
- Added "break-glass" debug logging by creating a file named
DEBUG
(case-sensitive) to the app working directory. This enables debug logging without restarting the application. - Cleanup:
- Updated
Dockerfile
working directory from/app
to/usr/src/app
. - Added
.dockerignore
- Removed extraneous carriage returns in code for readability.
- Libraries:
- Moved some common bot code to
lib/lib-bot.js
. - Moved more code to
lib/lib-discord.js
andlib/lib-openai.js
.
- Moved some common bot code to
- Updated
- Bug fixes:
- Fixed behavioral bug in
pruneMessageHistory()
- issue #26:- Now only evaluates for expired TTL, irrespective of
threadSignature
.
- Now only evaluates for expired TTL, irrespective of
- Fixed behavioral bug in
- Refactored code into multiple .js files to better group functionality - issue #16:
- Discord-specific functions moved to
lib/lib-discord.js
- OpenAI-specific functions moved to
lib/lib-openai.js
- Discord-specific functions moved to
- Changed all synchronous functions to
async
withawait
calls to stop blocking the event loop (possibly causing issue #14). - Updated OpenAI API call retry logic:
- Instead of retrying indefinitely on 5XX errors,
retryRequest (bool)
was changed toremainingRetryCount
which starts with theOPENAI_MAX_RETRIES
environment setting. - The retry loop decrements. Fatal errors (4XX) will immediately decrement the loop to
0
to prevent retry.
- Instead of retrying indefinitely on 5XX errors,
- Fixed a big glitch in the
README.md
documentation:- Local execution with
node
requires environment set up.
- Local execution with
- Added optional
BOT_LOG_DEBUG
environment setting to toggledebug
logging level. - Added message collection for all messages (subject to
BOT_THREAD_RETAIN_SEC
) for upcoming features - issue #14 - Bug fixes:
- Solved a bug in
pruneOldThreadMessages()
that would always result in one message not being pruned.
- Solved a bug in
- Removed unused
DISCORD_GUILD_ID
andDISCORD_CLIENT_ID
environment settings - issue #20.
- Added logging of non-sensitive startup parameters - issue #15
- Added debug logging to pruning function, suspect it may get stuck in a loop - issue #14. Issue remains open until cause of hang is identified.
- Added Table of Contents to
README.md
. - Bug fixes:
- Improved error handling for empty OpenAI API responses, added trap for 4XX (fatal) and 5XX (retriable) errors - issue #17.
- Added package
name:version
to startup logging. - Added conversational continuity.
- Requires new environment settings
BOT_THREAD_MODE=[channel|user]
andBOT_THREAD_RETAIN_SEC=[seconds]
ExperimentalAdded Discord username to OpenAI prompt under optionalname
field.- This will remain in place! It allows the system prompt to treat different chat users uniquely.
- Requires new environment settings
- Updated app.js to support
gpt-3.5-turbo
.- Using
openAiClient.createChatCompletion()
instead ofopenAiClient.createCompletion()
. - This limits supported models to
gpt-4
(not yet public),gpt-4-0314
(not yet public),gpt-4-32k
(not yet public),gpt-4-32k-0314
(not yet public),gpt-3.5-turbo
, andgpt-3.5-turbo-0301
.- This is fine, because per the models documentation,
gpt-3.5-turbo
is 1/10th the cost oftext-davinci-003
, andgpt-4
is even better-er.
- This is fine, because per the models documentation,
openai-node
PR #123 looks like it will automate API endpoint switching based upon selected model. Monitoring for approval/merge.
- Using
- Removed $ shell prefixes from README.md code blocks to enable better use of the GitHub UI's copy button.
- Updated logging timestamp to ISO 8601 format.
- Fixed indentation in app.js (2-space convention)
- Removed
/chatgpt
and scaffolding for importing slash-commands. - Updated secrets approach from using
.env
anddotenv
withdocker build --build-arg [arg=]
(contaminates image with secrets) todocker run -e [arg=]
to enable a credential-less container image that can be distributed. - Improved console logging.
- Renamed entry point from
index.js
toapp.js
. - Documented setup and version history in README.md.
- Added support for @-mention of bot which is more conversational than slash-commands.
- Removed boilerplate slash-commands, leaving only
/chatgpt
. - Moved OpenAI API parameter configurations to dotenv.
- Initial commit
- Supports
/chatgpt prompt
and other boilerplate slash-commands. - Containerized application, but image isn't portable is building requires Docker build-arg placement of dotenv