Skip to content

Conversation

@codeunia-dev
Copy link
Owner

@codeunia-dev codeunia-dev commented Nov 26, 2025

This PR introduces natural language search for both events and hackathons, allowing users to search using flexible, human-style queries instead of rigid keyword matching.

Additionally, the AI context-generation pipeline has been refined to produce cleaner, more structured prompts, improving response quality, personalization, and contextual awareness.


✅ Key Enhancements

1. Natural Language Search for Events & Hackathons

  • Added support for fuzzy and semantic-style matching.
  • Users can now search using natural phrasing such as:
    "Show me upcoming coding competitions"
    "Any hackathons in December?"
    "Events related to AI or startups"
  • Improves discoverability and user experience across the platform.

2. Improved AI Context Generation

  • Consolidated and optimized contextual data collection.

  • Injected cleaner structure into the context object.

  • Ensures the AI receives:

    • User profile information (name, etc.)
    • Recent interactions
    • Relevant company/event/hackathon data
    • System-level constraints and instructions

This leads to more accurate and personalized responses.


3. Refined Prompt Formatting

  • Prompts now follow a more consistent template.
  • Reduced noise and ambiguity in system and user messages.
  • Better structure → better model output, especially for multi-step or reasoning-based queries.

🧪 Testing

Search

  • Try different natural language queries:

    • “hackathons next month”
    • “events for beginners”
    • “anything related to web development”
  • Confirm results appear in correct order and relevance.

AI Responses

  • Test personalized prompts (e.g., “What’s my name?”)
  • Test reasoning-heavy queries
  • Validate improved structure and tone consistency

🔍 Notes

These updates do not modify database schema or authentication logic.
All changes are isolated to search utilities, context building, and prompt generation.


🤖💫 Funny Note

With all these upgrades, the AI can now understand your searches and your life better-
just don’t ask it for dating advice; even supercomputers crash under that workload. 😄

Summary by CodeRabbit

  • New Features
    • Search functionality now extracts terms from queries to filter events and hackathons with matching results.
    • Results sorted chronologically and limited to upcoming dates.
    • Event and hackathon listings now display active/upcoming status with standardized fields for better clarity.

✏️ Tip: You can customize this high-level summary in your review settings.

…efine AI context generation and prompt formatting.
@vercel
Copy link

vercel bot commented Nov 26, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
codeunia Building Building Preview Comment Nov 26, 2025 10:50am

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 26, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

The pull request enhances the AI API route by introducing search term extraction from user messages to intelligently filter events and hackathons. The getEvents and getHackathons functions now accept optional search terms and apply OR-based filtering. The getContextualData function computes search terms and conditionally passes them to these functions, enabling smarter context-aware retrieval with results ordered by date and filtered to future dates.

Changes

Cohort / File(s) Summary
Search-driven event and hackathon filtering
app/api/ai/route.ts
Added search term extraction helper and updated getEvents/getHackathons to accept optional searchTerms parameter with OR-based ilike filtering; getContextualData now computes search terms and passes them to these functions; results ordered by date ascending and filtered to future dates; updated response formatting to label context as "currently active/upcoming" with standardized fields; added console logs for extracted search terms and matched results

Sequence Diagram

sequenceDiagram
    participant User
    participant AI API
    participant SearchHelper
    participant DB Filter

    User->>AI API: User message with query
    AI API->>SearchHelper: Extract search terms from message
    SearchHelper-->>AI API: Return search terms array
    
    alt Has specific context
        AI API->>DB Filter: getEvents/getHackathons with searchTerms
    else Has general query with search terms
        AI API->>DB Filter: getEvents/getHackathons with searchTerms
    else Fallback
        AI API->>DB Filter: getEvents/getHackathons (no filter)
    end
    
    DB Filter-->>DB Filter: Apply OR-based ilike filters<br/>on search terms
    DB Filter-->>DB Filter: Filter to future dates<br/>Order by date ascending
    DB Filter-->>AI API: Return filtered results
    
    AI API->>AI API: Log matched terms & results
    AI API->>AI API: Format response with<br/>"currently active/upcoming"
    AI API-->>User: Contextual AI response
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Areas requiring extra attention:
    • Search term extraction logic and its correctness in parsing user messages
    • OR-based filtering implementation and SQL ilike query construction
    • Ordering and date filtering logic to ensure only future dates are returned
    • Integration points where search terms flow through getContextualData to the retrieval functions
    • Prompt formatting changes and console logging consistency

Possibly related PRs

Poem

🐰 With eager whiskers twitching bright,
We search through events, left and right!
Terms extracted, futures found,
Hackathons and gatherings abound!
Context flows like morning dew,
Smart filters make responses true! ✨

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/unio

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 970d292 and 9188c3d.

📒 Files selected for processing (1)
  • app/api/ai/route.ts (7 hunks)

Tip

📝 Customizable high-level summaries are now available in beta!

You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.

  • Provide your own instructions using the high_level_summary_instructions setting.
  • Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
  • Use high_level_summary_in_walkthrough to move the summary from the description to the walkthrough section.

Example instruction:

"Divide the high-level summary into five sections:

  1. 📝 Description — Summarize the main change in 50–60 words, explaining what was done.
  2. 📓 References — List relevant issues, discussions, documentation, or related PRs.
  3. 📦 Dependencies & Requirements — Mention any new/updated dependencies, environment variable changes, or configuration updates.
  4. 📊 Contributor Summary — Include a Markdown table showing contributions:
    | Contributor | Lines Added | Lines Removed | Files Changed |
  5. ✔️ Additional Notes — Add any extra reviewer context.
    Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."

Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codeunia-dev codeunia-dev merged commit b1e2041 into main Nov 26, 2025
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants