From 368df653378b6fa72924c5dd077998e5b52ec0bb Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Sat, 6 Apr 2024 15:55:06 +0300 Subject: [PATCH 1/8] Update docker-publish.yml --- .github/workflows/docker-publish.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 588fcd80c..a87527778 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -12,7 +12,7 @@ on: env: # This should allow creation of docker images even in forked repositories - IMAGE_NAME: ${{ github.repository }} + REPO: ${{ github.repository }} REGISTRY: ghcr.io jobs: @@ -20,6 +20,11 @@ jobs: runs-on: ubuntu-latest steps: + ## Workaround for GitHub repo names containing uppercase characters + - name: set lowercase repo name + run: | + echo "IMAGE_NAME=${REPO,,}" >>${GITHUB_ENV} + # Using the following workaround because currently GitHub Actions # does not support logical AND/OR operations on triggers # It's currently not possible to have `branches` under the `schedule` trigger From 679a2496741d03185dba31a55e3b97a3d68b4c53 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Sat, 6 Apr 2024 16:00:42 +0300 Subject: [PATCH 2/8] Update docker-publish.yml --- .github/workflows/docker-publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index a87527778..e6d1653df 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -21,7 +21,7 @@ jobs: steps: ## Workaround for GitHub repo names containing uppercase characters - - name: set lowercase repo name + - name: Set lowercase repo name run: | echo "IMAGE_NAME=${REPO,,}" >>${GITHUB_ENV} From b4fcfcd6d65ad0dc72a1e8b07516220b28c7ad71 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Sat, 6 Apr 2024 16:01:58 +0300 Subject: [PATCH 3/8] Update docker-publish.yml --- .github/workflows/docker-publish.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index e6d1653df..81682466c 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -9,6 +9,10 @@ on: schedule: # Build the staging image everyday at 00:00 UTC - cron: "0 0 * * *" + push: + # Temporary workaround + branches: + - release env: # This should allow creation of docker images even in forked repositories From 48295bc3786767d4f646aaea70dbf08a15c0cb56 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Sat, 6 Apr 2024 16:04:05 +0300 Subject: [PATCH 4/8] Update docker-publish.yml --- .github/workflows/docker-publish.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 81682466c..c4556c520 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -32,12 +32,18 @@ jobs: # Using the following workaround because currently GitHub Actions # does not support logical AND/OR operations on triggers # It's currently not possible to have `branches` under the `schedule` trigger - - name: Checkout the release branch + - name: Checkout the release branch (on release) if: ${{ github.event_name == 'release' }} uses: actions/checkout@v3 with: ref: "release" + - name: Checkout the release branch (on push) + if: ${{ github.event_name == 'push' }} + uses: actions/checkout@v3 + with: + ref: "release" + - name: Checkout the staging branch if: ${{ github.event_name == 'schedule' }} uses: actions/checkout@v3 From 299ee3ae90cfb9370c2a0f5459a1d51f9fb44fe2 Mon Sep 17 00:00:00 2001 From: caesarw Date: Sun, 7 Apr 2024 14:31:48 +0000 Subject: [PATCH 5/8] Fix the wrong tags for the scheduled nightly build * simplified the checkout process * fixed the wrong tags for the scheduled builds (used to be `release`, now it should be `staging`) * upgraded the `checkout` action to v4.1.2 (no warnings anymore) --- .github/workflows/docker-publish.yml | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index c4556c520..9bb3a2cc5 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -24,32 +24,34 @@ jobs: runs-on: ubuntu-latest steps: - ## Workaround for GitHub repo names containing uppercase characters + # Workaround for GitHub repo names containing uppercase characters - name: Set lowercase repo name run: | - echo "IMAGE_NAME=${REPO,,}" >>${GITHUB_ENV} + echo "IMAGE_NAME=${REPO,,}" >> ${GITHUB_ENV} # Using the following workaround because currently GitHub Actions # does not support logical AND/OR operations on triggers # It's currently not possible to have `branches` under the `schedule` trigger - name: Checkout the release branch (on release) - if: ${{ github.event_name == 'release' }} - uses: actions/checkout@v3 - with: - ref: "release" - - - name: Checkout the release branch (on push) - if: ${{ github.event_name == 'push' }} - uses: actions/checkout@v3 + if: ${{ github.event_name == 'release' || github.event_name == 'push' }} + uses: actions/checkout@v4.1.2 with: ref: "release" - name: Checkout the staging branch if: ${{ github.event_name == 'schedule' }} - uses: actions/checkout@v3 + uses: actions/checkout@v4.1.2 with: ref: "staging" + # Get current branch name + # This is also part of the workaround for Actions not allowing logical + # AND/OR operators on triggers + # Otherwise the action triggered by schedule always has ref_name = release + - name: Get the current branch name + run: | + echo "BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)" >> ${GITHUB_ENV} + # Setting up QEMU for multi-arch image build - name: Set up QEMU uses: docker/setup-qemu-action@v3 @@ -62,7 +64,7 @@ jobs: id: metadata with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - tags: ${{ github.ref_name }} + tags: ${{ env.BRANCH_NAME }} # Login into package repository as the person who created the release - name: Log in to the Container registry From 2411a7480e926a76275566d487345bec471ec02d Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Tue, 9 Apr 2024 16:20:38 +0300 Subject: [PATCH 6/8] Add deprecated endpoint redirection --- server.js | 1 + 1 file changed, 1 insertion(+) diff --git a/server.js b/server.js index b6f59f0a3..81c1a3119 100644 --- a/server.js +++ b/server.js @@ -341,6 +341,7 @@ redirect('/savequickreply', '/api/quick-replies/save'); // Redirect deprecated image endpoints redirect('/uploadimage', '/api/images/upload'); redirect('/listimgfiles/:folder', '/api/images/list/:folder'); +redirect('/api/content/import', '/api/content/importURL'); // Redirect deprecated moving UI endpoints redirect('/savemovingui', '/api/moving-ui/save'); From 4f83782430adca851faafc774b3edf7ed44f157d Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Tue, 9 Apr 2024 19:06:10 +0300 Subject: [PATCH 7/8] Fix double count of chat injects for message fitting logic --- public/script.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/public/script.js b/public/script.js index 18e15e8e2..c57d4c93b 100644 --- a/public/script.js +++ b/public/script.js @@ -3466,7 +3466,6 @@ async function Generate(type, { automatic_trigger, force_name2, quiet_prompt, qu // Add persona description to prompt addPersonaDescriptionExtensionPrompt(); // Call combined AN into Generate - let allAnchors = getAllExtensionPrompts(); const beforeScenarioAnchor = getExtensionPrompt(extension_prompt_types.BEFORE_PROMPT).trimStart(); const afterScenarioAnchor = getExtensionPrompt(extension_prompt_types.IN_PROMPT); @@ -3513,10 +3512,11 @@ async function Generate(type, { automatic_trigger, force_name2, quiet_prompt, qu function getMessagesTokenCount() { const encodeString = [ + beforeScenarioAnchor, storyString, + afterScenarioAnchor, examplesString, chatString, - allAnchors, quiet_prompt, cyclePrompt, userAlignmentMessage, @@ -3784,12 +3784,13 @@ async function Generate(type, { automatic_trigger, force_name2, quiet_prompt, qu console.debug('---checking Prompt size'); setPromptString(); const prompt = [ + beforeScenarioAnchor, storyString, + afterScenarioAnchor, mesExmString, mesSend.map((e) => `${e.extensionPrompts.join('')}${e.message}`).join(''), '\n', generatedPromptCache, - allAnchors, quiet_prompt, ].join('').replace(/\r/gm, ''); let thisPromptContextSize = getTokenCount(prompt, power_user.token_padding); @@ -4025,7 +4026,7 @@ async function Generate(type, { automatic_trigger, force_name2, quiet_prompt, qu ...thisPromptBits[currentArrayEntry], rawPrompt: generate_data.prompt || generate_data.input, mesId: getNextMessageId(type), - allAnchors: allAnchors, + allAnchors: '', summarizeString: (extension_prompts['1_memory']?.value || ''), authorsNoteString: (extension_prompts['2_floating_prompt']?.value || ''), smartContextString: (extension_prompts['chromadb']?.value || ''), From 8ae9212cc5778675cada764fb2ce30bc7d912318 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Sat, 13 Apr 2024 20:01:17 +0300 Subject: [PATCH 8/8] #2075 Fix Draw Things auth --- src/endpoints/stable-diffusion.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/endpoints/stable-diffusion.js b/src/endpoints/stable-diffusion.js index e2168cd80..cc014f0e6 100644 --- a/src/endpoints/stable-diffusion.js +++ b/src/endpoints/stable-diffusion.js @@ -684,15 +684,17 @@ drawthings.post('/generate', jsonParser, async (request, response) => { const url = new URL(request.body.url); url.pathname = '/sdapi/v1/txt2img'; - const body = {...request.body}; + const body = { ...request.body }; + const auth = getBasicAuthHeader(request.body.auth); delete body.url; + delete body.auth; const result = await fetch(url, { method: 'POST', body: JSON.stringify(body), headers: { 'Content-Type': 'application/json', - 'Authorization': getBasicAuthHeader(request.body.auth), + 'Authorization': auth, }, timeout: 0, });