feat: add manual feedback AI summaries and secure leaderboard scoring

Co-authored-by: Stephan Charles <[email protected]>
Co-authored-by: Amelia Hernandez <[email protected]>
Co-authored-by: Markus Franz <[email protected]>
Co-authored-by: Sabrina Hota <[email protected]>
Co-authored-by: Nilüfer Doğan <[email protected]>
This commit is contained in:
committed 2026-10-15 19:06:10 +02:00
1 parent 407b878e23
commit 821907b164
37 files changed
+1640 -77

No files matched your search

+13 -2
View File
@@ -44,6 +44,7 @@ const XLSX = require('xlsx');
const { transformExcel } = require('./transform-excel');
const { readSessionizeSource } = require('./sessionize-source');
const { createSessionizePoller } = require('./sessionize-poller');
const { createFeedbackApi } = require('./feedback-api');
const PDFDocument = require('pdfkit');
const SUPABASE_URL = (process.env.SUPABASE_URL || 'http://supabase_kong_Convivo:8000').replace(/\/$/, '');
@@ -93,13 +94,14 @@ function readBody(req) {
}
// Supabase (PostgREST) helper using the service-role key.
async function supabaseFetch(path, { method = 'GET', body } = {}) {
async function supabaseFetch(path, { method = 'GET', body, prefer } = {}) {
const res = await fetch(SUPABASE_URL + path, {
method,
headers: {
apikey: SERVICE_ROLE_KEY,
Authorization: `Bearer ${SERVICE_ROLE_KEY}`,
'Content-Type': 'application/json',
...(prefer ? { Prefer: prefer } : {}),
},
body: body ? JSON.stringify(body) : undefined,
});
@@ -814,10 +816,18 @@ const pollSessionize = createSessionizePoller({
onError: (error, eventId) => log('sessionize poll error', { eventId, error: error.message }),
});
const feedbackApi = createFeedbackApi({ supabaseFetch, supabaseUrl: SUPABASE_URL, serviceRoleKey: SERVICE_ROLE_KEY });
const server = http.createServer(async (req, res) => {
const url = new URL(req.url, `http://${req.headers.host || 'localhost'}`);
const path = url.pathname;
try {
if (path === '/llm-settings' || path === '/feedback-summary') {
res.setHeader('Cache-Control', 'no-store');
const body = req.method === 'GET' ? {} : await readBody(req);
const result = await feedbackApi.handle(req, path, body);
return json(res, 200, result);
}
if (req.method === 'GET' && path === '/health') {
return json(res, 200, { ok: true });
}
@@ -870,7 +880,8 @@ const server = http.createServer(async (req, res) => {
}
return json(res, 404, { error: 'not found' });
} catch (e) {
return json(res, 500, { error: e.message });
const feedbackRoute = path === '/llm-settings' || path === '/feedback-summary';
return json(res, e.status || 500, { error: feedbackRoute && !e.status ? 'Feedback service unavailable' : e.message });
}
});