Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Long recordings (1h+) can produce 50–200K characters of transcript text, which exceeds the context window of most local models (e.g. Ollama llama3.2 with 8K ctx ≈ ~10K chars for Russian). Previously the entire transcript was sent in a single LLM request with no length checking, causing silent failures or truncated summaries.
This PR implements a Map-Reduce summarization strategy:
Changes
src/lib/llm/chunking.ts(new) — core chunking logic: segment-boundary splitting, rolling-context chunk prompts, synthesis prompt,summarizeWithChunking()function with optionalonProgresscallbacksrc/lib/llm/index.ts— addedmaxInputChars?: numberfield toLlmConfigsrc/lib/config.ts— addedllmDefaultMaxInputChars = 24_000(≈ 6000 tokens, safe for small local models)src/pages/home/view-model.ts— replaced bothllm.ask()call sites (auto-summarize + re-summarize) withsummarizeWithChunking(); toast now shows live progress: "Summarizing part 2 of 4..." → "Merging summaries..."src/pages/batch/view-model.tsx— same replacement for batch modesrc/components/params.tsx— added Max Input Characters input in LLM settingslocales/en-US/common.json,locales/ru-RU/common.json— added translation keys for the new setting and progress messagesHow it works
Configuration
Default
maxInputChars = 24000. For models with 8K context window, recommended values:10000–12000for Russian,16000–18000for English.Closes #999