ui: idle fragment tick 5s + streamlit>=1.62; fix !!!Error tail check

This commit is contained in:
Liang Jiaqing committed 2026-08-20 12:31:06 +08:00
1 parent f6928e0101
commit d6403d9783
3 files changed
+5 -5

No files matched your search

+3 -3
View File
@@ -437,7 +437,7 @@ if prompt:
_start_main_task(prompt)
# Stream hosts only when this session owns the queue.
# Single always-on 1s tick below (stream / detached / hub / idle) — never unregistered.
# Poll quickly while active; reduce idle renderer churn.
_stream_fh = _stream_ls = None
if st.session_state.get('display_queue') is not None:
with st.chat_message("assistant"):
@@ -448,9 +448,9 @@ if st.session_state.get('display_queue') is not None:
elif agent.is_running:
st.chat_message("assistant").markdown(T("detached_running"))
@st.fragment(run_every=timedelta(seconds=1))
@st.fragment(run_every=timedelta(seconds=1 if (_stream_fh is not None or agent.is_running or st.session_state.get('loop_enabled')) else 5))
def _tick():
"""One heartbeat: if-dispatch stream / detached / hub / idle. Always registered."""
"""Poll every second while active and every five seconds while idle."""
# 1) Own stream: drain done, paint all_outputs
if _stream_fh is not None:
done = _poll_main_task()
+1 -1
View File
@@ -483,7 +483,7 @@ class GenericAgentHandler(BaseHandler):
if not response or (not content.strip() and not thinking.strip()):
yield "[Warn] LLM returned an empty response. Retrying...\n"
return self._retry_or_exit("[ERROR] Blank response, regenerate and tooluse")
if '[!!! 流异常中断' in content[-100:] or '!!!Error:' in content[-100:] or (content.endswith('</summary>') and len(content) < 100):
if '[!!! 流异常中断' in content[-100:] or '!!!Error:' in content[50:][-100:] or (content.endswith('</summary>') and len(content) < 100):
return self._retry_or_exit("[ERROR] Incomplete response. Regenerate and tooluse.")
if 'max_tokens !!!]' in content[-100:]:
return self._retry_or_exit("[ERROR] max_tokens limit reached. Use multi small steps to do it.")
+1 -1
View File
@@ -20,7 +20,7 @@ dependencies = [
# select extras, not all. match current task/env.
# examples: .[ui] for GUI, bot deps only if bot needed.
ui = [
"streamlit>=1.28",
"streamlit>=1.62",
"pywebview>=4.0",
"textual>=0.70",
# tui_v3 (scrollback-first TUI) — prompt_toolkit replaces textual; rich is