diff --git a/static/src/components/chat/monitor/MonitorDirector.ts b/static/src/components/chat/monitor/MonitorDirector.ts index f0ac7c6..cab1d57 100644 --- a/static/src/components/chat/monitor/MonitorDirector.ts +++ b/static/src/components/chat/monitor/MonitorDirector.ts @@ -3761,22 +3761,31 @@ export class MonitorDirector implements MonitorDriver { clearInterval(this.waitOverlayTimer); this.waitOverlayTimer = null; } + let phase = 0; const update = () => { const elapsed = (performance.now() - start) / 1000; - const remain = Math.max(0, total - elapsed); - if (this.elements.waitCountdown) { + const remain = total - elapsed; + if (!this.elements.waitCountdown) { + return; + } + if (remain > 0) { this.elements.waitCountdown.textContent = this.formatWaitText(Math.ceil(remain)); + } else { + const over = Math.ceil(-remain); + const dots = '.'.repeat(phase); + phase = (phase + 1) % 4; + this.elements.waitCountdown.textContent = `等待中 +${over}s${dots}`; } }; - this.waitOverlayTimer = window.setInterval(update, 200); + this.waitOverlayTimer = window.setInterval(update, 260); const done = until || Promise.resolve(); + const minDuration = new Promise(resolve => setTimeout(resolve, total * 1000)); try { - await done; - } catch (_err) { - // 忽略错误,仍然结束动画 + await Promise.all([done.catch(() => null), minDuration]); + } finally { + update(); + this.hideWaitOverlay(); } - update(); - this.hideWaitOverlay(); } /**