Add offline analysis and client event tracking to Assistent API

- Introduced `/assistent/analyze-reply` endpoint for offline extraction of patches and client predictions without VRAM.
- Added `/assistent/client-event` and `/assistent/client-events` endpoints for tracking UI interactions and retrieving event history.
- Updated Debug API documentation to reflect new endpoints and their functionalities.
- Enhanced Assistent session handling with improved client prediction logic and diagnostics.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Leonid Pershin
2026-08-23 15:18:39 +03:00
co-authored by Cursor
parent 1d431e3a05
commit 322577cf9f
8 changed files with 529 additions and 34 deletions
+10 -1
View File
@@ -163,6 +163,9 @@ Exit 0 → можно `up`. Exit 1 → причина в таблице / кра
| `/assistent/session/{id}/chat` | **POST** — ход + объект `trace` |
| `/assistent/session/{id}` | **GET** / **DELETE** — состояние / сброс |
| `/assistent/chat-eval` | One-shot: session + один chat + delete |
| `/assistent/analyze-reply` | **POST** `{message, reply}` — офлайн extract + `client.would_generate` (без VRAM) |
| `/assistent/client-event` | **POST** — beacon из вкладки Assistent (последний ход UI) |
| `/assistent/client-events` | **GET** `?since=` — кольцо beacon'ов |
Симптомы → куда смотреть: поле `playbook` в `/assistent`.
@@ -199,7 +202,13 @@ curl -sS -X DELETE "$BASE/assistent/session/$SID"
curl -sS -X POST "$BASE/assistent/chat-eval" \
-H 'Content-Type: application/json' \
-d '{"message":"какие steps/cfg для turbo?","persona":"neutral","timeout":120}' \
| jq '{ok,reply,patch,trace}'
| jq '{ok,reply,patch,client,trace}'
# Offline: paste a live UI reply (no GPU)
curl -sS -X POST "$BASE/assistent/analyze-reply" \
-H 'Content-Type: application/json' \
-d '{"persona":"neutral","message":"а ты знаешь какие то промпты с civitai","reply":"```json\n{\"prompt\":\"x\",\"generate\":true}\n```"}' \
| jq '{patch,client}'
```
Ответ chat: `ok`, `reply`, `trace` (`timings_ms`, `patch`, `exact_merge`, `compact_context`, `system_chars` / `system_layers`, `skills`, `hops`, `gaps`, `errors`/`warnings`/`hints`). Sqlite SaveChat fail — soft error, если текст ответа есть.