736 lines
24 KiB
TypeScript
736 lines
24 KiB
TypeScript
// UTAS Knowledge Base for RAG System
|
|
export const utasKnowledgeBase = {
|
|
// Academic Programs
|
|
courses: {
|
|
undergraduate: [
|
|
{
|
|
id: "bachelor-business",
|
|
title: "Bachelor of Business",
|
|
area: "Business and Law",
|
|
duration: "3 years",
|
|
description: "Develop essential business skills in management, marketing, economics, and entrepreneurship.",
|
|
entry: "ATAR 60+ or equivalent",
|
|
campus: ["Hobart", "Launceston"],
|
|
fees: "Commonwealth Supported",
|
|
pathways: ["Commerce", "Accounting", "Management", "Marketing"]
|
|
},
|
|
{
|
|
id: "bachelor-marine-science",
|
|
title: "Bachelor of Marine and Antarctic Science",
|
|
area: "Earth, Sea, Antarctic and Environment",
|
|
duration: "3 years",
|
|
description: "Study marine ecosystems, climate science, and Antarctic research at IMAS.",
|
|
entry: "ATAR 70+ with Mathematics and Science",
|
|
campus: ["Hobart"],
|
|
fees: "Commonwealth Supported",
|
|
pathways: ["Marine Biology", "Climate Science", "Antarctic Studies", "Fisheries"]
|
|
},
|
|
{
|
|
id: "bachelor-engineering",
|
|
title: "Bachelor of Engineering (Honours)",
|
|
area: "Science, Technology and Engineering",
|
|
duration: "4 years",
|
|
description: "Specialise in Civil, Electrical, Mechanical, or Software Engineering.",
|
|
entry: "ATAR 75+ with Mathematics and Physics",
|
|
campus: ["Hobart", "Launceston"],
|
|
fees: "Commonwealth Supported",
|
|
pathways: ["Civil Engineering", "Electrical Engineering", "Mechanical Engineering", "Software Engineering"]
|
|
},
|
|
{
|
|
id: "bachelor-medicine",
|
|
title: "Bachelor of Medicine, Bachelor of Surgery",
|
|
area: "Health and Medicine",
|
|
duration: "5 years",
|
|
description: "Comprehensive medical training with rural and regional focus.",
|
|
entry: "ATAR 95+ with UCAT and interview",
|
|
campus: ["Hobart", "Launceston"],
|
|
fees: "Commonwealth Supported",
|
|
pathways: ["General Practice", "Specialist Medicine", "Rural Medicine"]
|
|
},
|
|
{
|
|
id: "bachelor-arts",
|
|
title: "Bachelor of Arts",
|
|
area: "Education, Humanities and Social Sciences",
|
|
duration: "3 years",
|
|
description: "Explore humanities, social sciences, and develop critical thinking skills.",
|
|
entry: "ATAR 60+ or equivalent",
|
|
campus: ["Hobart", "Launceston"],
|
|
fees: "Commonwealth Supported",
|
|
pathways: ["English Literature", "History", "Philosophy", "Sociology", "Psychology"]
|
|
},
|
|
{
|
|
id: "bachelor-creative-arts",
|
|
title: "Bachelor of Creative Arts",
|
|
area: "Creative Arts and Design",
|
|
duration: "3 years",
|
|
description: "Develop skills in visual arts, media, design, and creative practice.",
|
|
entry: "ATAR 65+ with portfolio",
|
|
campus: ["Hobart", "Launceston"],
|
|
fees: "Commonwealth Supported",
|
|
pathways: ["Fine Arts", "Graphic Design", "Media Arts", "Theatre"]
|
|
}
|
|
],
|
|
postgraduate: [
|
|
{
|
|
id: "master-business-administration",
|
|
title: "Master of Business Administration (MBA)",
|
|
area: "Business and Law",
|
|
duration: "1.5-2 years",
|
|
description: "Advanced business leadership and management skills.",
|
|
entry: "Bachelor degree + 3 years work experience",
|
|
campus: ["Hobart", "Sydney"],
|
|
fees: "$35,000 per year",
|
|
pathways: ["Executive Leadership", "Strategy", "Innovation"]
|
|
},
|
|
{
|
|
id: "master-marine-science",
|
|
title: "Master of Marine and Antarctic Science",
|
|
area: "Earth, Sea, Antarctic and Environment",
|
|
duration: "2 years",
|
|
description: "Advanced research in marine ecosystems and climate science.",
|
|
entry: "Bachelor degree in relevant field",
|
|
campus: ["Hobart"],
|
|
fees: "$32,000 per year",
|
|
pathways: ["Research", "Conservation", "Policy"]
|
|
}
|
|
]
|
|
},
|
|
|
|
// University Information
|
|
about: {
|
|
rankings: {
|
|
climate_action: "#1 globally (THE Impact Rankings 2022-2025)",
|
|
qs_rating: "5 stars overall",
|
|
global_ranking: "Top 1% worldwide",
|
|
carbon_neutral: "Climate Active certified"
|
|
},
|
|
campuses: {
|
|
hobart: {
|
|
location: "Sandy Bay, Hobart, Tasmania",
|
|
description: "Main campus with marine science facilities and heritage buildings",
|
|
facilities: ["IMAS", "Medical School", "Arts Faculty", "Library"]
|
|
},
|
|
launceston: {
|
|
location: "Newnham, Launceston, Tasmania",
|
|
description: "Northern campus with engineering and health facilities",
|
|
facilities: ["Engineering School", "Health Faculty", "Sports Centre"]
|
|
},
|
|
burnie: {
|
|
location: "Cradle Coast, Burnie, Tasmania",
|
|
description: "Regional campus focusing on health and education",
|
|
facilities: ["Clinical School", "Education Faculty"]
|
|
},
|
|
sydney: {
|
|
location: "Sydney CBD, New South Wales",
|
|
description: "City campus for business and postgraduate programs",
|
|
facilities: ["Business School", "Executive Education"]
|
|
}
|
|
},
|
|
sustainability: {
|
|
achievements: [
|
|
"#1 global ranking for climate action (2022-2025)",
|
|
"100% renewable energy across all campuses",
|
|
"50% reduction in carbon emissions since 2007",
|
|
"Climate Active Carbon Neutral certification",
|
|
"Fossil fuel divestment completed",
|
|
"Green building standards for all new construction"
|
|
],
|
|
initiatives: [
|
|
"Zero waste to landfill by 2030",
|
|
"Carbon neutral by 2030",
|
|
"Sustainable transport programs",
|
|
"Campus solar installations",
|
|
"Biodiversity conservation projects"
|
|
]
|
|
}
|
|
},
|
|
|
|
// Research Excellence
|
|
research: {
|
|
institutes: {
|
|
imas: {
|
|
name: "Institute for Marine and Antarctic Studies",
|
|
description: "World-leading marine and climate science research",
|
|
focus: ["Marine ecosystems", "Climate change", "Antarctic research", "Fisheries science"],
|
|
achievements: ["Global recognition in marine science", "Antarctic research partnerships", "Climate modeling"]
|
|
},
|
|
tia: {
|
|
name: "Tasmanian Institute of Agriculture",
|
|
description: "Sustainable agriculture and food systems research",
|
|
focus: ["Sustainable farming", "Food security", "Agricultural innovation"],
|
|
achievements: ["Industry partnerships", "Sustainable agriculture practices"]
|
|
}
|
|
},
|
|
strengths: [
|
|
"Marine and Antarctic Science - global leadership",
|
|
"Climate Action Research - #1 ranking",
|
|
"Agriculture and Food Systems",
|
|
"Health and Medical Research",
|
|
"Engineering and Technology Innovation"
|
|
]
|
|
},
|
|
|
|
// Student Support
|
|
support: {
|
|
academic: [
|
|
"Study skills workshops",
|
|
"Academic writing support",
|
|
"Mathematics learning centre",
|
|
"Peer tutoring programs",
|
|
"Online learning resources"
|
|
],
|
|
wellbeing: [
|
|
"Counselling services",
|
|
"Mental health support",
|
|
"Disability services",
|
|
"International student support",
|
|
"Financial counselling"
|
|
],
|
|
career: [
|
|
"Career planning workshops",
|
|
"Industry placement programs",
|
|
"Graduate employment services",
|
|
"Networking events",
|
|
"Professional development"
|
|
]
|
|
},
|
|
|
|
// Student Support Services
|
|
student_support: {
|
|
academic_support: {
|
|
learning_support: {
|
|
description: "Free academic skills support for all students",
|
|
services: [
|
|
"Academic writing workshops",
|
|
"Study skills training",
|
|
"Time management coaching",
|
|
"Exam preparation strategies",
|
|
"Research skills development",
|
|
"Critical thinking workshops"
|
|
],
|
|
contact: "learningsupport@utas.edu.au"
|
|
},
|
|
peer_learning: {
|
|
description: "Student-led academic support programs",
|
|
programs: [
|
|
"PASS (Peer Assisted Study Sessions)",
|
|
"Study groups",
|
|
"Peer mentoring",
|
|
"Academic peer coaching",
|
|
"Language exchange programs"
|
|
]
|
|
},
|
|
library_services: {
|
|
description: "Comprehensive library and research support",
|
|
services: [
|
|
"Research consultations",
|
|
"Literature search training",
|
|
"Citation and referencing help",
|
|
"Digital literacy workshops",
|
|
"Subject-specific research guides",
|
|
"Inter-library loans"
|
|
],
|
|
hours: "24/7 online access, extended hours during exams"
|
|
}
|
|
},
|
|
wellbeing_support: {
|
|
counselling: {
|
|
description: "Free, confidential counselling services",
|
|
services: [
|
|
"Individual counselling",
|
|
"Group therapy sessions",
|
|
"Crisis intervention",
|
|
"Mental health workshops",
|
|
"Stress management programs",
|
|
"Relationship counselling"
|
|
],
|
|
contact: "counselling@utas.edu.au",
|
|
phone: "03 6226 2697"
|
|
},
|
|
disability_services: {
|
|
description: "Support for students with disabilities",
|
|
services: [
|
|
"Academic accommodations",
|
|
"Assistive technology",
|
|
"Note-taking services",
|
|
"Alternative assessment arrangements",
|
|
"Mobility and access support",
|
|
"Transition planning"
|
|
],
|
|
contact: "disability.services@utas.edu.au"
|
|
},
|
|
medical_services: {
|
|
description: "On-campus health services",
|
|
services: [
|
|
"General practice consultations",
|
|
"Mental health support",
|
|
"Vaccinations and health checks",
|
|
"Travel health advice",
|
|
"Emergency first aid",
|
|
"Health education programs"
|
|
],
|
|
locations: ["Hobart", "Launceston"]
|
|
}
|
|
},
|
|
financial_support: {
|
|
scholarships: {
|
|
description: "Wide range of scholarships available",
|
|
types: [
|
|
"Academic merit scholarships",
|
|
"Equity scholarships",
|
|
"Research scholarships",
|
|
"International student scholarships",
|
|
"Indigenous scholarships",
|
|
"Regional and rural scholarships"
|
|
],
|
|
amounts: "Up to $10,000 per year",
|
|
website: "scholarships.utas.edu.au"
|
|
},
|
|
financial_aid: {
|
|
description: "Emergency financial assistance",
|
|
services: [
|
|
"Emergency grants",
|
|
"Financial counselling",
|
|
"Budget planning assistance",
|
|
"Centrelink liaison",
|
|
"Student loans guidance",
|
|
"Hardship support"
|
|
]
|
|
}
|
|
},
|
|
career_services: {
|
|
description: "Career development and employment support",
|
|
services: [
|
|
"Career counselling",
|
|
"Resume and cover letter assistance",
|
|
"Interview preparation",
|
|
"Job search strategies",
|
|
"Industry networking events",
|
|
"Graduate employment programs",
|
|
"Internship placements",
|
|
"Professional development workshops"
|
|
],
|
|
contact: "careers@utas.edu.au"
|
|
}
|
|
},
|
|
|
|
// International Student Services
|
|
international: {
|
|
why_utas: {
|
|
benefits: [
|
|
"Small class sizes and personalized attention",
|
|
"100% renewable energy campus",
|
|
"Strong industry connections",
|
|
"Stunning natural environment",
|
|
"Safe and welcoming community",
|
|
"Pathway programs available",
|
|
"Post-study work opportunities"
|
|
],
|
|
rankings: [
|
|
"#1 globally for climate action",
|
|
"5-star QS rating",
|
|
"Top 1% of universities worldwide",
|
|
"Excellence in teaching and research"
|
|
]
|
|
},
|
|
entry_requirements: {
|
|
undergraduate: {
|
|
academic: "Australian Year 12 equivalent",
|
|
english: "IELTS 6.0 overall (no band below 6.0) or equivalent",
|
|
additional: "Some programs have specific prerequisites"
|
|
},
|
|
postgraduate: {
|
|
academic: "Bachelor's degree or equivalent",
|
|
english: "IELTS 6.5 overall (no band below 6.0) or equivalent",
|
|
additional: "Work experience may be required for some programs"
|
|
}
|
|
},
|
|
support_services: {
|
|
arrival_support: [
|
|
"Airport pickup service",
|
|
"Orientation programs",
|
|
"Campus tours",
|
|
"Bank account setup assistance",
|
|
"Mobile phone plans",
|
|
"Transport information"
|
|
],
|
|
ongoing_support: [
|
|
"24/7 emergency support",
|
|
"Academic support",
|
|
"Visa renewal assistance",
|
|
"Cultural adaptation programs",
|
|
"English language support",
|
|
"Social activities and events"
|
|
]
|
|
},
|
|
visa_information: {
|
|
student_visa: {
|
|
type: "Subclass 500",
|
|
requirements: [
|
|
"Genuine Temporary Entrant (GTE) statement",
|
|
"Proof of financial capacity",
|
|
"Health insurance (OSHC)",
|
|
"English proficiency",
|
|
"Health examinations"
|
|
],
|
|
work_rights: "20 hours per week during studies"
|
|
}
|
|
},
|
|
accommodation: {
|
|
on_campus: {
|
|
description: "Fully furnished accommodation with meals",
|
|
options: [
|
|
"Christ College",
|
|
"Jane Franklin Hall",
|
|
"University Apartments",
|
|
"Kerslake Hall"
|
|
],
|
|
cost: "$300-$400 per week"
|
|
},
|
|
off_campus: {
|
|
description: "Independent living options",
|
|
options: [
|
|
"Shared houses",
|
|
"Private rentals",
|
|
"Student housing providers",
|
|
"Homestay arrangements"
|
|
],
|
|
cost: "$150-$300 per week"
|
|
}
|
|
}
|
|
},
|
|
|
|
// Campus Life
|
|
campus_life: {
|
|
accommodation: {
|
|
residential_colleges: {
|
|
christ_college: {
|
|
description: "Historic college with strong academic tradition",
|
|
features: ["Dining hall", "Study rooms", "Common areas", "Pastoral care"],
|
|
cost: "$400-$450 per week",
|
|
capacity: "200 students"
|
|
},
|
|
jane_franklin_hall: {
|
|
description: "Modern accommodation with excellent facilities",
|
|
features: ["Gym", "Study spaces", "Social areas", "Tutoring support"],
|
|
cost: "$350-$400 per week",
|
|
capacity: "400 students"
|
|
},
|
|
university_apartments: {
|
|
description: "Self-catered apartment-style living",
|
|
features: ["Private bathrooms", "Kitchenettes", "Study areas", "Social spaces"],
|
|
cost: "$300-$350 per week",
|
|
capacity: "300 students"
|
|
}
|
|
}
|
|
},
|
|
clubs_societies: {
|
|
categories: [
|
|
"Academic and professional clubs",
|
|
"Cultural and religious societies",
|
|
"Sports and recreation clubs",
|
|
"Special interest groups",
|
|
"Student politics and advocacy",
|
|
"Arts and creative societies"
|
|
],
|
|
student_association: {
|
|
name: "Tasmania University Student Association (TUSA)",
|
|
services: [
|
|
"Student advocacy",
|
|
"Free legal advice",
|
|
"Emergency financial assistance",
|
|
"Social events and activities",
|
|
"Student publications",
|
|
"Clubs and societies support"
|
|
]
|
|
}
|
|
},
|
|
sports_recreation: {
|
|
facilities: [
|
|
"Sports and Aquatic Centre",
|
|
"Fitness centres",
|
|
"Swimming pools",
|
|
"Tennis courts",
|
|
"Basketball courts",
|
|
"Climbing wall"
|
|
],
|
|
programs: [
|
|
"Elite athlete support",
|
|
"Intramural sports",
|
|
"Group fitness classes",
|
|
"Personal training",
|
|
"Sports clubs",
|
|
"Recreation programs"
|
|
]
|
|
},
|
|
dining: {
|
|
on_campus: [
|
|
"Uni Cafe (Sandy Bay)",
|
|
"Mezz Cafe (Launceston)",
|
|
"Food court options",
|
|
"Vending machines",
|
|
"Residential dining halls"
|
|
],
|
|
dietary_options: [
|
|
"Vegetarian and vegan options",
|
|
"Halal certified meals",
|
|
"Gluten-free options",
|
|
"Allergy-friendly choices"
|
|
]
|
|
}
|
|
},
|
|
|
|
// Comprehensive Research Information
|
|
research_comprehensive: {
|
|
excellence_areas: {
|
|
marine_antarctic: {
|
|
description: "World-leading research in marine and Antarctic science",
|
|
institute: "Institute for Marine and Antarctic Studies (IMAS)",
|
|
research_focus: [
|
|
"Climate change impacts on marine ecosystems",
|
|
"Antarctic ice sheet dynamics",
|
|
"Sustainable fisheries management",
|
|
"Ocean acidification",
|
|
"Marine biodiversity conservation",
|
|
"Polar logistics and operations"
|
|
],
|
|
facilities: [
|
|
"Research vessels",
|
|
"Antarctic research stations",
|
|
"Marine laboratories",
|
|
"Climate modeling facilities",
|
|
"Aquaculture research centre"
|
|
],
|
|
partnerships: [
|
|
"Australian Antarctic Division",
|
|
"CSIRO",
|
|
"International Antarctic partners",
|
|
"Fishing industry collaborations"
|
|
]
|
|
},
|
|
agriculture_food: {
|
|
description: "Innovation in sustainable agriculture and food systems",
|
|
institute: "Tasmanian Institute of Agriculture (TIA)",
|
|
research_focus: [
|
|
"Precision agriculture technologies",
|
|
"Crop breeding and genetics",
|
|
"Sustainable farming practices",
|
|
"Food safety and quality",
|
|
"Agricultural robotics",
|
|
"Climate-smart agriculture"
|
|
],
|
|
facilities: [
|
|
"Research farms",
|
|
"Controlled environment facilities",
|
|
"Food processing laboratories",
|
|
"Agricultural technology centres"
|
|
]
|
|
},
|
|
health_medicine: {
|
|
description: "Advancing health outcomes through research",
|
|
institute: "Menzies Institute for Medical Research",
|
|
research_focus: [
|
|
"Chronic disease prevention",
|
|
"Neurological disorders",
|
|
"Population health",
|
|
"Health services research",
|
|
"Digital health technologies",
|
|
"Rural and remote health"
|
|
],
|
|
facilities: [
|
|
"Clinical research facilities",
|
|
"Biomedical laboratories",
|
|
"Population health data centres",
|
|
"Medical imaging facilities"
|
|
]
|
|
},
|
|
creative_arts: {
|
|
description: "Innovation in creative practice and cultural research",
|
|
research_focus: [
|
|
"Contemporary art practice",
|
|
"Cultural heritage preservation",
|
|
"Creative technologies",
|
|
"Performance studies",
|
|
"Design thinking",
|
|
"Cultural tourism"
|
|
],
|
|
facilities: [
|
|
"Art galleries",
|
|
"Performance spaces",
|
|
"Digital media studios",
|
|
"Creative workshops"
|
|
]
|
|
}
|
|
},
|
|
research_training: {
|
|
phd_programs: {
|
|
duration: "3-4 years full-time",
|
|
funding: "Most students receive scholarships",
|
|
support: [
|
|
"Structured research training",
|
|
"Milestone monitoring",
|
|
"Professional development",
|
|
"Conference presentation opportunities",
|
|
"Industry collaboration projects"
|
|
]
|
|
},
|
|
masters_by_research: {
|
|
duration: "1.5-2 years full-time",
|
|
structure: "Coursework + thesis",
|
|
pathways: "Direct entry to PhD programs"
|
|
},
|
|
research_scholarships: {
|
|
types: [
|
|
"Australian Government Research Training Program",
|
|
"UTAS Research Scholarships",
|
|
"Industry-sponsored scholarships",
|
|
"International research scholarships"
|
|
],
|
|
amounts: "$28,000-$35,000 per year",
|
|
additional_support: "Conference funding and research costs"
|
|
}
|
|
}
|
|
},
|
|
|
|
// Additional Services and Information
|
|
additional_services: {
|
|
alumni_network: {
|
|
description: "Strong global network of UTAS graduates",
|
|
services: [
|
|
"Career networking events",
|
|
"Mentorship programs",
|
|
"Professional development",
|
|
"Alumni directories",
|
|
"Reunion events",
|
|
"Alumni benefits and discounts"
|
|
],
|
|
global_reach: "Over 100,000 graduates worldwide"
|
|
},
|
|
community_engagement: {
|
|
description: "Strong connections with local and global communities",
|
|
initiatives: [
|
|
"Community research partnerships",
|
|
"Student volunteer programs",
|
|
"Cultural events and festivals",
|
|
"Public lecture series",
|
|
"Community gardens",
|
|
"Sustainability projects"
|
|
]
|
|
},
|
|
industry_partnerships: {
|
|
description: "Extensive collaborations with industry partners",
|
|
sectors: [
|
|
"Agriculture and aquaculture",
|
|
"Maritime industries",
|
|
"Health and medical technology",
|
|
"Creative industries",
|
|
"Tourism and hospitality",
|
|
"Technology and innovation"
|
|
],
|
|
benefits: [
|
|
"Work-integrated learning",
|
|
"Graduate employment opportunities",
|
|
"Industry-sponsored research",
|
|
"Professional development programs",
|
|
"Internship placements"
|
|
]
|
|
}
|
|
},
|
|
|
|
// FAQs
|
|
faqs: [
|
|
{
|
|
q: "What is UTAS known for?",
|
|
a: "UTAS is globally ranked #1 for climate action and is renowned for marine and Antarctic science research, sustainability leadership, and quality education in a unique island environment."
|
|
},
|
|
{
|
|
q: "How do I apply to UTAS?",
|
|
a: "Domestic students apply through the UAC UTAS portal, while international students can apply directly or through authorised agents. Applications are free and available online."
|
|
},
|
|
{
|
|
q: "What scholarships are available?",
|
|
a: "UTAS offers various scholarships including Merit Scholarships ($5,000/year), Tasmanian Scholarships ($15,000/year), and specific program scholarships. Check our scholarships portal for details."
|
|
},
|
|
{
|
|
q: "Where are UTAS campuses located?",
|
|
a: "UTAS has four campuses: Hobart (main), Launceston (northern), Burnie (regional), and Sydney (city campus for business programs)."
|
|
},
|
|
{
|
|
q: "What support is available for students?",
|
|
a: "Comprehensive support including academic assistance, mental health counselling, disability services, career guidance, and international student support."
|
|
}
|
|
]
|
|
};
|
|
|
|
// Types for search results
|
|
interface CourseResult {
|
|
type: 'course';
|
|
data: {
|
|
id: string;
|
|
title: string;
|
|
area: string;
|
|
duration: string;
|
|
description: string;
|
|
entry: string;
|
|
campus: string[];
|
|
fees: string;
|
|
pathways: string[];
|
|
};
|
|
relevance: number;
|
|
}
|
|
|
|
interface FAQResult {
|
|
type: 'faq';
|
|
data: {
|
|
q: string;
|
|
a: string;
|
|
};
|
|
relevance: number;
|
|
}
|
|
|
|
type SearchResult = CourseResult | FAQResult;
|
|
|
|
// Search functions for RAG
|
|
export const searchKnowledgeBase = (query: string, category?: string): SearchResult[] => {
|
|
const results: SearchResult[] = [];
|
|
const searchTerms = query.toLowerCase().split(' ');
|
|
|
|
// Search courses
|
|
if (!category || category === 'courses') {
|
|
[...utasKnowledgeBase.courses.undergraduate, ...utasKnowledgeBase.courses.postgraduate].forEach(course => {
|
|
const relevance = searchTerms.reduce((score, term) => {
|
|
if (course.title.toLowerCase().includes(term) ||
|
|
course.description.toLowerCase().includes(term) ||
|
|
course.area.toLowerCase().includes(term)) {
|
|
return score + 1;
|
|
}
|
|
return score;
|
|
}, 0);
|
|
|
|
if (relevance > 0) {
|
|
results.push({ type: 'course', data: course, relevance });
|
|
}
|
|
});
|
|
}
|
|
|
|
// Search FAQs
|
|
if (!category || category === 'faq') {
|
|
utasKnowledgeBase.faqs.forEach(faq => {
|
|
const relevance = searchTerms.reduce((score, term) => {
|
|
if (faq.q.toLowerCase().includes(term) || faq.a.toLowerCase().includes(term)) {
|
|
return score + 1;
|
|
}
|
|
return score;
|
|
}, 0);
|
|
|
|
if (relevance > 0) {
|
|
results.push({ type: 'faq', data: faq, relevance });
|
|
}
|
|
});
|
|
}
|
|
|
|
return results.sort((a, b) => b.relevance - a.relevance).slice(0, 5);
|
|
};
|
|
|
|
export default utasKnowledgeBase;
|