mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Merge branch 'main' into dev
This commit is contained in:
@@ -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}`);
|
||||||
}
|
}
|
||||||
|
40
poe_graphql/SendMessageMutation.graphql
Normal file
40
poe_graphql/SendMessageMutation.graphql
Normal 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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user