feat(ai-formatting): wire dictionary_terms through PostProcessOptions to LLM prompt suffix

This commit is contained in:
2026-04-18 09:25:28 +01:00
parent 1e30bb77d4
commit 8c1bec98ca
3 changed files with 56 additions and 0 deletions

View File

@@ -50,6 +50,13 @@ pub async fn transcribe_pcm(
.await
.map_err(|e| e.to_string())??;
let dictionary_terms: Vec<String> = kon_storage::database::list_dictionary(&state.db)
.await
.unwrap_or_default()
.into_iter()
.map(|e| e.term)
.collect();
let mut segments: Vec<Segment> = timed.transcript.segments().to_vec();
post_process_segments(
&mut segments,
@@ -58,6 +65,7 @@ pub async fn transcribe_pcm(
british_english,
anti_hallucination,
format_mode: FormatMode::parse(&format_mode),
dictionary_terms,
},
);
@@ -114,6 +122,13 @@ pub async fn transcribe_file(
.await
.map_err(|e| e.to_string())??;
let dictionary_terms: Vec<String> = kon_storage::database::list_dictionary(&state.db)
.await
.unwrap_or_default()
.into_iter()
.map(|e| e.term)
.collect();
let mut segments: Vec<Segment> = timed.transcript.segments().to_vec();
post_process_segments(
&mut segments,
@@ -122,6 +137,7 @@ pub async fn transcribe_file(
british_english,
anti_hallucination,
format_mode: FormatMode::parse(&format_mode),
dictionary_terms,
},
);
@@ -157,6 +173,13 @@ pub async fn transcribe_pcm_parakeet(
.await
.map_err(|e| e.to_string())??;
let dictionary_terms: Vec<String> = kon_storage::database::list_dictionary(&state.db)
.await
.unwrap_or_default()
.into_iter()
.map(|e| e.term)
.collect();
let mut segments: Vec<Segment> = timed.transcript.segments().to_vec();
post_process_segments(
&mut segments,
@@ -165,6 +188,7 @@ pub async fn transcribe_pcm_parakeet(
british_english,
anti_hallucination,
format_mode: FormatMode::parse(&format_mode),
dictionary_terms,
},
);