Greasy Fork is available in English.

SpicyChat.AI Utilities

Unlock queue & a maybe working model changer.

< Feedback on SpicyChat.AI Utilities

Review: OK - script works, but has bugs

§
Posted: 2024-07-29

I modded your code to this:
https://drive.google.com/file/d/1pgohgwEUMcpr1SXU_jP8Ym6dntFdYKAV/view?usp=sharing

(function() {
'use strict';

console.log("Script loaded, probably!");
XMLHttpRequest.prototype.realSend = XMLHttpRequest.prototype.send;
XMLHttpRequest.prototype.send = function(data) {
if (data !== undefined) {
try {
let payload = JSON.parse(data);
if (payload && payload.inference_model !== undefined) { // Model changer
console.log("Original payload:", payload);

// Find the correct suffix for the localStorage keys
const suffix = "7f002c92-988b-42e9-97db-a019228db5ac";

payload['inference_model'] = localStorage.getItem(`inference_model_${suffix}`) || "wizardlm2-8x22b";

if (payload['inference_settings']) {
payload['inference_settings']['max_new_tokens'] = parseInt(localStorage.getItem(`inference_max_new_tokens_${suffix}`)) || 180;
payload['inference_settings']['temperature'] = parseFloat(localStorage.getItem(`inference_temperature_${suffix}`)) || 0.7;
payload['inference_settings']['top_p'] = parseFloat(localStorage.getItem(`inference_top-p_${suffix}`)) || 0.7;
payload['inference_settings']['top_k'] = parseInt(localStorage.getItem(`inference_top-k_${suffix}`)) || 90;
}

data = JSON.stringify(payload);

console.log("Modified payload:", payload);
}
} catch (e) {
console.error("Error parsing data:", e);
}
}

this.addEventListener('readystatechange', function() {
if (this.responseURL.includes("queue")) { // Queue bypass
if (this.readyState === XMLHttpRequest.DONE && this.status === 200) {
Object.defineProperty(this, "responseText", {writable: true});
this.responseText = '{"status":"access"}';
}
}
});

this.realSend(data);
};
})();



and now it appears like this. not sure if it works

§
Posted: 2024-07-30

never mind still needs a fix this code too

§
Posted: 2024-08-02

Okay i KINDA understand what you're doing, ignore my previous comments, thanks for this and i'll look into it!

§
Posted: 2024-08-02
Edited: 2024-08-02

the suffix is your guest id btw, which is also stored in localstorage, ill update the code and work around with this i guess.

Post reply

Sign in to post a reply.