swarm ui: an unset fresh-session handle does not hold the soft handle up; docs vale fixes
This commit is contained in:
parent
b16074e76b
commit
0db9868eee
1 changed files with 22 additions and 7 deletions
|
|
@ -74,10 +74,15 @@ export function clampFresh(to: number, limits: Limits): number {
|
|||
);
|
||||
}
|
||||
|
||||
/** Where the soft handle may go: not below the fresh-session handle. */
|
||||
/**
|
||||
* Where the soft handle may go: not below the fresh-session handle when the
|
||||
* swarm sets one. An unset fresh-session handle only follows the soft one down
|
||||
* (`limitsOf`), so it does not hold it up.
|
||||
*/
|
||||
export function clampSoft(to: number, limits: Limits): number {
|
||||
const floor = limits.freshSet ? limits.fresh : MIN_SOFT_CONTEXT_PERCENT;
|
||||
return Math.min(
|
||||
Math.max(Math.round(to), limits.fresh, MIN_SOFT_CONTEXT_PERCENT),
|
||||
Math.max(Math.round(to), floor, MIN_SOFT_CONTEXT_PERCENT),
|
||||
MAX_SOFT_CONTEXT_PERCENT,
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue