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

@@ -166,11 +166,20 @@ pub async fn start_live_transcription_session(
let worker_status = status_channel.clone();
let worker_results = result_channel.clone();
let dictionary_terms: Vec<String> =
kon_storage::database::list_dictionary(&state.db)
.await
.unwrap_or_default()
.into_iter()
.map(|e| e.term)
.collect();
let handle = tokio::task::spawn_blocking(move || {
run_live_session(
session_id,
engine,
config,
dictionary_terms,
worker_results,
worker_status,
worker_stop,
@@ -250,6 +259,7 @@ fn run_live_session(
session_id: u64,
engine: Arc<LocalEngine>,
config: StartLiveTranscriptionConfig,
dictionary_terms: Vec<String>,
result_channel: Channel<LiveResultMessage>,
status_channel: Channel<LiveStatusMessage>,
stop_flag: Arc<AtomicBool>,
@@ -284,6 +294,7 @@ fn run_live_session(
&mut inflight,
session_id,
&config,
&dictionary_terms,
&result_channel,
&status_channel,
)? {}
@@ -386,6 +397,7 @@ fn run_live_session(
&mut inflight,
session_id,
&config,
&dictionary_terms,
&result_channel,
&status_channel,
)?;
@@ -512,6 +524,7 @@ fn poll_inference(
inflight: &mut Option<InferenceTask>,
session_id: u64,
config: &StartLiveTranscriptionConfig,
dictionary_terms: &[String],
result_channel: &Channel<LiveResultMessage>,
status_channel: &Channel<LiveStatusMessage>,
) -> Result<Option<bool>, String> {
@@ -531,6 +544,7 @@ fn poll_inference(
british_english: config.british_english,
anti_hallucination: config.anti_hallucination,
format_mode: FormatMode::parse(&config.format_mode),
dictionary_terms: dictionary_terms.to_vec(),
},
);
let segment_count = segments.len();