From 99be5e5ceefb0be8c3d89a619cd61b92d71b40dc Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Sat, 24 Jan 2026 20:32:39 -0700 Subject: [PATCH] Summarize the call recording transcript --- .../resources/classes/call_recordings.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/app/call_recordings/resources/classes/call_recordings.php b/app/call_recordings/resources/classes/call_recordings.php index 109fd698b6..785a92666d 100644 --- a/app/call_recordings/resources/classes/call_recordings.php +++ b/app/call_recordings/resources/classes/call_recordings.php @@ -217,11 +217,26 @@ class call_recordings { //define the array $array = []; + //summarize the transcript + if ($settings->get('language_model', 'enabled') && !empty($params['transcribe_message'])) { + //get the transcribed text + $transcribe_text = transcribe::conversation_format($params['transcribe_message'], 'text'); + + //prepare the prompt + $prompt = "Summarize this conversation with Key Points, Action Items if any, and Sentiment."; + $request_data['prompt'] = $prompt . "```\n".$transcribe_text."\n```"; + + //load the language model and get the + $language_model = new language_model(); + $params['transcript_summary'] = $language_model->request('ministral-3:8b', $request_data); + } + //prepare the array with the transcript details $array['xml_cdr_transcripts'][0]['xml_cdr_transcript_uuid'] = $params['xml_cdr_uuid']; $array['xml_cdr_transcripts'][0]['domain_uuid'] = $params['domain_uuid']; $array['xml_cdr_transcripts'][0]['xml_cdr_uuid'] = $params['xml_cdr_uuid']; $array['xml_cdr_transcripts'][0]['transcript_json'] = $params['transcribe_message']; + $array['xml_cdr_transcripts'][0]['transcript_summary'] = $params['transcript_summary'] ?? ''; //add temporary permissions $p = permissions::new();