Skip to content
Source
Sign inSign up
pingdotgg/t3code

feat(web): effort indicator shows the selected reasoning level #25431

ClosedDominikScholz(GitHub profile, opens in a new tab)wants to merge 3 commits intomain fromrefs/pull/25431/headopened View on GitHub

Showing 4 changed files with 71 additions and 0 deletions (loading 3).

x
0 of 4 viewed, 4 left
71 additions and 0 deletionsapps/web/src/components/chat/EffortGaugeIcon.tsxAdded
View file
@@ -0,0 +1,71 @@
+import { cn } from "~/lib/utils";
+import type { ComposerControlSize } from "./ComposerControl";
+​
+// Lucide's gauge: a 240° arc around (12, 14). The needle sweeps most of it, stopping short
+// of the arc ends so the lowest and highest levels stay distinguishable from the frame.
+const NEEDLE_SWEEP_DEGREES = 200;
+const UNKNOWN_LEVEL_DEGREES = 45;
+// Speed lines sit left of the gauge, so a fast icon is 30 units wide instead of 24.
+const SPEED_OFFSET = 6;
+​
+export type EffortGaugeSpeed = "fast" | "ultrafast";
+​
+export function EffortGaugeIcon({
+ level,
+ speed = null,
+ ultracode = false,
+ size = "sm",
+}: {
+ /** Position within the model's effort range, 0 to 1. */
+ level: number | null;
+ speed?: EffortGaugeSpeed | null;
+ ultracode?: boolean;
+ size?: ComposerControlSize;
+}) {
+ const degrees = level === null ? UNKNOWN_LEVEL_DEGREES : (level - 0.5) * NEEDLE_SWEEP_DEGREES;
+ return (
+ <svg
+ aria-hidden="true"
+ xmlns="http://www.w3.org/2000/svg"
+ viewBox={speed ? `0 0 ${24 + SPEED_OFFSET} 24` : "0 0 24 24"}