Skip to content

Commit 30f792d

Browse files
committed
fix: display current LLM model in task header UI
- Added model display in both collapsed and expanded task header views - Shows model name next to token count in collapsed view - Added dedicated Model row in expanded task details table - Added localization support for "Model" label in chat.json Fixes #7438
1 parent 11c454f commit 30f792d

File tree

2 files changed

+66
-43
lines changed

2 files changed

+66
-43
lines changed

webview-ui/src/components/chat/TaskHeader.tsx

Lines changed: 65 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -120,51 +120,61 @@ const TaskHeader = ({
120120
</div>
121121
</div>
122122
</div>
123-
{!isTaskExpanded && contextWindow > 0 && (
123+
{!isTaskExpanded && (
124124
<div className="flex items-center gap-2 text-sm" onClick={(e) => e.stopPropagation()}>
125-
<StandardTooltip
126-
content={
127-
<div className="space-y-1">
128-
<div>
129-
{t("chat:tokenProgress.tokensUsed", {
130-
used: formatLargeNumber(contextTokens || 0),
131-
total: formatLargeNumber(contextWindow),
132-
})}
133-
</div>
134-
{(() => {
135-
const maxTokens = model
136-
? getModelMaxOutputTokens({ modelId, model, settings: apiConfiguration })
137-
: 0
138-
const reservedForOutput = maxTokens || 0
139-
const availableSpace = contextWindow - (contextTokens || 0) - reservedForOutput
125+
{/* Model display */}
126+
{modelId && <span className="text-vscode-descriptionForeground opacity-80">{modelId}</span>}
127+
{/* Token progress */}
128+
{contextWindow > 0 && (
129+
<StandardTooltip
130+
content={
131+
<div className="space-y-1">
132+
<div>
133+
{t("chat:tokenProgress.tokensUsed", {
134+
used: formatLargeNumber(contextTokens || 0),
135+
total: formatLargeNumber(contextWindow),
136+
})}
137+
</div>
138+
{(() => {
139+
const maxTokens = model
140+
? getModelMaxOutputTokens({
141+
modelId,
142+
model,
143+
settings: apiConfiguration,
144+
})
145+
: 0
146+
const reservedForOutput = maxTokens || 0
147+
const availableSpace =
148+
contextWindow - (contextTokens || 0) - reservedForOutput
140149

141-
return (
142-
<>
143-
{reservedForOutput > 0 && (
144-
<div>
145-
{t("chat:tokenProgress.reservedForResponse", {
146-
amount: formatLargeNumber(reservedForOutput),
147-
})}
148-
</div>
149-
)}
150-
{availableSpace > 0 && (
151-
<div>
152-
{t("chat:tokenProgress.availableSpace", {
153-
amount: formatLargeNumber(availableSpace),
154-
})}
155-
</div>
156-
)}
157-
</>
158-
)
159-
})()}
160-
</div>
161-
}
162-
side="top"
163-
sideOffset={8}>
164-
<span className="mr-1">
165-
{formatLargeNumber(contextTokens || 0)} / {formatLargeNumber(contextWindow)}
166-
</span>
167-
</StandardTooltip>
150+
return (
151+
<>
152+
{reservedForOutput > 0 && (
153+
<div>
154+
{t("chat:tokenProgress.reservedForResponse", {
155+
amount: formatLargeNumber(reservedForOutput),
156+
})}
157+
</div>
158+
)}
159+
{availableSpace > 0 && (
160+
<div>
161+
{t("chat:tokenProgress.availableSpace", {
162+
amount: formatLargeNumber(availableSpace),
163+
})}
164+
</div>
165+
)}
166+
</>
167+
)
168+
})()}
169+
</div>
170+
}
171+
side="top"
172+
sideOffset={8}>
173+
<span className="mr-1">
174+
{formatLargeNumber(contextTokens || 0)} / {formatLargeNumber(contextWindow)}
175+
</span>
176+
</StandardTooltip>
177+
)}
168178
{!!totalCost && <span>${totalCost.toFixed(2)}</span>}
169179
</div>
170180
)}
@@ -190,6 +200,18 @@ const TaskHeader = ({
190200
<div className="border-t border-b border-vscode-panel-border/50 py-4 mt-2 mb-1">
191201
<table className="w-full">
192202
<tbody>
203+
{/* Model row */}
204+
{modelId && (
205+
<tr>
206+
<th className="font-bold text-left align-top w-1 whitespace-nowrap pl-1 pr-3 h-[24px]">
207+
{t("chat:task.model")}
208+
</th>
209+
<td className="align-top">
210+
<span>{modelId}</span>
211+
</td>
212+
</tr>
213+
)}
214+
193215
{contextWindow > 0 && (
194216
<tr>
195217
<th

webview-ui/src/i18n/locales/en/chat.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"collapse": "Collapse task",
77
"seeMore": "See more",
88
"seeLess": "See less",
9+
"model": "Model",
910
"tokens": "Tokens",
1011
"cache": "Cache",
1112
"apiCost": "API Cost",

0 commit comments

Comments
 (0)