From 30a60c655d29262c63225bee61a63a0744ff453f Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Wed, 28 Jan 2026 12:39:18 -0700 Subject: [PATCH] Add settings: summary_model_prompt, summary_model_name - Use these new settings to allow a custom AI prompt and language model. --- app/call_recordings/app_config.php | 16 ++++++++++++++++ .../resources/classes/call_recordings.php | 14 ++++++++++---- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/app/call_recordings/app_config.php b/app/call_recordings/app_config.php index e05223ed64..3d6241adf9 100644 --- a/app/call_recordings/app_config.php +++ b/app/call_recordings/app_config.php @@ -85,3 +85,19 @@ $apps[$x]['default_settings'][$y]['default_setting_value'] = "transcription"; $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "false"; $apps[$x]['default_settings'][$y]['default_setting_description'] = "Call recordings used to select the email template."; + $y++; + $apps[$x]['default_settings'][$y]['default_setting_uuid'] = "7c188b97-7a51-4358-844b-124dc960a4c5"; + $apps[$x]['default_settings'][$y]['default_setting_category'] = "call_recordings"; + $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "summary_model_prompt"; + $apps[$x]['default_settings'][$y]['default_setting_name'] = "text"; + $apps[$x]['default_settings'][$y]['default_setting_value'] = "Summarize this conversation with Key Points, Action Items if any, and Sentiment. Use names when they are provided. Return text without markdown."; + $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "false"; + $apps[$x]['default_settings'][$y]['default_setting_description'] = "The language model prompt to generate the call summary."; + $y++; + $apps[$x]['default_settings'][$y]['default_setting_uuid'] = "bf1c4aec-ef13-4a6d-aa00-204ab0dbb751"; + $apps[$x]['default_settings'][$y]['default_setting_category'] = "call_recordings"; + $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "summary_model_name"; + $apps[$x]['default_settings'][$y]['default_setting_name'] = "text"; + $apps[$x]['default_settings'][$y]['default_setting_value'] = "ministral-3:8b"; + $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "false"; + $apps[$x]['default_settings'][$y]['default_setting_description'] = "The language model name used to generate the call summary."; diff --git a/app/call_recordings/resources/classes/call_recordings.php b/app/call_recordings/resources/classes/call_recordings.php index 1a2685a3ab..e7e5cd8ef8 100644 --- a/app/call_recordings/resources/classes/call_recordings.php +++ b/app/call_recordings/resources/classes/call_recordings.php @@ -222,13 +222,19 @@ class call_recordings { //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. Don't include swearing in the summary. Return text without markdown."; + //get the summary language model prompt + $default_prompt = "Summarize this conversation with Key Points, Action Items if any, and Sentiment. Use names when they are provided. Keep the summary professional. Return text without markdown."; + $prompt = $this->settings->get('call_recordings', 'summary_model_prompt', $default_prompt); + + //combine the prompt with the call transcript $request_data['prompt'] = $prompt . "```\n".$transcribe_text."\n```"; - //load the language model and get the + //get the summary language model name + $request_model = $this->settings->get('call_recordings', 'summary_model_name', 'ministral-3:8b'); + + //load the language model and get the call summary $language_model = new language_model(); - $params['transcript_summary'] = $language_model->request('ministral-3:8b', $request_data); + $params['transcript_summary'] = $language_model->request($request_model, $request_data); } //prepare the array with the transcript details