feat: create title for each meeting

This commit is contained in:
2026-01-29 14:07:26 -08:00
parent 9bf92d3365
commit 9efda8ded6
5 changed files with 50 additions and 9 deletions
+21 -2
View File
@@ -470,13 +470,26 @@ async fn get_remaining_audio(
}
}
/// Extract title from the summary text.
fn extract_title_from_summary(summary: &str) -> Option<String> {
// Look for **Title:** pattern and extract the line
if let Some(title_start) = summary.find("**Title:**") {
let title_line_start = title_start + "**Title:**".len();
if let Some(title_end) = summary[title_line_start..].find("\n") {
let title = summary[title_line_start..title_line_start + title_end].trim();
return Some(title.to_string());
}
}
None
}
/// Generate a summary from a transcript.
#[tauri::command]
async fn summarize(
state: State<'_, AppState>,
app_handle: tauri::AppHandle,
transcript: String,
) -> Result<String, String> {
) -> Result<(String, Option<String>), String> {
let logs = Arc::clone(&state.logs);
emit_log(&app_handle, &logs, "[Summary] Generating summary...");
@@ -498,7 +511,13 @@ async fn summarize(
emit_log(&app_handle, &logs, &format!("[Summary] Generated {} character summary", summary.len()));
Ok(summary)
// Extract title from the summary
let title = extract_title_from_summary(&summary);
if let Some(ref t) = title {
emit_log(&app_handle, &logs, &format!("[Summary] Extracted title: {}", t));
}
Ok((summary, title))
}
/// Get backend logs.
+1
View File
@@ -88,6 +88,7 @@ impl LlamaSummarizer {
"<|begin_of_text|><|start_header_id|>system<|end_header_id|>\n\n\
You are a helpful assistant that creates structured meeting summaries. \
Format your response using the following template:\n\n\
**Title:** A concise, descriptive title for the meeting (5-10 words max).\n\n\
**Summary:** A high level overview of the meeting.\n\n\
**Key decisions:** Any important resolutions that the meeting reached.\n\n\
**Action Items:**\n\
+2
View File
@@ -33,6 +33,7 @@ pub struct StoredRecording {
pub duration: f64,
pub transcript_segments: Vec<StoredTranscriptSegment>,
pub summary: Option<String>,
pub title: Option<String>,
}
/// Storage manager for recordings.
@@ -160,6 +161,7 @@ mod tests {
},
],
summary: Some("Test summary".to_string()),
title: Some("Test Meeting".to_string()),
};
// Save it