Spicychat.ai But Better

Yes

当前为 2024-10-28 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Spicychat.ai But Better
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Yes
// @author       Me
// @match        *://*.spicychat.ai/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=spicychat.ai
// @grant        GM_addStyle
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    // ChatGPT Overlay!
    const overlay = document.createElement("div");
    // Use `left` instead of `right` for positioning
    overlay.style = "top:25%;left:25%;position:fixed;padding:10px;border:1px solid black;border-radius:15px;background:white;cursor:move;";

    const selectElement = document.createElement("select");
    const values = ["default", "thespice-8b", "stheno-8b", "spicy2-13b", "darkforest-20b", "command-r", "mixtral", "noromaid-45b", "vivian-70b", "airoboros-70b", "midnightrose-70b", "wizardlm2-8x22b"];
    for (const value of values) {
        const option = document.createElement("option");
        option.textContent = value;
        selectElement.appendChild(option);
    }

    selectElement.addEventListener("change", function() {
        localStorage.setItem(`inference_model_${localStorage.getItem("guest_user_id")}`, selectElement.value); // Thanks to LM2024 https://greasyfork.org/en/scripts/499615-spicychat-utilities/discussions/253397
    });

    const title = document.createElement("h3");
    title.textContent = "spicychat.ai utilities";
    title.style = "color:black";

    overlay.appendChild(title);
    overlay.appendChild(selectElement);
    document.body.appendChild(overlay);
    // ChatGPT Overlay!

    // Add Drag functionality
    let offsetX = 0, offsetY = 0, isDragging = false;

    overlay.addEventListener('mousedown', function(e) {
        isDragging = true;
        offsetX = e.clientX - overlay.getBoundingClientRect().left;
        offsetY = e.clientY - overlay.getBoundingClientRect().top;

        // Set `left` and `top` if they are not already set
        const rect = overlay.getBoundingClientRect();
        overlay.style.left = rect.left + 'px';
        overlay.style.top = rect.top + 'px';

        document.body.style.userSelect = 'none'; // Prevents text selection
    });

    document.addEventListener('mousemove', function(e) {
        if (isDragging) {
            overlay.style.left = (e.clientX - offsetX) + 'px';
            overlay.style.top = (e.clientY - offsetY) + 'px';
        }
    });

    document.addEventListener('mouseup', function() {
        isDragging = false;
        document.body.style.userSelect = ''; // Restore text selection
    });

    // Queue bypass functionality
    XMLHttpRequest.prototype.realSend = XMLHttpRequest.prototype.send;
    XMLHttpRequest.prototype.send = function(data) {
        this.addEventListener('readystatechange', function() {
            if (this.responseURL.includes("queue")) { // Queue bypass
                if (this.response != "") {
                    console.log(''.concat(this.response, " > {\"status\":\"access\"}"));
                }
                Object.defineProperty(this, "responseText", {writable: true});
                this.responseText = '{"status":"access"}';
            };
        });
        this.realSend(data);
    };
})();