JanitorAI Personality Snatcher

Steals JanitorAI bot descriptions.

< Commentaires sur JanitorAI Personality Snatcher

Avis: Mauvais - le script ne fonctionne pas

§
Posté le: 2025-03-06

"Less than two occurrences of "'s Persona: " and "Error parsing JSON: SyntaxError: Unexpected token 'e', "en=GA%3Aap" are popping up for me, i dont know what these things mean i assume a janitor ai update broke this some time ago

§
Posté le: 2025-03-16

Deepseek fixed code for me. Now it gives out a description of the character, I checked. Replace part of the code with this. When the script asked "Send a message or reload previous bot message to obtain description."write something in the chat with the bot and send it. The txt file is downloaded automatically. It not json but still have character definition.Caution: replace only the lower part of the original script, which begins with (function() {.


(function() {
'use strict';

// Function to download a file
function downloadFile(filename, text) {
const blob = new Blob([text], { type: 'text/plain' });
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = filename;
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
URL.revokeObjectURL(url);
}

// Create the button
const button = document.createElement('button');
button.innerText = 'Steal Personality';
button.style.position = 'fixed';
button.style.top = '8px';
button.style.left = '50%';
button.style.transform = 'translate(-50%, 0)';
button.style.padding = '5px 8px';
button.style.borderRadius = '6px';
button.style.backgroundColor = 'rgba(128, 90, 213, 0.6)';
button.style.color = 'var(--chakra-colors-whiteAlpha-800)';
button.style.border = 'none';
button.style.cursor = 'pointer';
button.style.zIndex = '9999';
button.style.fontFamily = 'var(--chakra-fonts-body)';
button.style.lineHeight = '1';
button.style.fontSize = '14px';

let requestCount = 0;

// Function to log fetch requests
function logFetchRequests() {
const originalFetch = window.fetch;
button.style.backgroundColor = 'rgba(169, 20, 20, 0.6)';
window.fetch = async (...args) => {
requestCount++;

if (requestCount === 2) {
const requestBody = args[1]?.body;

if (requestBody) {
let bodyText;

if (typeof requestBody === 'string') {
bodyText = requestBody;
} else if (requestBody instanceof Blob) {
bodyText = await requestBody.text();
} else if (requestBody instanceof FormData) {
bodyText = JSON.stringify(Object.fromEntries(requestBody.entries()));
} else {
console.error('Unsupported request body type:', requestBody);
alert('Unsupported request body type.');
return originalFetch(...args);
}

try {
const jsonBody = JSON.parse(bodyText); // Parse JSON
const messages = jsonBody.messages;

if (Array.isArray(messages) && messages.length > 0) {
const content = messages[0].content;
const occurrences = content.split("'s Persona: ");

let result;
if (occurrences.length > 2) {
result = occurrences.slice(2).join("'s Persona: ");
const systemNoteIndex = result.indexOf("[System note");

if (systemNoteIndex !== -1) {
result = result.substring(0, systemNoteIndex).trim();
}
result = 'Personality: ' + result;
} else {
// If there are less than two occurrences, use the entire text
result = content;
}

// Download the file with the result
downloadFile('personality.txt', result);
alert('File downloaded with personality data.');
button.style.backgroundColor = 'rgba(128, 90, 213, 0.6)';
} else {
alert('No messages found or messages is not an array.');
button.style.backgroundColor = 'rgba(128, 90, 213, 0.6)';
}
} catch (error) {
console.error('Error parsing JSON:', error);
alert('Error parsing JSON: ' + error.message);
button.style.backgroundColor = 'rgba(128, 90, 213, 0.6)';
}
} else {
alert('Request body is empty.');
button.style.backgroundColor = 'rgba(128, 90, 213, 0.6)';
}

requestCount = 0; // Reset the counter
}

return originalFetch(...args);
};
}

// Add a click event listener to the button
button.addEventListener('click', () => {
requestCount = 0;
logFetchRequests();
alert('Send a message or reload previous bot message to obtain description.');
});

// Append the button to the body
document.body.appendChild(button);
})();

§
Posté le: 2025-03-16

the code got corrupted in my comment.Couldn't edit the comment. Here is the correct code:

https://drive.google.com/file/d/1XpspEou8qL40ZvOhB4UMP_tyO5VjNWC8/view?usp=sharing

§
Posté le: 2025-04-16

It keepts saying [Request body is empty] What am I doing wrong?

§
Posté le: 2025-04-16

And also [Unsupported request body type.]

§
Posté le: 2025-04-16
Édité le: 2025-04-16

It situation same with me somewhy. first time fixed script was work, but after stopped work right .Then i try it. now i use it way: https://github.com/ashuotaku/sillytavern/commit/9c41006c68d1a5e63cd8a7fff39059984a4f7bc8 i just insert node server.js
instead API_KEY=custom-key nodemon server.js it way get definitions still work for me

§
Posté le: 2025-05-29

Wow okay, so I used the new instructions from the link you sent me and it for sure works! Thanks man, I appreciate it!

Poster une réponse

Connectez-vous pour poster une réponse.

长期地址
遇到问题?请前往 GitHub 提 Issues。