fix(navigation): tie unread indicator dots to thread container bounds to prevent false positive unread threads

This commit is contained in:
2026-04-27 14:51:30 +02:00
parent b4bafb59be
commit 8c37290bc3
2 changed files with 28 additions and 14 deletions

View File

@@ -184,25 +184,39 @@ class TelepathicEngine:
# We must be extremely strict here: It's only unread if it has the "unread" text or indicator dot
unread_candidates = []
# Check for explicitly unread containers
# 1. Find all explicit unread dots in the UI
dot_nodes = [
d for d in nodes
if "thread_indicator_status_dot" in (d.get("id", "") or d.get("resource_id", ""))
]
import re
for n in nodes:
is_unread = False
res_id = n.get("id", "") or n.get("resource_id", "")
content_desc = (n.get("description", "") or "").lower()
semantic = (n.get("semantic_string", "") or "").lower()
# Check for explicit 'unread' in description
if "unread" in content_desc or "unread" in semantic:
is_unread = True
# Some versions might use the explicit unread dot
if "thread_indicator_status_dot" in xml_string:
# Let's fallback to any row if we know an unread dot exists in the xml
if "row_inbox_container" in res_id:
if "row_inbox_container" in res_id and (n.get("x", -1), n.get("y", -1)) not in skip_positions:
content_desc = (n.get("description", "") or "").lower()
semantic = (n.get("semantic_string", "") or "").lower()
# 1. Check for explicit 'unread' in description
if "unread" in content_desc or "unread" in semantic:
is_unread = True
# 2. Check if an unread dot falls inside this container's bounds
if not is_unread and dot_nodes:
bounds_str = n.get("bounds", "")
m = re.match(r"\[\d+,(\d+)\]\[\d+,(\d+)\]", bounds_str)
if m:
y1, y2 = int(m.group(1)), int(m.group(2))
for dot in dot_nodes:
dot_y = dot.get("y", -1)
if y1 <= dot_y <= y2:
is_unread = True
break
if is_unread and "row_inbox_container" in res_id and (n.get("x", -1), n.get("y", -1)) not in skip_positions:
if n.get("y", 0) > 200:
if is_unread and n.get("y", 0) > 200:
unread_candidates.append(n)
if unread_candidates:

View File

@@ -101,7 +101,7 @@ blank_start: true
# ── AI Model Endpoints (Ollama / OpenRouter) ──
ai-model: qwen3.5:latest
ai-model-url: http://localhost:11434/api/generate
ai-telepathic-model: llama3.2-vision
ai-telepathic-model: llava:latest
ai-telepathic-url: http://localhost:11434/api/generate
ai-embedding-model: nomic-embed-text
ai-embedding-url: http://localhost:11434/api/embeddings