feat: port quality, escalation, KB version, site-map KB, experiments and metrics

This commit is contained in:
wangliang
2026-10-23 11:41:09 +08:00
parent 81b49c9350
commit b778570045
33 changed files with 2446 additions and 344 deletions
+9
View File
@@ -7,6 +7,7 @@ const { createTools, resolveSiteProfile } = require('./tools');
const { createIdentity } = require('./identity');
const { createLibreDeskWebhook } = require('./libredesk-webhook');
const { createAgent } = require('./agent');
const prom = require('./prom');
const { ToolError } = require('./errors');
const MAX_BODY_BYTES = 256 * 1024;
@@ -113,6 +114,14 @@ function createServer(options = {}) {
});
}
// GET /metrics — Prometheus 文本指标(默认仅内网/LAN 暴露)
if (req.method === 'GET' && url === '/metrics') {
const body = prom.render();
res.writeHead(200, { 'content-type': 'text/plain; version=0.0.4; charset=utf-8', 'content-length': Buffer.byteLength(body) });
res.end(body);
return;
}
// POST /libredesk/webhook — 方案 A:LibreDesk 消息事件进入 bridge(HMAC 验签)
if (req.method === 'POST' && url === '/libredesk/webhook') {
const raw = await readRawBody(req);