From 22d13a0aee2c37c7b13e82d6665804540fb31bb4 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Sun, 11 Aug 2024 00:13:24 +0300 Subject: [PATCH 1/5] Update CONTRIBUTING.md --- CONTRIBUTING.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 833bf62dc..b52fc7f6e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -34,3 +34,8 @@ - What did you do to achieve this? - How would a reviewer test the change? 6. Mind the license. Your contributions will be licensed under the GNU Affero General Public License. If you don't know what that implies, consult your lawyer. + +## Further reading + +1. [How to write UI extensions](https://docs.sillytavern.app/for-contributors/writing-extensions/) +2. [How to write server plugins](https://docs.sillytavern.app/for-contributors/server-plugins) From 06d300ad3691ab144186e136ecc3c0c33685958d Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Wed, 14 Aug 2024 00:08:16 +0300 Subject: [PATCH 2/5] Quick Replies: Add auto-execute on new chat --- .../scripts/extensions/quick-reply/api/QuickReplyApi.js | 6 ++++++ public/scripts/extensions/quick-reply/html/qrEditor.html | 4 ++++ public/scripts/extensions/quick-reply/index.js | 6 ++++++ .../extensions/quick-reply/src/AutoExecuteHandler.js | 9 +++++++++ public/scripts/extensions/quick-reply/src/QuickReply.js | 8 ++++++++ 5 files changed, 33 insertions(+) diff --git a/public/scripts/extensions/quick-reply/api/QuickReplyApi.js b/public/scripts/extensions/quick-reply/api/QuickReplyApi.js index fedb6d0e6..59c258620 100644 --- a/public/scripts/extensions/quick-reply/api/QuickReplyApi.js +++ b/public/scripts/extensions/quick-reply/api/QuickReplyApi.js @@ -204,6 +204,7 @@ export class QuickReplyApi { * @param {boolean} [props.executeOnAi] whether to execute the quick reply after the AI has sent a message * @param {boolean} [props.executeOnChatChange] whether to execute the quick reply when a new chat is loaded * @param {boolean} [props.executeOnGroupMemberDraft] whether to execute the quick reply when a group member is selected + * @param {boolean} [props.executeOnNewChat] whether to execute the quick reply when a new chat is created * @param {string} [props.automationId] when not empty, the quick reply will be executed when the WI with the given automation ID is activated * @returns {QuickReply} the new quick reply */ @@ -218,6 +219,7 @@ export class QuickReplyApi { executeOnAi, executeOnChatChange, executeOnGroupMemberDraft, + executeOnNewChat, automationId, } = {}) { const set = this.getSetByName(setName); @@ -236,6 +238,7 @@ export class QuickReplyApi { qr.executeOnAi = executeOnAi ?? false; qr.executeOnChatChange = executeOnChatChange ?? false; qr.executeOnGroupMemberDraft = executeOnGroupMemberDraft ?? false; + qr.executeOnNewChat = executeOnNewChat ?? false; qr.automationId = automationId ?? ''; qr.onUpdate(); return qr; @@ -258,6 +261,7 @@ export class QuickReplyApi { * @param {boolean} [props.executeOnAi] whether to execute the quick reply after the AI has sent a message * @param {boolean} [props.executeOnChatChange] whether to execute the quick reply when a new chat is loaded * @param {boolean} [props.executeOnGroupMemberDraft] whether to execute the quick reply when a group member is selected + * @param {boolean} [props.executeOnNewChat] whether to execute the quick reply when a new chat is created * @param {string} [props.automationId] when not empty, the quick reply will be executed when the WI with the given automation ID is activated * @returns {QuickReply} the altered quick reply */ @@ -273,6 +277,7 @@ export class QuickReplyApi { executeOnAi, executeOnChatChange, executeOnGroupMemberDraft, + executeOnNewChat, automationId, } = {}) { const qr = this.getQrByLabel(setName, label); @@ -290,6 +295,7 @@ export class QuickReplyApi { qr.executeOnAi = executeOnAi ?? qr.executeOnAi; qr.executeOnChatChange = executeOnChatChange ?? qr.executeOnChatChange; qr.executeOnGroupMemberDraft = executeOnGroupMemberDraft ?? qr.executeOnGroupMemberDraft; + qr.executeOnNewChat = executeOnNewChat ?? qr.executeOnNewChat; qr.automationId = automationId ?? qr.automationId; qr.onUpdate(); return qr; diff --git a/public/scripts/extensions/quick-reply/html/qrEditor.html b/public/scripts/extensions/quick-reply/html/qrEditor.html index 89766d78a..e81a11ba2 100644 --- a/public/scripts/extensions/quick-reply/html/qrEditor.html +++ b/public/scripts/extensions/quick-reply/html/qrEditor.html @@ -108,6 +108,10 @@ Execute on chat change +