Merge branch 'main' into dev

This commit is contained in:
SillyLossy
2023-05-16 11:19:59 +03:00
2 changed files with 44 additions and 4 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
}
}
}