Merge remote-tracking branch 'origin/main' into sd_inline_image_generation

This commit is contained in:
Sumit Kumar
2023-05-16 15:58:41 +05:30
6 changed files with 49 additions and 8 deletions

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

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

@ -860,7 +860,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);
} }