Context Usage Meter new 上下文用量条 web

175.6K

标本可交互,可以直接操作。

Anatomy — every part, named解剖 —— 每个部件的名字

  1. 1 Total and limit总量与上限 count-up

    The big number, the limit and a percentage that warns above 80%.

    大数字、上限,以及超过 80% 时提醒的百分比。

    Prompt fragmentPrompt 片段

    a big total with the limit and a percentage turning orange above 80%

    大数字加上限,百分比超过 80% 变橙色

  2. 2 Source segments来源色段 flex widths

    One coloured segment per source, sized against the limit.

    每个来源一段颜色,按上限计算宽度。

    Prompt fragmentPrompt 片段

    segments for chat, files, tools, system and memory sized against the limit

    对话、文件、工具、系统、记忆各一段,按上限计算宽度

  3. 3 Hover focus悬停聚焦 opacity

    The hovered source stays bright, the rest fade, the number shows its size.

    悬停的来源保持高亮,其余变淡,数字显示它的大小。

    Prompt fragmentPrompt 片段

    hovered segment bright, others faded, number showing that segment

    悬停的一段高亮、其它变淡,数字显示这一段

  4. 4 Compact压缩 width transition

    Sources shrink to their summarised size together.

    各个来源一起缩到总结后的大小。

    Prompt fragmentPrompt 片段

    compact shrinking each source to its summary size with the total counting down

    压缩时每个来源缩到总结后的大小,总数递减

Prompt — paste into your agentPrompt —— 直接粘贴给你的代理

Build a context usage meter card: title "Context", a "Compact" button, a big number (175.6K) with "of 200K" and a percentage that turns orange above 80%. Below, a 24px segmented bar whose segments are sized by share of the 200K limit: Chat 108.6K teal, Files 46.1K blue, Tools 12.4K purple, System 5.3K pink, Memory 3.2K green, the remainder empty. Legend chips with colour squares underneath. Hovering or focusing a segment or chip fades the others to 22% opacity and the big number counts to that segment's value with its name. Compact animates every segment to its summarised size (System and Memory stay), counting the total down; disable the button while it runs.

做一个上下文用量卡片:标题「上下文」,一个「压缩」按钮,一个大数字(175.6K)加「/ 200K」,以及超过 80% 变橙色的百分比。下面是 24px 高的分段色条,每段宽度按占 200K 上限的比例:对话 108.6K 青绿、文件 46.1K 蓝、工具 12.4K 紫、系统 5.3K 粉、记忆 3.2K 绿,剩余部分留空。下方是带色块的图例标签。悬停或聚焦某一段或某个标签时,其它段淡到 22% 透明度,大数字数到这一段的数值并显示它的名称。点「压缩」时每段以动画缩到总结后的大小(系统和记忆不变),总数随之递减;进行中禁用按钮。

Debug prompt — when it misbehaves调试 Prompt —— 当它不听话时

Debug my context meter. Check that segment widths are a share of the limit, not of the current total (otherwise the bar always looks full); the gaps between segments do not push the bar past 100%; hover state is cleared on pointerleave and on blur; the number animation cancels its previous frame before starting a new one; the percentage colour threshold uses the total, not the hovered segment; Compact cannot be triggered twice; and the bar has a text equivalent for screen readers. The symptom:

调试我的上下文用量条。检查:每段宽度是否按占上限的比例(而不是占当前总量的比例,否则色条永远是满的);段与段之间的间隙会不会把色条撑出 100%;离开和失焦时是否清除悬停状态;数字动画开始前是否取消了上一次的动画帧;百分比变色的阈值是否用总量而不是悬停那一段;「压缩」能否被连点两次;色条是否有给读屏软件的文字说明。症状是:

In code代码里叫什么

Framework框架Symbol符号Note说明
CSS display: flex + width: calc(var(--w) * 1%) each source is a segment sized by its share of the limit每个来源一段,宽度按占上限的比例
CSS transition: width segments animate when usage changes or after compaction用量变化或压缩后,各段宽度带动画
JS requestAnimationFrame count-up the big number counts toward its new value大数字逐帧数到新值
ARIA role="img" + aria-label give the bar a text total; legend chips are focusable buttons给色条一个文字总数;图例做成可聚焦的按钮

See also相关词条

我的参考集

组合知名网站、UI 元素、视觉风格和平面设计案例,导出给 AI。

你的下一份设计,从这里开始。

在任意案例旁点击「加入参考」,就能把品牌、组件、风格和平面设计案例组合成一份 AI 设计说明。

搜索参考库Search the library

输入关键词,搜索所有参考。