From 035dbe490119365cedb06cec429bcc75fad3cf41 Mon Sep 17 00:00:00 2001 From: deffcolony <61471128+deffcolony@users.noreply.github.com> Date: Mon, 15 Apr 2024 16:41:43 +0200 Subject: [PATCH 001/140] added issue/pr label workflows 3 months of inactivity Bot posts a comment to remind about it and assigns a stale label No further activity - 5 work days passes bot closes the issue --- .github/close-label.yml | 2 + .github/workflows/add-comment-from-tag.yml | 28 +++++++ .github/workflows/check-merge-conflicts.yml | 16 ++++ .github/workflows/close-stale-issues.yml | 82 +++++++++++++++++++ .github/workflows/get-pr-size.yml | 39 +++++++++ .../manage-pending-labels-closed.yml | 17 ++++ .github/workflows/manage-pending-labels.yml | 42 ++++++++++ 7 files changed, 226 insertions(+) create mode 100644 .github/close-label.yml create mode 100644 .github/workflows/add-comment-from-tag.yml create mode 100644 .github/workflows/check-merge-conflicts.yml create mode 100644 .github/workflows/close-stale-issues.yml create mode 100644 .github/workflows/get-pr-size.yml create mode 100644 .github/workflows/manage-pending-labels-closed.yml create mode 100644 .github/workflows/manage-pending-labels.yml diff --git a/.github/close-label.yml b/.github/close-label.yml new file mode 100644 index 000000000..5f2bfa5ee --- /dev/null +++ b/.github/close-label.yml @@ -0,0 +1,2 @@ +π Bug: β Fixed +π¦ Feature Request: β Implemented \ No newline at end of file diff --git a/.github/workflows/add-comment-from-tag.yml b/.github/workflows/add-comment-from-tag.yml new file mode 100644 index 000000000..548f83eac --- /dev/null +++ b/.github/workflows/add-comment-from-tag.yml @@ -0,0 +1,28 @@ +# Based on a label applied to an issue, the bot will add a comment with some additional info + +name: π― Auto-Reply to Labeled Tickets +on: + issues: + types: + - labeled + - unlabeled + pull_request_target: + types: + - labeled + - unlabeled +permissions: + contents: read + issues: write + pull-requests: write + +jobs: + comment: + runs-on: ubuntu-20.04 + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Label Commenter + uses: peaceiris/actions-label-commenter@v1 + with: + config_file: .github/issue-auto-comments.yml + github_token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/check-merge-conflicts.yml b/.github/workflows/check-merge-conflicts.yml new file mode 100644 index 000000000..e1cbc9d0a --- /dev/null +++ b/.github/workflows/check-merge-conflicts.yml @@ -0,0 +1,16 @@ +# Detect and label pull requests that have merge conflicts +name: ποΈ Check Merge Conflicts +on: + push: + branches: + - staging +jobs: + check-conflicts: + runs-on: ubuntu-latest + steps: + - uses: mschilde/auto-label-merge-conflicts@master + with: + CONFLICT_LABEL_NAME: "π« Merge Conflicts" + GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + MAX_RETRIES: 5 + WAIT_MS: 5000 \ No newline at end of file diff --git a/.github/workflows/close-stale-issues.yml b/.github/workflows/close-stale-issues.yml new file mode 100644 index 000000000..1d34a6b1c --- /dev/null +++ b/.github/workflows/close-stale-issues.yml @@ -0,0 +1,82 @@ +# Closes any issues that no longer have user interaction +name: π― Close Stale Issues + +on: + workflow_dispatch: + schedule: + - cron: '0 0 * * *' # Runs every day at midnight UTC + +jobs: + stale: + runs-on: ubuntu-latest + + steps: + # Comment on, then close issues that haven't been updated for ages + - name: Close Stale Issues + uses: actions/stale@v4 + with: + repo-token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + days-before-stale: 360 + days-before-close: 5 + operations-per-run: 30 + remove-stale-when-updated: true + enable-statistics: true + stale-issue-message: > + This issue has gone 3 months without an update. To keep the ticket open, please indicate that it is still relevant in a comment below. + Otherwise it will be closed in 5 working days. + stale-pr-message: > + This PR is stale because it has been open 6 weeks with no activity. Either remove the stale label or comment below with a short update, + otherwise this PR will be closed in 5 days. + close-issue-message: > + This issue was automatically closed because it has been stalled for over 1 year with no activity. + close-pr-message: > + This pull request was automatically closed because it has been stalled for over 1 year with no activity. + stale-issue-label: 'β°οΈ Stale' + close-issue-label: 'πΈοΈ Inactive' + stale-pr-label: 'β°οΈ Stale' + close-pr-label: 'πΈοΈ Inactive' + exempt-issue-labels: 'π Keep Open' + exempt-pr-labels: 'π Keep Open' + labels-to-add-when-unstale: 'π Keep Open' + + # Comment on, then close issues that required a response from the user, but didn't get one + - name: Close Issues without Response + uses: actions/stale@v4 + with: + repo-token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + days-before-stale: 5 + days-before-close: 3 + operations-per-run: 30 + remove-stale-when-updated: true + stale-issue-message: > + Hi! Looks like additional info is required for this issue to be addressed. + Don't forget to provide this within the next few days to keep your ticket open. + close-issue-message: 'Issue closed due to no response from user.' + only-labels: 'π Awaiting User Response' + labels-to-remove-when-unstale: 'π Awaiting User Response, π No Response' + stale-issue-label: 'π No Response' + close-issue-label: 'πΈοΈ Inactive' + exempt-issue-labels: 'π Keep Open' + exempt-pr-labels: 'π Keep Open' + + # Comment on issues that we should have replied to + - name: Notify Repo Owner to Respond + uses: actions/stale@v4 + with: + repo-token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + days-before-stale: 7 + days-before-close: 365 + operations-per-run: 30 + remove-stale-when-updated: true + stale-issue-message: Hey SillyTavern, - Don't forget to respond! + stale-pr-message: Hey SillyTavern, - Don't forget to respond! + only-labels: 'π€ Awaiting Maintainer Response' + labels-to-remove-when-unstale: 'π€ Awaiting Maintainer Response' + close-issue-message: 'Closed due to no response from repo author for over a year' + close-pr-message: 'Closed due to no response from repo author for over a year' + stale-issue-label: 'π€ Awaiting Maintainer Response' + stale-pr-label: 'π€ Awaiting Maintainer Response' + close-issue-label: 'πΈοΈ Inactive' + close-pr-label: 'πΈοΈ Inactive' + exempt-issue-labels: 'π Keep Open' + exempt-pr-labels: 'π Keep Open' \ No newline at end of file diff --git a/.github/workflows/get-pr-size.yml b/.github/workflows/get-pr-size.yml new file mode 100644 index 000000000..ac5f9d4d3 --- /dev/null +++ b/.github/workflows/get-pr-size.yml @@ -0,0 +1,39 @@ +# Adds a comment to new PRs, showing the compressed size and size difference of new code +# And also labels the PR based on the number of lines changes + +name: π Check PR Size +on: [pull_request] +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + # Find and comment with compressed size + - name: Get Compressed Size + uses: preactjs/compressed-size-action@v2 + with: + repo-token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + pattern: './dist/**/*.{js,css,html}' + strip-hash: '\\b\\w{8}\\.' + exclude: '**/node_modules/**' + minimum-change-threshold: 100 + # Check number of lines of code added + - name: Label based on Lines of Code + uses: codelytv/pr-size-labeler@v1 + with: + GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + xs_max_size: '10' + s_max_size: '100' + m_max_size: '500' + l_max_size: '1000' + s_label: 'π© PR - Small' + m_label: 'π¨ PR - Medium' + l_label: 'π§ PR - Large' + xl_label: 'π₯ PR - XL' + fail_if_xl: 'false' + message_if_xl: > + It looks like this PR is very large (over 1000 lines). + Try to avoid addressing multiple issues in a single PR, and + in the future consider breaking large tasks down into smaller steps. + This it to make reviewing, testing, reverting and general quality management easier. \ No newline at end of file diff --git a/.github/workflows/manage-pending-labels-closed.yml b/.github/workflows/manage-pending-labels-closed.yml new file mode 100644 index 000000000..892f2f8f9 --- /dev/null +++ b/.github/workflows/manage-pending-labels-closed.yml @@ -0,0 +1,17 @@ +# When a new comment is added to an issue, if it had the Stale or Awaiting User Response labels, then those labels will be removed + +name: π― Remove Pending Labels on Close +on: + issues: + types: [closed] +jobs: + remove-labels: + runs-on: ubuntu-latest + steps: + - name: Remove Labels when Closed + uses: actions-cool/issues-helper@v2 + with: + actions: remove-labels + token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + issue-number: ${{ github.event.issue.number }} + labels: 'π Awaiting User Response,β°οΈ Stale,π€ Awaiting Maintainer Response' \ No newline at end of file diff --git a/.github/workflows/manage-pending-labels.yml b/.github/workflows/manage-pending-labels.yml new file mode 100644 index 000000000..44d91b523 --- /dev/null +++ b/.github/workflows/manage-pending-labels.yml @@ -0,0 +1,42 @@ +# When a new comment is added to an issue, if it had the Stale or Awaiting User Response labels, then those labels will be removed + +name: π― Add/ Remove Awaiting Response Labels +on: + issue_comment: + types: [created] +jobs: + remove-stale: + runs-on: ubuntu-latest + if: ${{ github.event.comment.author_association != 'COLLABORATOR' && github.event.comment.author_association != 'OWNER' }} + steps: + - name: Remove Stale labels when Updated + uses: actions-cool/issues-helper@v2 + with: + actions: remove-labels + token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + issue-number: ${{ github.event.issue.number }} + labels: 'π Awaiting User Response,β°οΈ Stale' + + add-awaiting-author: + runs-on: ubuntu-latest + if: ${{!github.event.issue.pull_request && github.event.comment.author_association != 'COLLABORATOR' && github.event.comment.author_association != 'OWNER' && github.event.issue.state == 'open' }} + steps: + - name: Add Awaiting Author labels when Updated + uses: actions-cool/issues-helper@v2 + with: + actions: add-labels + token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + issue-number: ${{ github.event.issue.number }} + labels: 'π€ Awaiting Maintainer Response' + + remove-awaiting-author: + runs-on: ubuntu-latest + if: ${{ github.event.comment.author_association == 'OWNER' }} + steps: + - name: Remove Awaiting Author labels when Updated + uses: actions-cool/issues-helper@v2 + with: + actions: remove-labels + token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + issue-number: ${{ github.event.issue.number }} + labels: 'π€ Awaiting Maintainer Response' \ No newline at end of file From 1c9b89fdcceee5ebadd17e9b34f23eb9f0b37eab Mon Sep 17 00:00:00 2001 From: deffcolony <61471128+deffcolony@users.noreply.github.com> Date: Tue, 16 Apr 2024 12:48:29 +0200 Subject: [PATCH 002/140] Create issue-auto-comments.yml --- .github/issue-auto-comments.yml | 62 +++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 .github/issue-auto-comments.yml diff --git a/.github/issue-auto-comments.yml b/.github/issue-auto-comments.yml new file mode 100644 index 000000000..8947d4e1a --- /dev/null +++ b/.github/issue-auto-comments.yml @@ -0,0 +1,62 @@ +comment: + footer: | + --- + > I am a bot, and this is an automated message π€ +labels: + - name: βοΈ Invalid + labeled: + issue: + action: close + body: > + Hello @{{ issue.user.login }} your ticket has been marked as invalid. + Please ensure you follow the issue template, provide all requested info, + and be sure to check the docs + previous issues prior to raising tickets. + pr: + body: Thank you @{{ pull_request.user.login }} for suggesting this. Please follow the pull request templates. + action: close + + - name: π©βπ» Good First Issue + labeled: + issue: + body: > + This issue has been marked as a good first issue for first-time contributors to implement! + This is a great way to support the project, while also improving your skills, you'll also be credited as a contributor once your PR is merged. + If you're new to SillyTavern [here are a collection of resources](https://docs.sillytavern.app/) + If you need any support at all, feel free to reach out via [Discord](https://discord.gg/sillytavern). + + - name: β wontfix + labeled: + issue: + action: close + body: > + This ticked has been marked as 'wontfix', which usually means it is out-of-scope, or not feasible at this time. + You can still fork the project and make the changes yourself. + + - name: β Fixed + labeled: + issue: + body: > + Hello @{{ issue.user.login }}! It looks like all or part of this issue has now been implemented. + + + - name: βΌοΈ High Priority + labeled: + issue: + body: > + This ticket has been marked as high priority, and has been bumped to the top of the priority list. + You should expect an implementation to be pushed out soon. Thank you for your patience. + + - name: π Spam + labeled: + issue: + action: close + locking: lock + lock_reason: spam + body: > + This issue has been identified as spam, and is now locked. + Users who repeatedly raise spam issues may be blocked or reported. + + - name: β Don't Merge + labeled: + pr: + body: This PR has been temporarily blocked from merging. \ No newline at end of file From f75daba6c0206f80e1d1a048df9546de5b847b9a Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Sun, 21 Apr 2024 23:38:18 +0300 Subject: [PATCH 003/140] Image inlining hint always visible --- public/css/toggle-dependent.css | 8 -------- 1 file changed, 8 deletions(-) diff --git a/public/css/toggle-dependent.css b/public/css/toggle-dependent.css index 30fb33bcf..834e31c31 100644 --- a/public/css/toggle-dependent.css +++ b/public/css/toggle-dependent.css @@ -433,14 +433,6 @@ body.expandMessageActions .mes .mes_buttons .extraMesButtonsHint { display: none !important; } -#openai_image_inlining:not(:checked)~#image_inlining_hint { - display: none; -} - -#openai_image_inlining:checked~#image_inlining_hint { - display: block; -} - #smooth_streaming:not(:checked)~#smooth_streaming_speed_control { display: none; } From bc9c70556e8e3ff8c07aaf7a0aed5dc307c0cecb Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Sun, 21 Apr 2024 23:53:46 +0300 Subject: [PATCH 004/140] Clean-up mentions of /public/ --- .github/workflows/update-docs.yml | 43 ------------------- Update-Instructions.txt | 18 +++++--- .../extensions/expressions/settings.html | 2 +- src/util.js | 6 +-- 4 files changed, 16 insertions(+), 53 deletions(-) delete mode 100644 .github/workflows/update-docs.yml diff --git a/.github/workflows/update-docs.yml b/.github/workflows/update-docs.yml deleted file mode 100644 index 567cac607..000000000 --- a/.github/workflows/update-docs.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: Update SillyTavern-Docs - -on: - push: - branches: - - main - -jobs: - update_docs: - runs-on: ubuntu-latest - - steps: - - name: Checkout current repository - uses: actions/checkout@v2 - - - name: Checkout SillyTavern-Docs repository - uses: actions/checkout@v2 - with: - repository: SillyTavern/SillyTavern-Docs - path: SillyTavern-Docs - - - name: Clone SillyTavern wiki into SillyTavern-Docs/extensions - run: rm -rf SillyTavern-Docs/extensions && git clone https://github.com/SillyTavern/SillyTavern.wiki.git SillyTavern-Docs/extensions && rm -rf SillyTavern-Docs/extensions/.git - - - name: Copy files - run: | - cp public/notes/content.md SillyTavern-Docs/guidebook.md - cp faq.md SillyTavern-Docs/faq.md - cp readme.md SillyTavern-Docs/readme.md - cp public/notes/update.md SillyTavern-Docs/update.md - - - name: Deploy to external repository - uses: cpina/github-action-push-to-another-repository@main - env: - SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }} - with: - # GitHub Action output files - source-directory: SillyTavern-Docs/ - destination-github-username: SillyTavern - destination-repository-name: SillyTavern-Docs - user-email: github-actions[bot]@users.noreply.github.com - user-name: "GitHub Actions" - target-branch: "main" diff --git a/Update-Instructions.txt b/Update-Instructions.txt index f153660b2..6e7071184 100644 --- a/Update-Instructions.txt +++ b/Update-Instructions.txt @@ -33,7 +33,14 @@ If you insist on installing via a zip, here is the tedious process for doing the 2. Unzip it into a folder OUTSIDE of your current ST installation. 3. Do the usual setup procedure for your OS to install the NodeJS requirements. -4. Copy the following files/folders as necessary(*) from your old ST installation: +4a. Updating 1.12.0 and above + +Copy the user data directory from your data root into the data root of the new install. + +By default: /data/default-user + +4a. Migrating from <1.12.0 to >=1.20.0 +Copy the following files/folders as necessary(*) from your old ST installation: - Assets - Backgrounds @@ -54,16 +61,15 @@ If you insist on installing via a zip, here is the tedious process for doing the - Worlds - User - settings.json - - secrets.json <---- this one is in the base folder, not /public/ + - secrets.json <---- This one is in the base folder, not /public/ (*) 'As necessary' = "If you made any custom content related to those folders". None of the folders are mandatory, so only copy what you need. **NB: DO NOT COPY THE ENTIRE /PUBLIC/ FOLDER.** Doing so could break the new install and prevent new features from being present. + Paste those items into the /data/default-user folder of the new install. -5. Paste those items into the /Public/ folder of the new install. +5. Start SillyTavern once again with the method appropriate to your OS, and pray you got it right. -6. Start SillyTavern once again with the method appropriate to your OS, and pray you got it right. - -7. If everything shows up, you can safely delete the old ST folder. +6. If everything shows up, you can safely delete the old ST folder. diff --git a/public/scripts/extensions/expressions/settings.html b/public/scripts/extensions/expressions/settings.html index 4a7347a74..e8b1484b2 100644 --- a/public/scripts/extensions/expressions/settings.html +++ b/public/scripts/extensions/expressions/settings.html @@ -78,7 +78,7 @@ Remove all image overrides -
Hint: Create new folder in the public/characters/ folder and name it as the name of the character. +
Hint: Create new folder in the /characters/ folder of your user data directory and name it as the name of the character. Put images with expressions there. File names should follow the pattern: [expression_label].[image_format]
diff --git a/src/util.js b/src/util.js index e1410eee8..ab19f3ccf 100644 --- a/src/util.js +++ b/src/util.js @@ -311,9 +311,9 @@ function tryParse(str) { } /** - * Takes a path to a client-accessible file in the `public` folder and converts it to a relative URL segment that the - * client can fetch it from. This involves stripping the `public/` prefix and always using `/` as the separator. - * @param {string} root The root directory of the public folder. + * Takes a path to a client-accessible file in the data folder and converts it to a relative URL segment that the + * client can fetch it from. This involves stripping the data root path prefix and always using `/` as the separator. + * @param {string} root The root directory of the user data folder. * @param {string} inputPath The path to be converted. * @returns The relative URL path from which the client can access the file. */ From df93d43c36de5ffe4cbb28930c6e68ad05f09388 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Mon, 22 Apr 2024 00:02:48 +0300 Subject: [PATCH 005/140] Remove obnoxious mobile padding on right panel --- public/css/mobile-styles.css | 2 ++ 1 file changed, 2 insertions(+) diff --git a/public/css/mobile-styles.css b/public/css/mobile-styles.css index 68534d8a2..8456d54a0 100644 --- a/public/css/mobile-styles.css +++ b/public/css/mobile-styles.css @@ -231,9 +231,11 @@ backdrop-filter: blur(calc(var(--SmartThemeBlurStrength) * 2)); } + /* #right-nav-panel { padding-right: 15px; } + */ #floatingPrompt, #cfgConfig, From 41ad7c5d266d33b9432ab94b5cded10ffab29f1a Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Mon, 22 Apr 2024 02:34:50 +0300 Subject: [PATCH 006/140] Verify data bank attachments --- public/scripts/chats.js | 52 ++++++++++++++++++++++++++++++++++++++--- src/endpoints/files.js | 25 ++++++++++++++++++++ 2 files changed, 74 insertions(+), 3 deletions(-) diff --git a/public/scripts/chats.js b/public/scripts/chats.js index a4082f6f0..19e316fa5 100644 --- a/public/scripts/chats.js +++ b/public/scripts/chats.js @@ -592,9 +592,10 @@ async function deleteMessageImage() { /** * Deletes file from the server. * @param {string} url Path to the file on the server + * @param {boolean} [silent=false] If true, do not show error messages * @returns {Promisehttps://wiki.hoyolab.com/pc/hsr/entry/X
+
+ Example:
+ 14
+
+