mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
fix: include reserved output tokens in task header percentage calculation (#11034)
Co-authored-by: Roo Code <roomote@roocode.com>
This commit is contained in:
parent
c6d0306550
commit
a44842f16f
1 changed files with 18 additions and 18 deletions
|
|
@ -104,6 +104,20 @@ const TaskHeader = ({
|
|||
const textRef = useRef<HTMLDivElement>(null)
|
||||
const contextWindow = model?.contextWindow || 1
|
||||
|
||||
// Calculate maxTokens (reserved for output) once for reuse in percentage and tooltip
|
||||
const maxTokens = useMemo(
|
||||
() =>
|
||||
model
|
||||
? getModelMaxOutputTokens({
|
||||
modelId,
|
||||
model,
|
||||
settings: apiConfiguration,
|
||||
})
|
||||
: 0,
|
||||
[model, modelId, apiConfiguration],
|
||||
)
|
||||
const reservedForOutput = maxTokens || 0
|
||||
|
||||
// Detect if this task had any browser session activity so we can show a grey globe when inactive
|
||||
const browserSessionStartIndex = useMemo(() => {
|
||||
const msgs = clineMessages || []
|
||||
|
|
@ -226,14 +240,6 @@ const TaskHeader = ({
|
|||
<div className="flex items-center gap-2">
|
||||
<StandardTooltip
|
||||
content={(() => {
|
||||
const maxTokens = model
|
||||
? getModelMaxOutputTokens({
|
||||
modelId,
|
||||
model,
|
||||
settings: apiConfiguration,
|
||||
})
|
||||
: 0
|
||||
const reservedForOutput = maxTokens || 0
|
||||
const availableSpace = contextWindow - (contextTokens || 0) - reservedForOutput
|
||||
|
||||
return (
|
||||
|
|
@ -276,7 +282,9 @@ const TaskHeader = ({
|
|||
sideOffset={8}>
|
||||
<span className="flex items-center gap-1.5">
|
||||
{(() => {
|
||||
const percentage = Math.round(((contextTokens || 0) / contextWindow) * 100)
|
||||
const percentage = Math.round(
|
||||
(((contextTokens || 0) + reservedForOutput) / contextWindow) * 100,
|
||||
)
|
||||
return (
|
||||
<>
|
||||
<CircularProgress percentage={percentage} />
|
||||
|
|
@ -397,15 +405,7 @@ const TaskHeader = ({
|
|||
<ContextWindowProgress
|
||||
contextWindow={contextWindow}
|
||||
contextTokens={contextTokens || 0}
|
||||
maxTokens={
|
||||
model
|
||||
? getModelMaxOutputTokens({
|
||||
modelId,
|
||||
model,
|
||||
settings: apiConfiguration,
|
||||
})
|
||||
: undefined
|
||||
}
|
||||
maxTokens={maxTokens || undefined}
|
||||
/>
|
||||
{condenseButton}
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue