diff --git a/README.md b/README.md index 1e76a46..41b8cca 100644 --- a/README.md +++ b/README.md @@ -277,3 +277,18 @@ Gateway вешается в `~/AppData/Local/hermes/config.yaml` -> `custom_prov ### Фикс _secret `*_env`-ссылка в конфиге больше не глушит прямое значение: env пуст -> берётся поле из config.json. (Раньше catchall молча отваливался, если env не задан.) + + +## v1.8 — Live-лента запросов + reasoning в дашборде + +### Gateway: GET /api/requests +Все запросы через шлюз (chat/models/check) пишутся в ring-buffer (2000) и отдаются через `/api/requests?limit=N&kind=chat` (header X-Logicc-Admin: 1). Поля: ts, kind, model, account (маскирован), status, httpStatus, ms, ttftMs, attempts, stream, usage, error. + +### Дашборд: вкладка Requests +Live-таблица (авто-обновление 4с, фильтр по kind): время, модель, аккаунт, OK/ERR, ms, TTFT, токены in/out, попытки, ошибка. + +### Reasoning effort +Chat completion test: dropdown Reasoning (off/low/medium/high) -> body.reasoning_effort -> gateway форвардит как reasoningEffort в Logicc API. Проверено: claude-5.5-opus high = DASH-OK 12.2s. + +### Прокси в дашборде +POST /api/gateway/requests {limit, kind} — дашборд сам добавляет admin-заголовок. diff --git a/autoreg/dashboard.py b/autoreg/dashboard.py index 2bf11c0..5ee5c68 100644 --- a/autoreg/dashboard.py +++ b/autoreg/dashboard.py @@ -385,9 +385,11 @@ def gw_restart(): return {"ok": code == 200, "gw_code": code} -def chat_test(model): +def chat_test(model, effort=None): payload = {"model": model, "max_tokens": 30, "messages": [{"role": "user", "content": "Say DASH-OK"}]} + if effort: + payload["reasoning_effort"] = effort t0 = time.time() code, body = jpost(GW + "/v1/chat/completions", payload, timeout=180) dt = round(time.time() - t0, 1) @@ -396,7 +398,19 @@ def chat_test(model): txt = json.loads(body)["choices"][0]["message"]["content"][:100] except Exception: txt = body[:150] - return {"ok": code == 200, "code": code, "sec": dt, "reply": txt} + return {"ok": code == 200, "code": code, "sec": dt, "reply": txt, "effort": effort or "-"} + + +def gw_requests(limit=60, kind=None): + url = GW + "/api/requests?limit=%d" % limit + if kind: + url += "&kind=" + kind + try: + r = urllib.request.urlopen(urllib.request.Request(url, headers={"X-Logicc-Admin": "1"}), timeout=15) + d = json.loads(r.read().decode()) + return {"ok": True, "requests": d.get("requests", [])} + except Exception as e: + return {"ok": False, "err": str(e)[:120]} OPENCODE_MODELS = ["gpt-6-luna", "gpt-6.1-sol", "gemini-3.8-flash", "gemini-2.5-pro", @@ -518,7 +532,9 @@ class H(BaseHTTPRequestHandler): elif p == "/api/opencode/install": self._send(opencode_install()) elif p == "/api/chat/test": - self._send(chat_test(body.get("model", "gpt-6-luna"))) + self._send(chat_test(body.get("model", "gpt-6-luna"), body.get("reasoning_effort"))) + elif p == "/api/gateway/requests": + self._send(gw_requests(int(body.get("limit", 60)), body.get("kind"))) elif p == "/api/mail/imap_add": self._send(mail_imap_add(body)) else: diff --git a/autoreg/index.html b/autoreg/index.html index 76d8adc..24a933f 100644 --- a/autoreg/index.html +++ b/autoreg/index.html @@ -177,6 +177,7 @@ +
@@ -304,7 +305,7 @@

Chat completion test

Send a prompt through the gateway to verify a model response.

-
+
@@ -312,6 +313,12 @@
+
+ +
+ +
+
@@ -333,6 +340,28 @@
+
+
+
+

Gateway requests

Live-лента всех запросов через шлюз: модель, аккаунт, статус, время, токены. Авто-обновление 4с.

+
+ + +
+
+
+
+ + + + + +
TimeKindModelAccountStatusmsTTFTTok in/outTryError
Loading…
+
+
0 requests—
+
+
+