Commit Graph
8 Commits
Author SHA1 Message Date
Shen Hao 1a39221a59 Harden continue session listing and restore parsing 2026-05-27 06:07:42 +08:00
yanghang 559d1d671b fix(continue): classify auto-continue prompts by tool_result presence
_user_text was misclassifying any prompt whose text block didn't start
with '### [WORKING MEMORY]' as a real user message — but auto-continue
prompts can interleave [SYSTEM TIPS], [System] regenerate triggers,
[DANGER] guard injections, and similar. Treat any prompt carrying a
tool_result block as auto-continue (the natural signal that this is
the next round of an in-flight LLM call), and extend the injection
marker list as a secondary guard for the rare tool_result-less
synthetic prompts.
2026-05-17 01:52:45 +08:00
yanghang 38a7db2660 fix(continue): rebuild restored transcript to match live agent_loop output
extract_ui_messages now renders tool_use headers and tool_result fences
into the assistant content using the same string format that agent_loop
yields live, so fold_turns folds restored sessions identically to live
chat. Tool-only response rounds no longer drop the user message, and
Turn 1 also carries a marker so the first turn folds like the rest.
2026-05-17 01:52:45 +08:00
Liang Jiaqing 26d5fc6781 feat: auto-inject summary text block when model outputs thinking+tool_use without text; stapp fallback uses content preview 2026-05-03 12:22:05 +08:00
weijiaandwjl2023 1891708a08 feat(stapp): restore chat history bubbles after /continue N (#138)
When the user runs '/continue N' in stapp, the agent's in-memory context
is restored, but the UI previously showed only a single '✅ restored' line
— all prior chat bubbles were missing.

This change parses the target session log and reconstructs the
user/assistant message pairs into st.session_state.messages, so reopening
a session feels like the conversation was never interrupted.

* continue_cmd.py: add extract_ui_messages(path)
  - parses model_responses log into [{role, content}, ...]
  - groups multi-turn LLM calls (prompts whose text starts with the
    '### [WORKING MEMORY]' header) into a single assistant bubble,
    inserting the existing '**LLM Running (Turn N) ...**' marker so
    fold_turns() renders them as collapsible segments.
  - two small helpers (_user_text / _assistant_text) keep parsing local.

* stapp.py: in the /continue branch, resolve the target log path BEFORE
  calling handle_frontend_command (which snapshots the current log and
  would otherwise shift list_sessions indices), then replace
  session_state.messages with the reconstructed history on success.
  Falls back to the previous behavior for bare /continue or failure.

Co-authored-by: wjl2023 <wjl2023@users.noreply.github.com>
2026-04-23 16:36:41 +08:00
Xinyi Wang 4c0f97a231 feat: add continue/new support to chat frontends 2026-04-20 19:27:31 +08:00
Liang Jiaqing 5869022302 refactor: simplify HTTP error handling in _openai_stream, add non-stream support, broadcast history in MixinSession 2026-04-19 20:57:07 +08:00
Shen Hao 544ea84828 feat: update continue_cmd.py 2026-04-19 19:10:38 +08:00