recommendations changes
This commit is contained in:
parent
127ea02fb8
commit
485cce42b5
|
|
@ -25,6 +25,32 @@ function isGuestProtectedQuery(text) {
|
||||||
return GUEST_PROTECTED_KEYWORDS.some((k) => lower.includes(k));
|
return GUEST_PROTECTED_KEYWORDS.some((k) => lower.includes(k));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const INTENT_CATEGORIES = {
|
||||||
|
EVENT_INFORMATION: 'Event Information',
|
||||||
|
PERSONAL_INFORMATION: 'Personal Information',
|
||||||
|
FOOD: 'Food',
|
||||||
|
PLACES: 'Places',
|
||||||
|
UNRECOGNIZED: 'unrecognized',
|
||||||
|
};
|
||||||
|
|
||||||
|
function determineIntentCategory(text) {
|
||||||
|
const normalized = String(text || '').toLowerCase().trim();
|
||||||
|
if (!normalized) return INTENT_CATEGORIES.UNRECOGNIZED;
|
||||||
|
|
||||||
|
const contains = (terms) => terms.some((term) => normalized.includes(term));
|
||||||
|
|
||||||
|
const personalTerms = ['ticket', 'badge', 'seat', 'registration', 'check in', 'check-in', 'attendee', 'profile'];
|
||||||
|
const foodTerms = ['food', 'menu', 'eat', 'lunch', 'dinner', 'breakfast', 'snack', 'coffee', 'tea', 'restaurant', 'cafe', 'vendor', 'catering', 'meal', 'vegan', 'vegetarian'];
|
||||||
|
const placeTerms = ['where', 'location', 'map', 'nearest', 'restroom', 'bathroom', 'parking', 'entrance', 'exit', 'hall', 'stage', 'booth', 'room', 'lounge', 'gate', 'venue', 'office', 'directions', 'route', 'floor'];
|
||||||
|
const eventTerms = ['event', 'information', 'info', 'schedule', 'agenda', 'program', 'speaker', 'speakers', 'sessions', 'session', 'time', 'date', 'venue', 'wifi', 'wi-fi', 'rules', 'policy', 'sponsor', 'join', 'host'];
|
||||||
|
|
||||||
|
if (contains(foodTerms)) return INTENT_CATEGORIES.FOOD;
|
||||||
|
if (contains(placeTerms)) return INTENT_CATEGORIES.PLACES;
|
||||||
|
if (contains(personalTerms)) return INTENT_CATEGORIES.PERSONAL_INFORMATION;
|
||||||
|
if (contains(eventTerms)) return INTENT_CATEGORIES.EVENT_INFORMATION;
|
||||||
|
return INTENT_CATEGORIES.UNRECOGNIZED;
|
||||||
|
}
|
||||||
|
|
||||||
async function findParticipantForEvent(eventId, organizationId, input) {
|
async function findParticipantForEvent(eventId, organizationId, input) {
|
||||||
const raw = String(input || '').trim();
|
const raw = String(input || '').trim();
|
||||||
if (!raw) return null;
|
if (!raw) return null;
|
||||||
|
|
@ -220,6 +246,9 @@ async function processInboundMessage(jobData) {
|
||||||
|
|
||||||
if (!incomingRawText) return;
|
if (!incomingRawText) return;
|
||||||
|
|
||||||
|
const intentCategory = determineIntentCategory(incomingRawText);
|
||||||
|
console.log(`[intent] query="${incomingRawText}" category="${intentCategory}"`);
|
||||||
|
|
||||||
const includeEventDetails = bot.knowledge?.includeEventDetails !== false;
|
const includeEventDetails = bot.knowledge?.includeEventDetails !== false;
|
||||||
const answer = await executeLocalRAG(eventId, incomingRawText, eventName, { includeEventDetails });
|
const answer = await executeLocalRAG(eventId, incomingRawText, eventName, { includeEventDetails });
|
||||||
const reply =
|
const reply =
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue