Merge branch 'main' into pkg

This commit is contained in:
SillyLossy
2023-05-16 20:26:22 +03:00
10 changed files with 125 additions and 11 deletions

View File

@ -30,6 +30,7 @@ Providing the logs from the browser DevTools console (opened by pressing the F12
**Desktop (please complete the following information):** **Desktop (please complete the following information):**
- OS/Device: [e.g. Windows 11] - OS/Device: [e.g. Windows 11]
- Environment: [cloud, local] - Environment: [cloud, local]
- Node.js version (if applicable): [run `node --version` in cmd]
- Browser [e.g. chrome, safari] - Browser [e.g. chrome, safari]
- Generation API [e.g. KoboldAI, OpenAI] - Generation API [e.g. KoboldAI, OpenAI]
- Branch [main, dev] - Branch [main, dev]

View File

@ -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 }}

View File

@ -521,7 +521,7 @@ class Client {
console.log(`Sending message to ${chatbot}: ${message}`); console.log(`Sending message to ${chatbot}: ${message}`);
const messageData = await this.send_query("AddHumanMessageMutation", { const messageData = await this.send_query("SendMessageMutation", {
"bot": chatbot, "bot": chatbot,
"query": message, "query": message,
"chatId": this.bots[chatbot]["chatId"], "chatId": this.bots[chatbot]["chatId"],
@ -531,14 +531,14 @@ class Client {
delete this.active_messages["pending"]; delete this.active_messages["pending"];
if (!messageData["data"]["messageCreateWithStatus"]["messageLimit"]["canSend"]) { if (!messageData["data"]["messageEdgeCreate"]["message"]) {
throw new Error(`Daily limit reached for ${chatbot}.`); throw new Error(`Daily limit reached for ${chatbot}.`);
} }
let humanMessageId; let humanMessageId;
try { try {
const humanMessage = messageData["data"]["messageCreateWithStatus"]; const humanMessage = messageData["data"]["messageEdgeCreate"]["message"];
humanMessageId = humanMessage["message"]["messageId"]; humanMessageId = humanMessage["node"]["messageId"];
} catch (error) { } catch (error) {
throw new Error(`An unknown error occured. Raw response data: ${messageData}`); throw new Error(`An unknown error occured. Raw response data: ${messageData}`);
} }

View File

@ -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
}
}
}

View File

@ -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
}

View File

@ -1369,7 +1369,12 @@ function getExtensionPrompt(position = 0, depth = undefined, separator = "\n") {
function baseChatReplace(value, name1, name2) { function baseChatReplace(value, name1, name2) {
if (value !== undefined && value.length > 0) { 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(/<USER>:/gi, 'You:');
}
value = substituteParams(value, name1, name2);
if (power_user.collapse_newlines) { if (power_user.collapse_newlines) {
value = collapseNewlines(value); value = collapseNewlines(value);

View File

@ -527,6 +527,7 @@ code {
grid-column-start: 4; grid-column-start: 4;
flex-flow: column; flex-flow: column;
font-size: 30px; font-size: 30px;
cursor: pointer;
} }
.swipe_right img, .swipe_right img,

View File

@ -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. 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: 6. Once the black box (Command Prompt) pops up, type ONE of the following into it and press Enter:
* for Main Branch: `git clone <https://github.com/Cohee1207/SillyTavern> -b main` * for Main Branch: `git clone https://github.com/Cohee1207/SillyTavern -b main`
* for Dev Branch: `git clone <https://github.com/Cohee1207/SillyTavern> -b dev` * 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. 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. 8. The server will then start, and SillyTavern will popup in your browser.

View File

@ -861,7 +861,7 @@ async function charaWrite(img_url, data, target_img, response = undefined, mes =
let rawImg = await jimp.read(img_url); let rawImg = await jimp.read(img_url);
// Apply crop if defined // 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); rawImg = rawImg.crop(crop.x, crop.y, crop.width, crop.height);
} }
@ -2438,7 +2438,13 @@ app.post("/openai_bias", jsonParser, async function (request, response) {
// Shamelessly stolen from Agnai // Shamelessly stolen from Agnai
app.post("/openai_usage", jsonParser, async function (request, response) { app.post("/openai_usage", jsonParser, async function (request, response) {
if (!request.body) return response.sendStatus(400); 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 api_url = new URL(request.body.reverse_proxy || api_openai).toString();
const headers = { const headers = {

View File

@ -30,4 +30,4 @@ echo "Installing Node Modules..."
npm i npm i
echo "Entering SillyTavern..." echo "Entering SillyTavern..."
node server.js node "$(dirname "$0")/server.js"