fix: report 429 retry + theme toggle on all pages

- LLMClient: increase retries 5→8, backoff 1s→2s, max 30s→60s for GLM rate limit recovery
- Report agent: add 3s delay between sections to avoid sustained 429
- Add theme-toggle-anchor to SimulationRun/Report/Interaction/Replay views
- All pages now have dark/light theme toggle button
This commit is contained in:
liyizhouAI 2026-04-17 08:36:58 +08:00
parent d2b5b17b98
commit 8b77a7b9ba
6 changed files with 38 additions and 4 deletions

View File

@ -1684,7 +1684,12 @@ class ReportAgent:
)
logger.info(t('report.sectionSaved', reportId=report_id, sectionNum=f"{section_num:02d}"))
# 章节间延迟,避免连续请求触发 LLM 速率限制
if section_num < total_sections:
import time
time.sleep(3)
# 更新进度
ReportManager.update_progress(
report_id, "generating",

View File

@ -16,9 +16,9 @@ from ..config import Config
logger = logging.getLogger('foresight.llm_client')
# 重试配置(针对 429 / 5xx / 超时 / 连接错误)
_MAX_RETRIES = 5
_BASE_BACKOFF = 1.0 # 首次重试等 1s
_MAX_BACKOFF = 30.0 # 单次最多等 30s
_MAX_RETRIES = 8
_BASE_BACKOFF = 2.0 # 首次重试等 2s
_MAX_BACKOFF = 60.0 # 单次最多等 60s
def _is_rate_limit_error(err: Exception) -> bool:

View File

@ -28,6 +28,7 @@
<div class="header-right">
<LanguageSwitcher />
<div class="theme-toggle-slot" id="theme-toggle-anchor"></div>
<div class="step-divider"></div>
<div class="workflow-step">
<span class="step-num">Step 5/5</span>
@ -358,4 +359,12 @@ onMounted(() => {
.panel-wrapper.left {
border-right: 1px solid #EAEAEA;
}
.theme-toggle-slot {
width: 18px;
height: 18px;
flex-shrink: 0;
display: inline-flex;
align-items: center;
justify-content: center;
}
</style>

View File

@ -28,6 +28,7 @@
<div class="header-right">
<LanguageSwitcher />
<div class="theme-toggle-slot" id="theme-toggle-anchor"></div>
<div class="step-divider"></div>
<div class="workflow-step">
<span class="step-num">Step 4/5</span>
@ -356,4 +357,12 @@ onMounted(() => {
.panel-wrapper.left {
border-right: 1px solid #EAEAEA;
}
.theme-toggle-slot {
width: 18px;
height: 18px;
flex-shrink: 0;
display: inline-flex;
align-items: center;
justify-content: center;
}
</style>

View File

@ -24,6 +24,7 @@
</div>
</div>
<div class="header-right">
<div class="theme-toggle-slot" id="theme-toggle-anchor"></div>
<button class="icon-btn" @click="toggleAnalyst" :title="analystMode ? '切换沉浸视图' : '切换分析视图'">
{{ analystMode ? '◫' : '▦' }}
</button>
@ -964,4 +965,5 @@ onUnmounted(() => {
.task-icon { color: #4CAF50; font-weight: 700; }
.task-label { color: #E8E8E8; flex: 1; }
.task-progress { color: #666; }
.theme-toggle-slot { width: 18px; height: 18px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; }
</style>

View File

@ -28,6 +28,7 @@
<div class="header-right">
<LanguageSwitcher />
<div class="theme-toggle-slot" id="theme-toggle-anchor"></div>
<div class="step-divider"></div>
<div class="workflow-step">
<span class="step-num">Step 3/5</span>
@ -454,5 +455,13 @@ onUnmounted(() => {
.panel-wrapper.left {
border-right: 1px solid #EAEAEA;
}
.theme-toggle-slot {
width: 18px;
height: 18px;
flex-shrink: 0;
display: inline-flex;
align-items: center;
justify-content: center;
}
</style>