Generate AI summaries when meetings end, not only after recordings.
Deploy Ladill Meet / deploy (push) Successful in 1m1s
Deploy Ladill Meet / deploy (push) Successful in 1m1s
Queue summarization on session end (with a short delay for late captions), keep recording-ready as a refresh path, and unique the summary job so end plus recording do not double-process the same transcript.
This commit is contained in:
@@ -106,6 +106,102 @@ class MeetTranscriptServiceTest extends TestCase
|
||||
Queue::assertNothingPushed();
|
||||
}
|
||||
|
||||
public function test_ending_session_queues_ai_summary_without_recording(): void
|
||||
{
|
||||
Queue::fake();
|
||||
|
||||
$room = Room::create([
|
||||
'organization_id' => $this->organization->id,
|
||||
'owner_ref' => $this->user->public_id,
|
||||
'host_user_ref' => $this->user->public_id,
|
||||
'title' => 'No recording meeting',
|
||||
'type' => 'instant',
|
||||
'status' => 'live',
|
||||
'timezone' => 'UTC',
|
||||
'settings' => [
|
||||
'auto_ai_summary' => true,
|
||||
'live_captions' => true,
|
||||
],
|
||||
]);
|
||||
|
||||
$session = Session::create([
|
||||
'room_id' => $room->id,
|
||||
'owner_ref' => $this->user->public_id,
|
||||
'media_room_name' => 'room-'.$room->uuid,
|
||||
'status' => 'live',
|
||||
'started_at' => now()->subMinutes(15),
|
||||
]);
|
||||
|
||||
Participant::create([
|
||||
'owner_ref' => $this->user->public_id,
|
||||
'session_id' => $session->id,
|
||||
'user_ref' => $this->user->public_id,
|
||||
'role' => 'host',
|
||||
'display_name' => 'Host',
|
||||
'status' => 'joined',
|
||||
'joined_at' => now()->subMinutes(15),
|
||||
]);
|
||||
|
||||
Message::create([
|
||||
'owner_ref' => $this->user->public_id,
|
||||
'session_id' => $session->id,
|
||||
'sender_ref' => $this->user->public_id,
|
||||
'sender_name' => 'Host',
|
||||
'body' => 'We agreed to ship Friday.',
|
||||
'type' => 'public',
|
||||
]);
|
||||
|
||||
app(\App\Services\Meet\SessionService::class)->end($session, $this->user->public_id);
|
||||
|
||||
$session->refresh();
|
||||
$this->assertSame('ended', $session->status);
|
||||
$this->assertNotNull($session->ended_at);
|
||||
|
||||
$transcript = $session->transcripts()->latest()->first();
|
||||
$this->assertNotNull($transcript);
|
||||
$this->assertStringContainsString('We agreed to ship Friday.', (string) $transcript->content);
|
||||
|
||||
Queue::assertPushed(GenerateAiSummary::class, function (GenerateAiSummary $job) use ($transcript) {
|
||||
return $job->transcriptId === $transcript->id;
|
||||
});
|
||||
}
|
||||
|
||||
public function test_ending_session_skips_summary_when_auto_ai_disabled(): void
|
||||
{
|
||||
Queue::fake();
|
||||
config(['meet.ai.auto_summarize' => false]);
|
||||
|
||||
$room = Room::create([
|
||||
'organization_id' => $this->organization->id,
|
||||
'owner_ref' => $this->user->public_id,
|
||||
'host_user_ref' => $this->user->public_id,
|
||||
'title' => 'No AI meeting',
|
||||
'type' => 'instant',
|
||||
'status' => 'live',
|
||||
'timezone' => 'UTC',
|
||||
// Explicit false in settings (setting() reads room.settings first)
|
||||
'settings' => ['auto_ai_summary' => false],
|
||||
]);
|
||||
|
||||
$session = Session::create([
|
||||
'room_id' => $room->id,
|
||||
'owner_ref' => $this->user->public_id,
|
||||
'media_room_name' => 'room-'.$room->uuid,
|
||||
'status' => 'live',
|
||||
'started_at' => now()->subMinutes(5),
|
||||
]);
|
||||
|
||||
// Room::setting falls back to default_settings when key missing; with explicit false
|
||||
// AND config false, shouldAutoSummarize must be false.
|
||||
// Note: shouldAutoSummarize is (room setting || config) — explicit false || false = false.
|
||||
$this->assertFalse(app(TranscriptService::class)->shouldAutoSummarize($session));
|
||||
|
||||
app(\App\Services\Meet\SessionService::class)->end($session, $this->user->public_id);
|
||||
|
||||
Queue::assertNotPushed(GenerateAiSummary::class);
|
||||
$this->assertSame(0, $session->fresh()->transcripts()->count());
|
||||
}
|
||||
|
||||
public function test_caption_segments_collapse_progressive_duplicates(): void
|
||||
{
|
||||
Queue::fake();
|
||||
|
||||
Reference in New Issue
Block a user