mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Fix messages deletion for poe
This commit is contained in:
4
poe.js
4
poe.js
@ -376,7 +376,7 @@ class Client {
|
|||||||
|
|
||||||
async purge_conversation(chatbot, count = -1) {
|
async purge_conversation(chatbot, count = -1) {
|
||||||
logger.info(`Purging messages from ${chatbot}`);
|
logger.info(`Purging messages from ${chatbot}`);
|
||||||
let last_messages = (await this.get_message_history(chatbot, count = 50)).reverse();
|
let last_messages = (await this.get_message_history(chatbot, 50)).reverse();
|
||||||
while (last_messages.length) {
|
while (last_messages.length) {
|
||||||
const message_ids = [];
|
const message_ids = [];
|
||||||
for (const message of last_messages) {
|
for (const message of last_messages) {
|
||||||
@ -392,7 +392,7 @@ class Client {
|
|||||||
if (count === 0) {
|
if (count === 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
last_messages = (await this.get_message_history(chatbot, count = 50)).reverse();
|
last_messages = (await this.get_message_history(chatbot, 50)).reverse();
|
||||||
}
|
}
|
||||||
logger.info("No more messages left to delete.");
|
logger.info("No more messages left to delete.");
|
||||||
}
|
}
|
||||||
|
@ -1652,7 +1652,7 @@ app.post('/purge_poe', jsonParser, async (request, response) => {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const client = await getPoeClient(token);
|
const client = await getPoeClient(token);
|
||||||
await client.purge_conversation(bot, count)
|
await client.purge_conversation(bot, count);
|
||||||
client.disconnect_ws();
|
client.disconnect_ws();
|
||||||
|
|
||||||
return response.send({"ok" : true});
|
return response.send({"ok" : true});
|
||||||
|
Reference in New Issue
Block a user