Recorder-style auto-titling for transcripts. Mirrors the Phase 9 content-tags pipeline so the same prompt-injection-hardened pattern, spawn_blocking discipline, and sanitisation-after-generation shape get reused; the user-facing surface (auto on save + on-demand button) lands in a follow-up commit. - crates/llm/src/prompts.rs: new TRANSCRIPT_TITLE_SYSTEM constant. Same injection guard wording as ai-formatting's CLEANUP_PROMPT — dictated speech is data, not instructions. Rules constrain output shape: 4-8 words, Title Case, no quotes, no terminal punctuation, "Untitled" fallback for empty input. - crates/llm/src/lib.rs: LlmEngine::generate_title returns Result<String, EngineError>. Mirrors extract_content_tags shape: trailing-2000-char UTF-8-boundary truncation, temperature 0, max_tokens 24, free-form output (no GBNF — titles are prose, not a closed set). Sanitisation runs server-side via the new private sanitize_title helper, which handles the real Qwen3 failure modes: surrounding curly + ASCII quotes, leading "Title:" prefix, multi-line output, trailing "." / "!" / "?", whitespace runs, 100-char cap, literal "Untitled" → None. Three unit tests cover composite real-world outputs end-to-end. kon-llm test suite goes 15 → 18 passing. The Tauri wrapper, invoke_handler registration, and frontend wiring follow in subsequent commits.
25 KiB
25 KiB