-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Description
Implement AI-powered suggestions and recommendations based on document content, query patterns, and user behavior to enhance the interactive experience.
User Stories
- As a user, I want to see suggested follow-up questions after each response
- As a user, I want recommendations for related topics I might want to explore
- As a user, I want quick action templates for common queries
- As a user, I want to discover content in my documents I haven't explored yet
- As a user, I want context-aware suggestions that understand my conversation flow
Tasks
Suggestion Components
-
Create
src/components/SmartSuggestions.vue- Suggestion cards container
- Individual suggestion items
- Click to auto-fill query
- Refresh suggestions button
- Dismiss/hide functionality
- Loading state while generating
- Empty state when no suggestions
-
Create
src/components/QuickActions.vue- Template library display
- Template categories
- Search templates
- Click to apply template
- Custom template creation
Store Management
- Create
src/store/suggestions.ts- State for current suggestions
- State for suggestion history
- State for user preferences
- Actions to fetch suggestions
- Actions to track suggestion usage
- Getters for filtered suggestions
- Cache management
AI-Powered Suggestions
- Implement context analysis
- Analyze recent conversation messages
- Extract key topics and entities
- Identify question patterns
- Detect user intent
- Generate follow-up questions
- Based on last AI response
- Consider document sources cited
- Explore related concepts
- Drill deeper into topics
- Compare/contrast suggestions
- Create query templates
- "Summarize [document/section]"
- "Compare [concept A] and [concept B]"
- "What are the key points about [topic]?"
- "Explain [term] in simple terms"
- "Show examples of [concept]"
- "What are the implications of [finding]?"
Document-Based Recommendations
- Extract key topics from documents
- Use
QuerySourcedata - Identify main themes
- Extract section headings
- Find frequently mentioned terms
- Use
- Suggest unexplored content
- Identify unqueried documents
- Find unvisited pages/sections
- Highlight new uploads
- Suggest related documents
- Generate "You might want to ask about..."
- Based on document content
- Based on similar user queries (if available)
- Based on conversation context
- Based on bookmarked content
Quick Actions System
-
Create quick action templates
export interface QuickAction { id: string name: string description: string category: string template: string variables?: string[] // Placeholders in template }
-
Implement template categories
- "Summarization" - summarize documents/sections
- "Analysis" - analyze concepts/patterns
- "Comparison" - compare items
- "Explanation" - explain terms/concepts
- "Examples" - request examples
- "Custom" - user-created templates
-
Template variable system
- Identify placeholders (e.g.,
{document},{topic}) - Prompt user for variable values
- Auto-fill from context when possible
- Save filled templates for reuse
- Identify placeholders (e.g.,
Backend Integration
-
Update
src/services/api.ts- Add
getSuggestions()endpoint - Add
getRelatedTopics()endpoint - Add
getDocumentInsights()endpoint - Implement caching strategy
- Error handling for failed suggestions
- Add
-
Backend API Requirements (for backend team)
// POST /api/suggestions interface SuggestionsRequest { conversationContext: Message[] currentDocument?: string queryHistory?: string[] maxSuggestions?: number } interface SuggestionsResponse { followUpQuestions: string[] relatedTopics: string[] unexploredContent: { documentId: string title: string reason: string }[] quickActions: QuickAction[] }
Integration with Existing Features
- Display suggestions in
ChatView.vue- Below last AI message
- As floating sidebar panel
- Configurable position
- Use analytics data from v0.5.0
- Suggest based on popular queries
- Identify gaps in document coverage
- Personalize based on usage patterns
- Integrate with bookmarks from v0.3.0
- Suggest reviewing bookmarked content
- Generate questions from bookmarks
- Find related content to bookmarks
User Preferences
- Create suggestion settings
- Enable/disable suggestions
- Number of suggestions to show (3-10)
- Auto-refresh frequency
- Preferred suggestion types
- Hide dismissed suggestions
Acceptance Criteria
- Suggestions appear after each AI response (if enabled)
- At least 3-5 relevant suggestions generated per response
- Suggestions are contextually relevant (>80% relevance)
- Can click suggestion to auto-fill query input
- Can dismiss individual suggestions
- Can refresh suggestions manually
- Quick action templates work correctly with variables
- Can create custom quick action templates
- Document recommendations highlight unexplored content
- Suggestions don't impact chat performance
- Suggestions load within 2 seconds
- Settings allow full customization of suggestion behavior
- Suggestion usage is tracked for future improvements
Dependencies
- All previous versions (v0.1.0 - v0.5.0)
ragAPI.queryDocumentsfromsrc/services/api.ts- Analytics data from v0.5.0
- Bookmark data from v0.3.0
- New backend endpoint required:
/api/suggestions
Design Notes
Suggestion Display
- Show 3-5 suggestions by default
- Use card-based layout
- Each suggestion has:
- Icon indicating type (question, document, action)
- Suggestion text
- Click to use
- Dismiss button (small X)
- Subtle animation on appearance
- Horizontal scrolling on mobile
Quick Actions
- Grid layout for templates
- Category tabs at top
- Search bar for filtering
- Variable inputs as inline forms
- Preview of filled template
Colors & Icons
- Follow-up questions: 💡 (lightbulb) - Blue
- Related topics: 🔗 (link) - Purple
- Unexplored content: 📄 (document) - Green
- Quick actions: ⚡ (lightning) - Orange
Technical Considerations
Performance
- Cache suggestions for 5 minutes
- Debounce suggestion refresh (1 second)
- Load suggestions asynchronously
- Don't block chat functionality
- Implement request cancellation for rapid context changes
Suggestion Quality
- Use last 3-5 messages for context
- Limit context size to 2000 tokens
- Filter out repetitive suggestions
- Track dismissed suggestions to avoid re-suggesting
- A/B test different suggestion algorithms
Fallback Strategy
- If backend unavailable, use rule-based suggestions
- Extract nouns/entities from last response
- Generate "Tell me more about [entity]" suggestions
- Suggest document-based queries from metadata
Data Privacy
- Don't send sensitive conversation data to external APIs
- Process suggestions server-side when possible
- Allow users to opt-out completely
- Clear suggestion history on logout
Testing Checklist
- Test suggestions with short conversations (1-2 messages)
- Test suggestions with long conversations (50+ messages)
- Test with no conversation context (first message)
- Test quick action templates with variables
- Test creating custom quick actions
- Test suggestion relevance (manual review)
- Test suggestion performance (load time)
- Test with backend unavailable (fallback)
- Test dismissing suggestions
- Test refreshing suggestions
- Test settings toggle
- Test mobile layout
- Test with different document types
- Verify no duplicate suggestions
Related Issues
- Depends on: All previous versions (v0.1.0 - v0.5.0)
- Uses data from: [v0.3.0] Bookmarks & Labels System #4 (v0.5.0 Analytics)
- Uses data from: Setup Vitest for Testing Infrastructure #2 (v0.3.0 Bookmarks)
- Requires: Backend API enhancement
Milestone
v0.6.0 Release
Backend Requirements Checklist
- Create
/api/suggestionsendpoint - Implement suggestion generation algorithm
- Add caching layer for suggestions
- Create suggestion relevance scoring
- Add rate limiting (prevent abuse)
- Document API schema
- Provide example responses
- Add monitoring/logging for suggestion quality
Additional Resources
- Consider using LangChain for suggestion generation
- Research: Query suggestion best practices
- Reference: Google search suggestions algorithm
- Reference: Amazon product recommendations system
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request