// ==UserScript== // @name DeepSeek自动重试 // @namespace http://tampermonkey.net/ // @version 0.1 // @description 检测到"服务器繁忙"时自动点击重试按钮 // @author dy // @match https://chat.deepseek.com/* // @grant none // @license none // @downloadURL none // ==/UserScript== (function() { 'use strict'; const BUSY_TEXT = '服务器繁忙,请稍后再试'; const CHECK_INTERVAL = 1000; function createNotification() { const notification = document.createElement('div'); notification.style.cssText = ` position: fixed; top: 20px; right: 20px; background: rgba(0, 0, 0, 0.8); color: white; padding: 10px 20px; border-radius: 5px; z-index: 9999; transition: opacity 0.3s; `; notification.textContent = '检测到服务器繁忙,3秒后自动重试...'; document.body.appendChild(notification); return notification; } function findRetryButton() { const retryButtons = Array.from(document.querySelectorAll('.ds-icon-button')); return retryButtons.find(button => { const svg = button.querySelector('svg'); return svg && svg.querySelector('#重新生成'); }); } function autoRetry() { const elements = Array.from(document.querySelectorAll('*')).filter(el => el.textContent && el.textContent.includes(BUSY_TEXT) ); if (elements.length > 0) { const retryButton = findRetryButton(); if (retryButton) { const notification = createNotification(); setTimeout(() => { console.log('找到重试按钮,自动点击'); retryButton.dispatchEvent(new MouseEvent('click', { view: window, bubbles: true, cancelable: true })); notification.style.opacity = '0'; setTimeout(() => notification.remove(), 300); }, 3000); } } } setInterval(autoRetry, CHECK_INTERVAL); })();