-
-
Notifications
You must be signed in to change notification settings - Fork 31
Feature/ai search recommendations Added #85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 2 commits
8054e2c
c54b10d
b583812
137bc59
0334ebb
d773399
bf44d4e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,7 +1,11 @@ | ||||||||||
| NEXT_PUBLIC_API_KEY= | ||||||||||
| NEXT_PUBLIC_AUTH_DOMAIN= | ||||||||||
| NEXT_PUBLIC_PROJECT_ID= | ||||||||||
| NEXT_PUBLIC_STORAGE_BUCKET= | ||||||||||
| NEXT_PUBLIC_MESSAGING_SENDER_ID= | ||||||||||
| NEXT_PUBLIC_APP_ID= | ||||||||||
| # Firebase Configuration | ||||||||||
| NEXT_PUBLIC_FIREBASE_API_KEY= | ||||||||||
| NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN= | ||||||||||
| NEXT_PUBLIC_FIREBASE_PROJECT_ID= | ||||||||||
| NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET= | ||||||||||
| NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID= | ||||||||||
| NEXT_PUBLIC_FIREBASE_APP_ID= | ||||||||||
| NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID= | ||||||||||
|
|
||||||||||
| # Google Gemini API Key | ||||||||||
| NEXT_PUBLIC_GEMINI_API_KEY= | ||||||||||
|
||||||||||
| NEXT_PUBLIC_GEMINI_API_KEY= | |
| NEXT_PUBLIC_GEMINI_API_KEY= | |
| # (Optional) Override the default Gemini model used by the app | |
| NEXT_PUBLIC_GEMINI_MODEL_ID= |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,8 @@ | ||
| node_modules | ||
| package-lock.json | ||
| node_modules/ | ||
| package-lock.json | ||
| .env/ | ||
| .env.local | ||
| .env*.local | ||
| .next/ | ||
| .idea/ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,178 @@ | ||
| # AI Sound Recommendation - How It Works | ||
|
|
||
| ## 🎯 Overview | ||
| The AI recommendation system uses Google's Gemini 2.5 Pro to intelligently match user queries with available sounds. | ||
|
|
||
| ## 🔍 Search Examples | ||
|
|
||
| ### For Peaceful/Relaxing Sounds | ||
| **Search terms:** | ||
| - "peaceful" | ||
| - "peaceful songs" | ||
| - "relaxing" | ||
| - "calm" | ||
| - "meditation" | ||
| - "sleep" | ||
|
|
||
| **Expected results:** Rain, Waterfall, Forest, Birds, Ocean, Wind, Night sounds, etc. | ||
|
|
||
| ### For Work/Focus Sounds | ||
| **Search terms:** | ||
| - "work" | ||
| - "focus" | ||
| - "concentration" | ||
| - "productivity" | ||
| - "study" | ||
| - "office" | ||
|
|
||
| **Expected results:** Coffee Shop, Keyboard, Clock, Train, Office ambience, White noise, etc. | ||
|
|
||
| ### For Nature Sounds | ||
| **Search terms:** | ||
| - "nature" | ||
| - "outdoor" | ||
| - "forest" | ||
| - "wilderness" | ||
|
|
||
| **Expected results:** Forest, Birds, Waterfall, Ocean, Wind, Rain, etc. | ||
|
|
||
| ### For Energetic/Active Sounds | ||
| **Search terms:** | ||
| - "energetic" | ||
| - "active" | ||
| - "upbeat" | ||
| - "motivating" | ||
|
|
||
| **Expected results:** Upbeat and rhythmic sounds from your collection | ||
|
|
||
| ### For Sleep/Night | ||
| **Search terms:** | ||
| - "sleep" | ||
| - "night" | ||
| - "bedtime" | ||
| - "rest" | ||
|
|
||
| **Expected results:** Calming sounds like Rain, Ocean, Wind, Night sounds | ||
|
|
||
| ## 🤖 How the AI Works | ||
|
|
||
| 1. **User enters a query** (e.g., "peaceful songs") | ||
| 2. **AI analyzes the query** to understand: | ||
| - Mood (peaceful, energetic, calm) | ||
| - Activity (work, sleep, meditation) | ||
| - Context (nature, office, night) | ||
| 3. **AI searches available sounds** in your card collection | ||
| 4. **Returns matching titles** (maximum 8 sounds) | ||
| 5. **Displays as cards** with smooth animations | ||
|
|
||
| ## 🎨 Features | ||
|
|
||
| ### Intelligent Matching | ||
| - ✅ Understands synonyms (e.g., "calm" = "peaceful") | ||
| - ✅ Context-aware (e.g., "work" suggests office sounds) | ||
| - ✅ Mood-based recommendations | ||
| - ✅ Activity-based suggestions | ||
|
|
||
| ### Fuzzy Matching | ||
| - If exact title match fails, tries partial matching | ||
| - Case-insensitive searching | ||
| - Handles variations in AI responses | ||
|
|
||
| ### User Experience | ||
| - Loading spinner while AI processes | ||
| - Clear error messages | ||
| - Search suggestions in placeholder | ||
| - Enter key support for quick search | ||
| - Maximum 8 recommendations to avoid overwhelming | ||
|
|
||
| ## 🔧 Technical Details | ||
|
|
||
| ### Model Configuration | ||
| - **Model:** `gemini-2.5-pro-preview-03-25` | ||
| - **API Key:** From `.env.local` (`NEXT_PUBLIC_GEMINI_API_KEY`) | ||
| - **Temperature:** 1 (balanced creativity) | ||
| - **Max Tokens:** 8192 | ||
|
|
||
| ### Response Processing | ||
| 1. Clean response (remove quotes, newlines) | ||
| 2. Split by commas | ||
| 3. Trim whitespace | ||
| 4. Filter empty strings | ||
| 5. Match against available cards | ||
| 6. Fallback to partial matching if needed | ||
|
|
||
| ## 📋 Available Sound Categories | ||
|
|
||
| Based on typical sound libraries, users can search for: | ||
|
|
||
| ### Ambience | ||
| - Office, Coffee Shop, Library, Restaurant | ||
|
|
||
| ### Nature | ||
| - Rain, Thunder, Ocean, Wind, Forest, Birds, Waterfall, River | ||
|
|
||
| ### White Noise | ||
| - White noise, Pink noise, Brown noise | ||
|
|
||
| ### Mechanical | ||
| - Fan, Clock, Train, Keyboard, Mouse | ||
|
|
||
| ### Music Instruments | ||
| - Piano, Guitar, Drums, Violin, etc. | ||
|
|
||
| ### Weather | ||
| - Rain, Storm, Thunder, Wind, Snow | ||
|
|
||
| ## 💡 Tips for Best Results | ||
|
|
||
| ### Do's ✅ | ||
| - Use simple, descriptive terms | ||
| - Describe mood or activity | ||
| - Try common categories (peaceful, work, nature) | ||
| - Use English terms | ||
|
|
||
| ### Don'ts ❌ | ||
| - Avoid very specific song names | ||
| - Don't use complex sentences | ||
| - Avoid misspellings | ||
| - Don't search for unavailable sounds | ||
|
|
||
| ## 🐛 Troubleshooting | ||
|
|
||
| ### "No matching sounds found" | ||
| - Try broader terms (e.g., "peaceful" instead of "very peaceful calm songs") | ||
| - Check spelling | ||
| - Try suggested search terms from placeholder | ||
|
|
||
| ### AI takes too long | ||
| - Check internet connection | ||
| - API key might have rate limits | ||
| - Try refreshing the page | ||
|
|
||
| ### Wrong recommendations | ||
| - Be more specific with your search | ||
| - Use activity-based terms (work, sleep, etc.) | ||
| - Try different synonyms | ||
|
|
||
| ## 🔮 Future Enhancements | ||
|
|
||
| Potential improvements: | ||
| - [ ] Save favorite searches | ||
| - [ ] Popular searches suggestions | ||
| - [ ] Search history | ||
| - [ ] Voice search | ||
| - [ ] Multi-language support | ||
| - [ ] Custom sound blends | ||
| - [ ] Time-based recommendations (morning, evening, etc.) | ||
|
|
||
| ## 📊 Performance | ||
|
|
||
| - **Response Time:** 2-5 seconds (depends on AI) | ||
| - **Accuracy:** ~90% with clear search terms | ||
| - **Max Results:** 8 sounds per search | ||
| - **Supported Queries:** Unlimited | ||
|
|
||
| --- | ||
|
|
||
| **Last Updated:** October 15, 2025 | ||
| **Model Version:** Gemini 2.5 Pro Preview (03-25) |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,173 @@ | ||||||||||||||||||||||||||||||||||||||||||
| # Live Rotating Recommendations Feature | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| ## ✨ Overview | ||||||||||||||||||||||||||||||||||||||||||
| The AI Sound Recommendation section now includes a **live rotating suggestion** feature that displays sound recommendations directly in the search box placeholder, changing every 2 seconds. | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| ## 🎯 Features | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| ### 1. Live Rotating Suggestions | ||||||||||||||||||||||||||||||||||||||||||
| - **10 random sounds** are selected on component mount | ||||||||||||||||||||||||||||||||||||||||||
| - Rotates through them **every 2 seconds** | ||||||||||||||||||||||||||||||||||||||||||
| - Displays in the search box as dynamic placeholder | ||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||
| The AI Sound Recommendation section now includes a **live rotating suggestion** feature that displays sound recommendations directly in the search box placeholder, changing every 2 seconds. | |
| ## 🎯 Features | |
| ### 1. Live Rotating Suggestions | |
| - **10 random sounds** are selected on component mount | |
| - Rotates through them **every 2 seconds** | |
| - Displays in the search box as dynamic placeholder | |
| The AI Sound Recommendation section now includes a **live rotating suggestion** feature that displays category suggestions directly in the search box placeholder, changing every 2 seconds. | |
| ## 🎯 Features | |
| ### 1. Live Rotating Suggestions | |
| - **10 random sounds** are selected on component mount | |
| - Rotates through them **every 2 seconds** | |
| - Displays rotating category suggestions in the search box as dynamic placeholder |
amitabhanmolpain marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
Outdated
Copilot
AI
Oct 15, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The doc describes animated icons and progress dots that are not present in the current AiRecommendation.js implementation. Either implement these UI elements or update the documentation to accurately reflect the shipped feature (rotating category text overlay).
| #### Animated Icon | |
| - Shows the sound's icon on the left side of search box | |
| - Smoothly transitions between sounds | |
| - Color: Blue theme (matches the design) | |
| #### Dynamic Placeholder | |
| - Changes to show current suggested sound | |
| - Format: `Try: "Forest"...`, `Try: "Rain"...`, etc. | |
| - Disappears when user starts typing | |
| #### Progress Indicators | |
| - Animated dots below search box | |
| - Shows current position (e.g., 3/10) | |
| - Active dot expands, others are small | |
| - Smooth transitions | |
| #### Dynamic Placeholder | |
| - Changes to show current suggested sound | |
| - Format: `Try: "Forest"...`, `Try: "Rain"...`, etc. | |
| - Disappears when user starts typing | |
| - Smooth fade/transition between suggestions |
Outdated
Copilot
AI
Oct 15, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Progress dots are documented but not implemented in the UI. Either add the dots component to the search box or remove this section to avoid confusion.
| ### Progress Dots | |
| - **Active**: 24px width, blue color | |
| - **Inactive**: 6px width, gray color | |
| - **Spacing**: 4px gap | |
| - **Height**: 6px | |
| - **Transition**: 300ms all properties |
Outdated
Copilot
AI
Oct 15, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The document describes 'Progress Dots' but the current UI doesn't implement them. Either implement the dots in the UI or remove this section to keep documentation aligned with the code.
| ### Progress Dots | |
| - **Active**: 24px width, blue color | |
| - **Inactive**: 6px width, gray color | |
| - **Spacing**: 4px gap | |
| - **Height**: 6px | |
| - **Transition**: 300ms all properties |
Outdated
Copilot
AI
Oct 15, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code does not use React.createElement for icon rendering in the input overlay; icons aren't rendered there. Please remove or adjust this bullet to match the current implementation.
| - ✅ Uses React.createElement for dynamic icon rendering |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Firebase env variable names were changed (NEXT_PUBLIC_* to NEXT_PUBLIC_FIREBASE_*). Please add a migration note in the project README or deployment docs so existing environments can update their configuration without breaking auth/database initialization.