Auto Regenerate on Server Busy (DeepSeek)

Automatically regenerates when AI server is busy, accurately targeting regenerate button

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Auto Regenerate on Server Busy (DeepSeek)
// @namespace    http://tampermonkey.net/
// @version      1.5
// @description  Automatically regenerates when AI server is busy, accurately targeting regenerate button
// @author       Your Name
// @match        https://chat.deepseek.com/*
// @grant        none
// ==/UserScript==

(function () {
    'use strict';

    setInterval(() => {
        console.log("Running server busy check...");

        // Locate the "server is busy" message inside a <p> element
        const busyMessage = document.evaluate(
            "//p[contains(text(), 'The server is busy. Please try again later.')]",
            document,
            null,
            XPathResult.FIRST_ORDERED_NODE_TYPE,
            null
        ).singleNodeValue;

        if (busyMessage) {
            console.log("Server busy message detected.");

            // Locate the regenerate button by targeting the <rect> element with id '重新生成'
            const regenerateButtonSvg = document.querySelector('rect[id="重新生成"]');

            if (regenerateButtonSvg) {
                console.log("Correct regenerate button SVG found. Clicking parent button...");
                regenerateButtonSvg.closest('div.ds-icon-button').click();  // Click the regenerate button
                console.log("Clicked regenerate button.");
            } else {
                console.error("Regenerate button SVG not found. Check selector.");
            }
        } else {
            console.log("No server busy message detected.");
        }
    }, 3000);  // Check interval in milliseconds
})();