Spaces:
Sleeping
Sleeping
| import random | |
| from intent_mapper import detect_intent | |
| def load_text(filename: str) -> str: | |
| with open(filename, "r", encoding="utf-8") as f: | |
| return f.read().strip() | |
| # Load knowledge files (FLAT FILES) | |
| PROFILE = load_text("futurelab_profile.txt") | |
| SERVICES = load_text("services.txt") | |
| WORKSHOPS = load_text("workshops.txt") | |
| INTRO_LINES = [ | |
| "Good question.", | |
| "Sure, let me explain.", | |
| "Here’s a quick overview.", | |
| "Happy to clarify.", | |
| ] | |
| FOLLOW_UP_LINES = [ | |
| "Let me know if you’d like more details.", | |
| "You can also ask about our services or workshops.", | |
| ] | |
| def get_response(user_input: str) -> str: | |
| intent = detect_intent(user_input) | |
| intro = random.choice(INTRO_LINES) | |
| follow_up = random.choice(FOLLOW_UP_LINES) | |
| if intent == "profile": | |
| return f"{intro}\n\n{PROFILE}\n\n{follow_up}" | |
| if intent == "focus": | |
| return ( | |
| "Futurelab Studios focuses on AI enablement and adoption. " | |
| "We help organizations and individuals apply AI in practical, " | |
| "responsible ways through consulting, education, and AI-first tools." | |
| ) | |
| if intent == "consulting": | |
| return ( | |
| "Yes, Futurelab Studios provides AI consulting. " | |
| "We work with organizations to identify real business use cases, " | |
| "design AI-driven workflows, and support responsible AI adoption." | |
| ) | |
| if intent == "adoption": | |
| return ( | |
| "Futurelab helps organizations adopt AI by combining strategic " | |
| "consulting, hands-on workshops, and the development of custom " | |
| "AI tools that fit naturally into existing workflows." | |
| ) | |
| if intent == "global": | |
| return ( | |
| "Yes, Futurelab Studios works with a global audience. " | |
| "We collaborate with organizations and professionals across " | |
| "different regions and design our AI solutions and workshops " | |
| "to be globally relevant." | |
| ) | |
| if intent == "services": | |
| return f"{intro}\n\n{SERVICES}\n\n{follow_up}" | |
| if intent == "workshops": | |
| return f"{intro}\n\n{WORKSHOPS}\n\n{follow_up}" | |
| # Brand-safe fallback | |
| return ( | |
| "I can help you understand what Futurelab Studios does, " | |
| "how we help organizations adopt AI, or what services " | |
| "and workshops we offer." | |
| ) | |