Compare commits

..

2 Commits

2 changed files with 25 additions and 2 deletions

View File

@@ -596,7 +596,7 @@ class AppController:
self.files = list(self.project.get("files", {}).get("paths", []))
self.screenshots = list(self.project.get("screenshots", {}).get("paths", []))
disc_sec = self.project.get("discussion", {})
self.disc_roles = list(disc_sec.get("roles", list(models.DISC_ROLES)))
self.disc_roles = list(disc_sec.get("roles", ["User", "AI"]))
self.active_discussion = disc_sec.get("active", "main")
disc_data = disc_sec.get("discussions", {}).get(self.active_discussion, {})
with self._disc_entries_lock:
@@ -1326,7 +1326,7 @@ class AppController:
self.files = list(self.project.get("files", {}).get("paths", []))
self.screenshots = list(self.project.get("screenshots", {}).get("paths", []))
disc_sec = self.project.get("discussion", {})
self.disc_roles = list(disc_sec.get("roles", list(models.DISC_ROLES)))
self.disc_roles = list(disc_sec.get("roles", ["User", "AI"]))
self.active_discussion = disc_sec.get("active", "main")
disc_data = disc_sec.get("discussions", {}).get(self.active_discussion, {})
with self._disc_entries_lock:

View File

@@ -31,6 +31,29 @@ AGENT_TOOL_NAMES = [
"py_get_hierarchy"
]
def parse_history_entries(history_strings: list[str], roles: list[str]) -> list[dict[str, Any]]:
"""Parse stored history strings back to disc entry dicts."""
import re
entries = []
for raw in history_strings:
ts = ""
rest = raw
if rest.startswith("@"):
nl = rest.find("\n")
if nl != -1:
ts = rest[1:nl]
rest = rest[nl + 1:]
known = roles or ["User", "AI"]
role_pat = re.compile(r"^(" + "|".join(re.escape(r) for r in known) + r"):", re.IGNORECASE)
match = role_pat.match(rest)
role = match.group(1) if match else "User"
if match:
content = rest[match.end():].strip()
else:
content = rest
entries.append({"role": role, "content": content, "collapsed": False, "ts": ts})
return entries
@dataclass
class Ticket:
"""