DeepSeek Auto-Regenerate (Minimal)

Automatically click the “重新生成” button when DeepSeek shows “The server is busy. Please try again later.”

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

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

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name         DeepSeek Auto-Regenerate (Minimal)
// @description  Automatically click the “重新生成” button when DeepSeek shows “The server is busy. Please try again later.”
// @match        *://*.deepseek.com/*
// @match        *://*.deepseek.ai/*
// @run-at       document-idle
// @version 0.0.1.20250514105945
// @namespace http://deepseek.auto.regenerate
// ==/UserScript==

(function() {
    'use strict';

    function tryClickRegen(p) {
        // find the next sibling wrapper containing the icon buttons
        const wrapper = p.parentElement.nextElementSibling;
        if (!wrapper) return;

        // inside that wrapper, find the SVG <rect> whose id is "重新生成"
        const regenRect = wrapper.querySelector('rect[id="重新生成"]');
        if (!regenRect) return;

        // climb up to the clickable .ds-icon-button
        const button = regenRect.closest('.ds-icon-button');
        if (!button) return;

        // click with a small delay
        setTimeout(() => button.click(), 300);
        console.log('DeepSeek Auto: clicked 重新生成');
    }

    function scanForBusy() {
        document.querySelectorAll('p.ds-markdown-paragraph').forEach(p => {
            if (p.textContent.trim() === 'The server is busy. Please try again later.') {
                tryClickRegen(p);
            }
        });
    }

    // observe DOM changes for new busy messages
    const observer = new MutationObserver(scanForBusy);
    observer.observe(document.body, { childList: true, subtree: true });

    // initial scan in case message is already present
    setTimeout(scanForBusy, 1000);
})();