fix(gui): fix missing thinking_segments parameter persistence across sessions
This commit is contained in:
@@ -111,6 +111,7 @@ DEFAULT_TOOL_CATEGORIES: Dict[str, List[str]] = {
|
||||
|
||||
def parse_history_entries(history_strings: list[str], roles: list[str]) -> list[dict[str, Any]]:
|
||||
import re
|
||||
from src import thinking_parser
|
||||
entries = []
|
||||
for raw in history_strings:
|
||||
ts = ""
|
||||
@@ -128,7 +129,15 @@ def parse_history_entries(history_strings: list[str], roles: list[str]) -> list[
|
||||
content = rest[match.end():].strip()
|
||||
else:
|
||||
content = rest
|
||||
entries.append({"role": role, "content": content, "collapsed": True, "ts": ts})
|
||||
|
||||
entry_obj = {"role": role, "content": content, "collapsed": True, "ts": ts}
|
||||
if role == "AI" and ("<thinking>" in content or "<thought>" in content or "Thinking:" in content):
|
||||
segments, parsed_content = thinking_parser.parse_thinking_trace(content)
|
||||
if segments:
|
||||
entry_obj["content"] = parsed_content
|
||||
entry_obj["thinking_segments"] = [{"content": s.content, "marker": s.marker} for s in segments]
|
||||
|
||||
entries.append(entry_obj)
|
||||
return entries
|
||||
|
||||
@dataclass
|
||||
|
||||
Reference in New Issue
Block a user