Skip to content

Feat: Add AI suggestion controller with accept/dismiss flows (Phase 6)#212

Closed
jhodapp wants to merge 22 commits intomainfrom
feature/146-ai-meeting-integration-phase6-suggestions
Closed

Feat: Add AI suggestion controller with accept/dismiss flows (Phase 6)#212
jhodapp wants to merge 22 commits intomainfrom
feature/146-ai-meeting-integration-phase6-suggestions

Conversation

@jhodapp
Copy link
Copy Markdown
Member

@jhodapp jhodapp commented Dec 20, 2025

Summary

Adds the AI suggestion controller with full CRUD operations for managing AI-detected actions and agreements from transcripts.

Changes

  • Adds ai_suggestion_controller with full CRUD operations for AI suggestions
  • Implements accept flow that creates Actions or Agreements from AI-detected suggestions
  • Implements dismiss flow to mark suggestions as no longer relevant
  • Exports ai_suggested_item module from domain for CRUD operations
  • Adds authorization checks (only session participants can manage suggestions)

New Endpoints

  • GET /coaching_sessions/:id/ai-suggestions - Get pending AI suggestions for a session
  • POST /ai-suggestions/:id/accept - Accept a suggestion, creating an Action or Agreement
  • POST /ai-suggestions/:id/dismiss - Dismiss a suggestion

Accept Flow

When a user accepts an AI suggestion:

  1. Validates the suggestion is still pending
  2. Gets the coaching session from the transcription chain
  3. Verifies user is a participant (coach or coachee)
  4. Creates an Action or Agreement based on suggestion type
  5. Sets default due_by to current timestamp for actions
  6. Links the suggestion to the created entity

Recent Changes

  • Fixed default due_by date for accepted actions (uses current timestamp instead of null)
  • Fixed serde serialization for AiSuggestionType and AiSuggestionStatus enums (lowercase)
  • Added LeMUR metadata support (stated_by, assigned_to, source_segment)

Test plan

  • Verify cargo check passes with no warnings
  • Verify cargo clippy passes with no warnings
  • Test get suggestions endpoint with mock data
  • Test accept flow creates Action with due_by correctly
  • Test accept flow creates Agreement correctly
  • Test dismiss flow updates status correctly
  • Verify authorization checks work for non-participants

Part of #146 - Phase 6 of AI Meeting Integration (final backend phase)

Add database schema, entities, and CRUD operations for the AI meeting
recording and transcription integration:

Database Migrations:
- Add user_integrations table for encrypted API credentials
- Add ai_privacy_level enum and meeting_url to coaching_relationships
- Add meeting_recordings, transcriptions, transcript_segments tables
- Add ai_suggested_items table for AI-detected actions/agreements

Entity Definitions:
- user_integrations (Google OAuth, Recall.ai, AssemblyAI credentials)
- meeting_recordings (Recall.ai bot tracking)
- transcriptions (AssemblyAI transcript data)
- transcript_segments (speaker-diarized utterances)
- ai_suggested_items (pending AI suggestions)
- Enums: ai_privacy_level, meeting_recording_status, transcription_status,
  sentiment, ai_suggestion_type, ai_suggestion_status

Entity API:
- CRUD operations for user_integration, meeting_recording, transcription,
  and ai_suggested_item modules

Other:
- AES-256-GCM encryption utilities for API key storage
- Config additions for external service credentials
- Update coaching_relationships with meeting_url and ai_privacy_level

Relates to: refactor-group/refactor-platform-fe#146
…se 3)

Add gateway clients for Recall.ai, AssemblyAI, and Google OAuth with
configurable base URLs. Create integration controller endpoints for
API key verification and OAuth flow handling.
Add start/stop recording endpoints that integrate with Recall.ai bot
for meeting capture. Add webhook handler for receiving recording
status updates from Recall.ai.
- Add transcript_segment entity_api module with CRUD operations
- Add AssemblyAI webhook handler for transcription callbacks
- Create transcription controller with transcript/segments/summary endpoints
- Update router with transcription routes
- Export transcript_segment and transcription modules from domain
- Add ai_suggestion_controller with endpoints for suggestion management
- Implement accept flow that creates Actions or Agreements from suggestions
- Implement dismiss flow to mark suggestions as dismissed
- Export ai_suggested_item module from domain
- Add routes for GET /coaching_sessions/:id/ai-suggestions
- Add routes for POST /ai-suggestions/:id/accept and /dismiss
- Add nested response structures for Recall.ai video URL extraction
  (recordings[0].media_shortcuts.video_mixed.data.download_url)
- Add backend polling for Recall.ai bot status when frontend requests
- Fix AssemblyAI webhook field name mismatch (id vs transcript_id)
- Fetch full transcript from AssemblyAI API on webhook notification
  (webhooks are notifications only, don't include transcript data)
- Add comprehensive debug logging for troubleshooting
- Add serde(rename_all = "snake_case") to AiPrivacyLevel enum
- Add serde(default) to UpdateParams fields for optional deserialization
- Add Default derive to UpdateParams struct
- Add action item extraction after transcription completes
- Create AI suggestion records for each detected action item
- Use keyword-based extraction (will, going to, need to, should, etc.)
- Log extraction results for debugging
- Add nested response structures for Recall.ai video URL extraction
  (recordings[0].media_shortcuts.video_mixed.data.download_url)
- Add backend polling for Recall.ai bot status when frontend requests
- Fix AssemblyAI webhook field name mismatch (id vs transcript_id)
- Fetch full transcript from AssemblyAI API on webhook notification
  (webhooks are notifications only, don't include transcript data)
- Add comprehensive debug logging for troubleshooting
- Add serde(rename_all = "snake_case") to AiPrivacyLevel enum
- Add serde(default) to UpdateParams fields for optional deserialization
- Add Default derive to UpdateParams struct
- Add action item extraction after transcription completes
- Create AI suggestion records for each detected action item
- Use keyword-based extraction (will, going to, need to, should, etc.)
- Log extraction results for debugging
- Add LeMUR API client for extracting actions/agreements from transcripts
- Implement dual AI privacy levels (coach + coachee must both consent)
- Add manual extraction endpoints for actions and agreements
- Fix Recall.ai JSON deserialization for null values
- Fix serde serialization to use lowercase enum variants
- Upgrade API error logs from WARN to ERROR level
- Silence verbose SQLx/SeaORM query logs
- Add auto_approve_ai_suggestions field to user integrations
- Add stated_by, assigned_to, source_segment fields to AI suggestions
@jhodapp jhodapp self-assigned this Dec 24, 2025
@jhodapp jhodapp added the prototype Prototyping a major new feature. label Dec 24, 2025
@jhodapp jhodapp marked this pull request as draft December 24, 2025 18:42
@jhodapp
Copy link
Copy Markdown
Member Author

jhodapp commented Dec 24, 2025

Consolidated into #213 - AI Meeting Recording Integration

@jhodapp jhodapp closed this Dec 24, 2025
@jhodapp jhodapp deleted the feature/146-ai-meeting-integration-phase6-suggestions branch December 24, 2025 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

prototype Prototyping a major new feature.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant