feat: port quality, escalation, KB version, site-map KB, experiments and metrics
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user