fix(frontend): 修复提交对抗性审查打分按钮缺少UI容器与状态变量初始化导致无响应的问题

This commit is contained in:
Chen Xiao
2026-08-14 09:54:51 +08:00
parent 2cde351f57
commit 80a728682c
+8 -1
View File
@@ -855,6 +855,12 @@ with tab2:
)
if review_btn:
rev_status_text = st.empty()
rev_status_text.info(f"⚙️ [AI Reviewer #2] 正在向阿里通义 Qwen ({selected_model}) 建立对抗性审查通道...")
with st.container():
critic_console = st.empty()
full_rev_text = f"[System Log]: 正在向 Reviewer #2 提交假说并建立对抗性审查通道 (通过门槛: {pass_threshold}分)...\n[System Log]: 待审查假说 ID: [{st.session_state.current_hypo.get('id', 'H1')}]\n\n[Reviewer #2 Stream Output]: "
critic_console.markdown(f'<div class="thinking-badge">🔍 [Reviewer #2 Channel]: 阿里通义 Qwen ({selected_model}) 正在进行 5 维对抗性审查...</div><div class="terminal-box">{full_rev_text}<span class="live-cursor"></span></div>', unsafe_allow_html=True)
if hasattr(critic_skill, 'review_stream'):
try:
@@ -874,7 +880,7 @@ with tab2:
for char in token_chunk:
full_rev_text += char
if len(full_rev_text) % 2 == 0:
critic_console.markdown(f'<div class="terminal-box">{full_rev_text}</div>', unsafe_allow_html=True)
critic_console.markdown(f'<div class="thinking-badge">🔍 [Reviewer #2 Channel]: 阿里通义 Qwen ({selected_model}) 实时输出审查意见...</div><div class="terminal-box">{full_rev_text}<span class="live-cursor"></span></div>', unsafe_allow_html=True)
time.sleep(0.003)
# 健壮解析 5 维结构化判定
@@ -905,6 +911,7 @@ with tab2:
st.session_state.review_console_log = full_rev_text
st.session_state.review_result = parsed_rev
rev_status_text.success("🎉 Reviewer #2 对抗性审查完毕!")
st.session_state.current_state = "3_reviewed"
st.rerun()