mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-07-01 20:01:35 +00:00
|
Some checks are pending
Docker Dev Branch Images Build / build (Dockerfile, lc-dev, node) (push) Waiting to run
Docker Dev Branch Images Build / build (Dockerfile.multi, lc-dev-api, api-build) (push) Waiting to run
GitNexus Index / index (push) Waiting to run
GitNexus Index / post-index (push) Blocked by required conditions
* ✨ feat: Mirror send-path pruning in the over-window context estimate For a snapshot-less branch whose tokens exceed the window, the send path prunes oldest-first (getMessagesWithinTokenLimit), so the next call can sit well under the window. The gauge previously clamped the full sum to 100%, hiding that headroom. Add prunedBranchTokens — a newest->oldest walk that keeps messages until the next would overflow the message budget (max minus the summary baseline), mirroring the pruner — and use it on the estimate path in place of the clamp. Approximation: omits the instruction/tool overhead and tool-call pairing the real pruner accounts for (unknowable for a snapshot-less branch); superseded by an exact snapshot once the branch is generated. * ✨ feat: Reserve cached instruction/tool overhead in the snapshot-less estimate The over-window prune mirror and the gauge couldn't account for the fixed instruction + tool-schema overhead the next call always sends, because a snapshot-less branch has no breakdown. The backend already emits that overhead in the ON_CONTEXT_USAGE breakdown, so cache it per agent/model (keyed endpoint::model::agentId, already inclusive of tool schemas) from the live usage events, then reserve it from the prune budget and add it to used so the estimate is consistent with snapshots. Falls back to message-only until the agent has run once this session. Surfaced as a System row in the estimate breakdown. * 🩹 fix: Address Codex review on the over-window estimate - Key the overhead cache by agentId when present. useTokenLimits resolves an agent to its real provider/model, so the reader keyed `provider::model::agent` while the writer stored `agents::::agent` — a cache miss for the main agents case. Both sides now resolve to `agent:<id>` (non-agent configs: endpoint:model). - Skip the overhead reserve when a summary baseline exists: computeSummaryUsedTokens already folds instruction/tool overhead into that marker, so adding it again double-counted on summarized branches. - Collapse the breakdown's input/output/estimated rows into one pruned Messages row when over-window pruning ran, so the popover matches the gauge instead of summing to the discarded pre-prune history. |
||
|---|---|---|
| .. | ||
| public | ||
| scripts | ||
| src | ||
| sw | ||
| test | ||
| babel.config.cjs | ||
| check_updates.sh | ||
| index.html | ||
| jest.config.cjs | ||
| jest.resolver.cjs | ||
| nginx.conf | ||
| package.json | ||
| postcss.config.cjs | ||
| tailwind.config.cjs | ||
| tsconfig.json | ||
| vite.config.ts | ||