From 33042f6deaa01843805e1f471ffcb7aa21c44c1b Mon Sep 17 00:00:00 2001 From: Cohee Date: Mon, 15 May 2023 00:59:32 +0300 Subject: [PATCH 01/11] Update bug_report.md --- .github/ISSUE_TEMPLATE/bug_report.md | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 614d2e5f2..2dd35f857 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -30,6 +30,7 @@ Providing the logs from the browser DevTools console (opened by pressing the F12 **Desktop (please complete the following information):** - OS/Device: [e.g. Windows 11] - Environment: [cloud, local] + - Node.js version (if applicable): [run `node --version` in cmd] - Browser [e.g. chrome, safari] - Generation API [e.g. KoboldAI, OpenAI] - Branch [main, dev] From ee2ecd6d4bf9dde8e5a60864b3e31dfe4b51bbbe Mon Sep 17 00:00:00 2001 From: bcp-hayden Date: Sun, 14 May 2023 17:10:09 -0600 Subject: [PATCH 02/11] Update start.sh to dynamically select directory for start.sh --- start.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/start.sh b/start.sh index 57c73369f..137b5f7de 100755 --- a/start.sh +++ b/start.sh @@ -30,4 +30,4 @@ echo "Installing Node Modules..." npm i echo "Entering SillyTavern..." -node server.js +node "$(dirname "$0")/server.js" \ No newline at end of file From 08a25d2fbf53dce5b25e90a49593cb1b1cbe750a Mon Sep 17 00:00:00 2001 From: Sanskar Tiwari Date: Mon, 15 May 2023 23:23:53 +0530 Subject: [PATCH 03/11] add llama-precise settings --- public/TextGen Settings/LLaMa-Precise.settings | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 public/TextGen Settings/LLaMa-Precise.settings diff --git a/public/TextGen Settings/LLaMa-Precise.settings b/public/TextGen Settings/LLaMa-Precise.settings new file mode 100644 index 000000000..1eedb3d74 --- /dev/null +++ b/public/TextGen Settings/LLaMa-Precise.settings @@ -0,0 +1,15 @@ +{ + "temp": 0.7, + "top_p": 0.1, + "top_k": 40, + "typical_p": 1, + "rep_pen": 1.18, + "no_repeat_ngram_size": 0, + "penalty_alpha": 0, + "num_beams": 1, + "length_penalty": 1, + "min_length": 200, + "encoder_rep_pen": 1, + "do_sample": true, + "early_stopping": false +} \ No newline at end of file From 6bb44b95b04d6d59e44b64d21f7aa0bc2a11cfc5 Mon Sep 17 00:00:00 2001 From: SillyLossy Date: Tue, 16 May 2023 00:53:33 +0300 Subject: [PATCH 04/11] Fix OAI key usage --- server.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/server.js b/server.js index 7aee9bb00..2308c2a16 100644 --- a/server.js +++ b/server.js @@ -2437,7 +2437,13 @@ app.post("/openai_bias", jsonParser, async function (request, response) { // Shamelessly stolen from Agnai app.post("/openai_usage", jsonParser, async function (request, response) { if (!request.body) return response.sendStatus(400); - const key = request.body.key; + const key = readSecret(SECRET_KEYS.OPENAI); + + if (!key) { + console.warn('Get key usage failed: Missing OpenAI API key.'); + return response.sendStatus(401); + } + const api_url = new URL(request.body.reverse_proxy || api_openai).toString(); const headers = { From 1ec3352f393de9b1e4f1eaedc862a03259533fe1 Mon Sep 17 00:00:00 2001 From: SillyLossy Date: Tue, 16 May 2023 01:17:37 +0300 Subject: [PATCH 05/11] Revert pygmalion formatting of substitution parameters #317 --- public/script.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/public/script.js b/public/script.js index cd49c03a4..b1c98b2fa 100644 --- a/public/script.js +++ b/public/script.js @@ -1369,7 +1369,12 @@ function getExtensionPrompt(position = 0, depth = undefined, separator = "\n") { function baseChatReplace(value, name1, name2) { if (value !== undefined && value.length > 0) { - value = substituteParams(value, is_pygmalion ? "You" : name1, name2); + if (is_pygmalion) { + value = value.replace(/{{user}}:/gi, 'You:'); + value = value.replace(/:/gi, 'You:'); + } + + value = substituteParams(value, name1, name2); if (power_user.collapse_newlines) { value = collapseNewlines(value); From b1acf1532e7404ed8deb745732c9296a8a2e280c Mon Sep 17 00:00:00 2001 From: Sanskar Tiwari Date: Tue, 16 May 2023 04:42:50 +0530 Subject: [PATCH 06/11] make swipe button cursor pointer since it is a button --- public/style.css | 1 + 1 file changed, 1 insertion(+) diff --git a/public/style.css b/public/style.css index 0d415f11d..c60b711dc 100644 --- a/public/style.css +++ b/public/style.css @@ -527,6 +527,7 @@ code { grid-column-start: 4; flex-flow: column; font-size: 30px; + cursor: pointer; } .swipe_right img, From b823d40df690bc6a2ce4d16dc9e8db7c31a6432a Mon Sep 17 00:00:00 2001 From: Sanskar Tiwari Date: Tue, 16 May 2023 04:44:10 +0530 Subject: [PATCH 07/11] ocd whitespace --- public/script.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/script.js b/public/script.js index b1c98b2fa..dab17418d 100644 --- a/public/script.js +++ b/public/script.js @@ -2743,7 +2743,7 @@ function saveReply(type, getMessage, this_mes_is_name, title) { } else { item['swipe_id'] = 0; item['swipes'] = []; - item['swipes'][0] = chat[chat.length - 1]['mes']; + item['swipes'][0] = chat[chat.length - 1]['mes']; } return { type, getMessage }; From bd2bcf6e9d7f8c88508c9842a4529238e2916e24 Mon Sep 17 00:00:00 2001 From: Cohee Date: Tue, 16 May 2023 10:17:01 +0300 Subject: [PATCH 08/11] Update readme.md --- readme.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/readme.md b/readme.md index 2a4b3ac3b..5b6a380fe 100644 --- a/readme.md +++ b/readme.md @@ -136,8 +136,8 @@ Easy to follow guide with pretty pictures: 5. Open a Command Prompt inside that folder by clicking in the 'Address Bar' at the top, typing `cmd`, and pressing Enter. 6. Once the black box (Command Prompt) pops up, type ONE of the following into it and press Enter: - * for Main Branch: `git clone -b main` - * for Dev Branch: `git clone -b dev` + * for Main Branch: `git clone https://github.com/Cohee1207/SillyTavern -b main` + * for Dev Branch: `git clone https://github.com/Cohee1207/SillyTavern -b dev` 7. Once everything is cloned, double click `Start.bat` to make NodeJS install its requirements. 8. The server will then start, and SillyTavern will popup in your browser. From 1bfb5637b0395d05facca0c119caa9fa05bcbfb2 Mon Sep 17 00:00:00 2001 From: SillyLossy Date: Tue, 16 May 2023 10:37:52 +0300 Subject: [PATCH 09/11] Check for crop arguments before applying it --- server.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server.js b/server.js index 7aee9bb00..30688bb25 100644 --- a/server.js +++ b/server.js @@ -860,7 +860,7 @@ async function charaWrite(img_url, data, target_img, response = undefined, mes = let rawImg = await jimp.read(img_url); // Apply crop if defined - if (typeof crop == 'object') { + if (typeof crop == 'object' && [crop.x, crop.y, crop.width, crop.height].every(x => typeof x === 'number')) { rawImg = rawImg.crop(crop.x, crop.y, crop.width, crop.height); } From 849c82b6f706dd0e07816188f88e3f94b8815d46 Mon Sep 17 00:00:00 2001 From: SillyLossy Date: Tue, 16 May 2023 11:19:38 +0300 Subject: [PATCH 10/11] Fix Poe message sending --- poe-client.js | 8 ++--- poe_graphql/SendMessageMutation.graphql | 40 +++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 4 deletions(-) create mode 100644 poe_graphql/SendMessageMutation.graphql diff --git a/poe-client.js b/poe-client.js index 2f8798924..985ba16b9 100644 --- a/poe-client.js +++ b/poe-client.js @@ -521,7 +521,7 @@ class Client { console.log(`Sending message to ${chatbot}: ${message}`); - const messageData = await this.send_query("AddHumanMessageMutation", { + const messageData = await this.send_query("SendMessageMutation", { "bot": chatbot, "query": message, "chatId": this.bots[chatbot]["chatId"], @@ -531,14 +531,14 @@ class Client { delete this.active_messages["pending"]; - if (!messageData["data"]["messageCreateWithStatus"]["messageLimit"]["canSend"]) { + if (!messageData["data"]["messageEdgeCreate"]["message"]) { throw new Error(`Daily limit reached for ${chatbot}.`); } let humanMessageId; try { - const humanMessage = messageData["data"]["messageCreateWithStatus"]; - humanMessageId = humanMessage["message"]["messageId"]; + const humanMessage = messageData["data"]["messageEdgeCreate"]["message"]; + humanMessageId = humanMessage["node"]["messageId"]; } catch (error) { throw new Error(`An unknown error occured. Raw response data: ${messageData}`); } diff --git a/poe_graphql/SendMessageMutation.graphql b/poe_graphql/SendMessageMutation.graphql new file mode 100644 index 000000000..4b0a4383e --- /dev/null +++ b/poe_graphql/SendMessageMutation.graphql @@ -0,0 +1,40 @@ +mutation chatHelpers_sendMessageMutation_Mutation( + $chatId: BigInt! + $bot: String! + $query: String! + $source: MessageSource + $withChatBreak: Boolean! +) { + messageEdgeCreate(chatId: $chatId, bot: $bot, query: $query, source: $source, withChatBreak: $withChatBreak) { + chatBreak { + cursor + node { + id + messageId + text + author + suggestedReplies + creationTime + state + } + id + } + message { + cursor + node { + id + messageId + text + author + suggestedReplies + creationTime + state + chat { + shouldShowDisclaimer + id + } + } + id + } + } +} From 843e7a83637d3333460b3c351de0142e9424ddec Mon Sep 17 00:00:00 2001 From: Cohee Date: Tue, 16 May 2023 20:24:32 +0300 Subject: [PATCH 11/11] Create build-and-publish-release-main.yml --- .../build-and-publish-release-main.yml | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/build-and-publish-release-main.yml diff --git a/.github/workflows/build-and-publish-release-main.yml b/.github/workflows/build-and-publish-release-main.yml new file mode 100644 index 000000000..6746f6897 --- /dev/null +++ b/.github/workflows/build-and-publish-release-main.yml @@ -0,0 +1,46 @@ +name: Build and Publish Release (Main) + +on: + push: + branches: + - main + +jobs: + build_and_publish: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up Node.js + uses: actions/setup-node@v2 + with: + node-version: 18 + + - name: Install dependencies + run: npm ci + + - name: Build and package with pkg + run: | + npm install -g pkg + npm run pkg + + - name: Create or update release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: continuous-release-main + release_name: Continuous Release (Main) + draft: false + prerelease: true + + - name: Upload binaries to release + uses: softprops/action-gh-release@v1 + with: + files: dist/* + release_id: ${{ steps.create_release.outputs.id }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}