DeepSeek Retry Clicker

Automatically clicks retry icon when server is busy on chat.deepseek.com

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         DeepSeek Retry Clicker
// @description  Automatically clicks retry icon when server is busy on chat.deepseek.com
// @match        https://chat.deepseek.com/*
// @version 0.0.1.20250714125247
// @namespace https://greasyfork.org/users/1435046
// ==/UserScript==

(function () {
  'use strict';

function hasServerBusyMessage() {
    return Array.from(document.querySelectorAll('span')).some(span =>
      span.textContent.trim() === 'Server busy, please try again later.' ||
      span.textContent.trim() === 'Check network and retry.'
    );
  }

  function searchAndClickIconButton() {
    for (const div of document.querySelectorAll('div')) {
      const svgPath = div.querySelector('svg path[d^="M12 .5C18.351.5"]');
      if (svgPath) {
        const btn = div.closest('.ds-icon-button');
        if (btn) {
          btn.click();
          break;
        }
      }
    }
  }

  function init() {
    // Run once immediately
    if (hasServerBusyMessage()) {
      searchAndClickIconButton();
    }
    // Then observe all future changes
    new MutationObserver(() => {
      if (hasServerBusyMessage()) {
        searchAndClickIconButton();
      }
    }).observe(document.body, { childList: true, subtree: true });
  }

  document.addEventListener('DOMContentLoaded', init);
})();