Skip to content

Commit e23d207

Browse files
committed
chore(web): trim comments and lower context-gauge color thresholds
Also drop the gauge's yellow/red thresholds from 70/90 to 50/80 so the ring shifts color earlier as the context fills.
1 parent 76c2d93 commit e23d207

2 files changed

Lines changed: 5 additions & 17 deletions

File tree

packages/web/src/ee/features/chat/components/chatThread/detailsCard.tsx

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -397,10 +397,8 @@ const StepTokenUsage = ({ usage, label = 'step' }: { usage: StepTokenUsageEntry,
397397
}
398398

399399

400-
// Usage thresholds for the context-window gauge. Below `YELLOW` the window has
401-
// plenty of headroom (green); past `RED` it's nearly full (red).
402-
const CONTEXT_USAGE_YELLOW_PERCENT = 70;
403-
const CONTEXT_USAGE_RED_PERCENT = 90;
400+
const CONTEXT_USAGE_YELLOW_PERCENT = 50;
401+
const CONTEXT_USAGE_RED_PERCENT = 80;
404402

405403
const getContextUsageColorClass = (percent: number): string => {
406404
if (percent >= CONTEXT_USAGE_RED_PERCENT) {
@@ -409,7 +407,6 @@ const getContextUsageColorClass = (percent: number): string => {
409407
if (percent >= CONTEXT_USAGE_YELLOW_PERCENT) {
410408
return "text-yellow-500";
411409
}
412-
// Desaturated sage green rather than the neon green-500.
413410
return "text-[#6cb38f]";
414411
};
415412

@@ -424,9 +421,7 @@ const ContextWindowGauge = ({ total, percent }: { total: number, percent: number
424421
return (
425422
<div className="flex items-center gap-1.5 text-xs whitespace-nowrap">
426423
<svg width={size} height={size} className="-rotate-90 flex-shrink-0">
427-
{/* Neutral gray track. (Theme tokens here are defined without an
428-
alpha channel, so an /opacity modifier on them is silently
429-
ignored — use a solid palette gray instead.) */}
424+
{/* Neutral gray track. */}
430425
<circle
431426
cx={size / 2}
432427
cy={size / 2}

packages/web/src/features/chat/modelContextWindow.server.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ const loadCatalog = async (): Promise<ModelsDevCatalog | null> => {
7676
* Pure lookup of a model's context window in a models.dev catalog. Separated
7777
* from the network fetch so it can be unit-tested directly.
7878
*
79-
* Returns the total context window (input + output share it) in tokens, or
80-
* `undefined` when the model isn't catalogued or has no usable window.
79+
* Returns the total context window in tokens, or `undefined` when the model
80+
* isn't catalogued or has no usable window.
8181
*/
8282
export const lookupContextWindow = (
8383
catalog: ModelsDevCatalog | null,
@@ -94,13 +94,6 @@ export const lookupContextWindow = (
9494
return typeof context === 'number' && context > 0 ? context : undefined;
9595
};
9696

97-
/**
98-
* Resolves the context window (in tokens) for a configured language model from
99-
* the models.dev catalog. Returns `undefined` when unknown — e.g. arbitrary
100-
* openai-compatible / self-hosted ids, provider/model ids that don't match the
101-
* catalog's keys (bedrock ARNs, vertex `@`-suffixed ids, azure deployments), or
102-
* when models.dev is unreachable. Never throws into the request path.
103-
*/
10497
export const resolveContextWindow = async (
10598
config: Pick<LanguageModel, 'provider' | 'model'>,
10699
): Promise<number | undefined> => {

0 commit comments

Comments
 (0)