feat: flag cached analysis responses with cached:true

Allows the UI to distinguish instant cache hits from live computation.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-02 22:39:34 +02:00
parent eb774a0876
commit 75434ca96d
+2 -1
View File
@@ -363,7 +363,8 @@ class _Handler(BaseHTTPRequestHandler):
try: try:
cached = json.loads(cache_path.read_text('utf-8')) cached = json.loads(cache_path.read_text('utf-8'))
if cached.get('threshold') == threshold and cached.get('min_gap') == min_gap: if cached.get('threshold') == threshold and cached.get('min_gap') == min_gap:
self._send(200, json.dumps(cached['result']).encode('utf-8'), 'application/json') payload = dict(cached['result']); payload['cached'] = True
self._send(200, json.dumps(payload).encode('utf-8'), 'application/json')
return return
except Exception: except Exception:
pass pass