feat: port quality, escalation, KB version, site-map KB, experiments and metrics
This commit is contained in:
+5
-3
@@ -325,8 +325,9 @@ function createTools(cfg, deps = {}) {
|
||||
const leadStore = deps.leadStore || createLeadStore(cfg);
|
||||
const retriever = deps.retriever || null;
|
||||
const sitemap = deps.sitemap || createSiteMap(cfg);
|
||||
const opportunityService = deps.opportunityService || createOpportunityService({ cfg, twenty, leadStore });
|
||||
const opportunityService = deps.opportunityService || createOpportunityService({ cfg, twenty, leadStore, client: deps.client });
|
||||
const mailHistory = deps.mailHistory || createMailHistory(cfg);
|
||||
const reranker = deps.reranker || null;
|
||||
function missingLeadFields(slots) {
|
||||
const missing = [];
|
||||
if (!slots.company) missing.push('company');
|
||||
@@ -376,7 +377,8 @@ function createTools(cfg, deps = {}) {
|
||||
const query = String(args.query || '').trim();
|
||||
if (!query) throw new ToolError(400, 'invalid_arguments', 'query is required');
|
||||
const limit = Math.min(Number(args.limit) || 5, 8);
|
||||
const results = await retriever.searchKB(query, limit);
|
||||
let results = await retriever.searchKB(query, Math.max(limit, 8));
|
||||
if (reranker) results = await reranker.rerank(query, results, limit);
|
||||
return {
|
||||
results,
|
||||
count: results.length,
|
||||
@@ -697,7 +699,7 @@ function createTools(cfg, deps = {}) {
|
||||
async function sendVerificationCode(args, ctx) {
|
||||
if (!deps.verification) throw new ToolError(503, 'not_configured', 'Verification is not configured');
|
||||
if (!ctx.conversationUuid) throw new ToolError(400, 'missing_conversation', 'conversation context is required');
|
||||
const out = await deps.verification.sendCode(ctx.conversationUuid, args.email);
|
||||
const out = await deps.verification.sendCode(ctx.conversationUuid, args.email, { language: ctx.language });
|
||||
return { ...out, note: 'Ask the customer to check their inbox and reply with the 6-digit code.' };
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user