|
1 | | -import { Bot, User } from 'lucide-react'; |
| 1 | +import { Bot, User, Info } from 'lucide-react'; |
2 | 2 | import { cn, formatTime, formatTokens } from '../../../lib/utils'; |
3 | 3 | import ReactMarkdown from 'react-markdown'; |
4 | 4 | import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter'; |
@@ -111,11 +111,29 @@ export function ConversationMessage({ turn }: ConversationMessageProps) { |
111 | 111 | 'text-xs mt-1 flex items-center gap-1.5 flex-wrap', |
112 | 112 | isUser ? 'opacity-70' : 'text-muted-foreground/60' |
113 | 113 | )}> |
114 | | - <span>↑ {formatTokens(turn.tokens.input_tokens ?? 0)}</span> |
| 114 | + <span className="relative group/in flex items-center gap-1 cursor-default"> |
| 115 | + <span>↑ {formatTokens(turn.tokens.input_tokens ?? 0)}</span> |
| 116 | + <span className="pointer-events-none absolute bottom-full left-0 mb-1.5 w-44 rounded-md bg-popover border border-border px-2.5 py-1.5 text-[11px] leading-snug text-popover-foreground shadow-md opacity-0 group-hover/in:opacity-100 transition-opacity z-50"> |
| 117 | + Input tokens — context sent to the model for this turn |
| 118 | + </span> |
| 119 | + </span> |
| 120 | + {isUser && (turn.tokens.input_tokens ?? 0) > 50 && ( |
| 121 | + <span className="relative group/hint"> |
| 122 | + <Info className="h-3 w-3 opacity-50 cursor-default" /> |
| 123 | + <span className="pointer-events-none absolute bottom-full right-0 mb-1.5 w-52 rounded-md bg-popover border border-border px-2.5 py-1.5 text-[11px] leading-snug text-popover-foreground shadow-md opacity-0 group-hover/hint:opacity-100 transition-opacity z-50"> |
| 124 | + Includes system prompt tokens sent with the first message of this run |
| 125 | + </span> |
| 126 | + </span> |
| 127 | + )} |
115 | 128 | {(turn.tokens.output_tokens ?? 0) > 0 && ( |
116 | 129 | <> |
117 | 130 | <span className="opacity-40">·</span> |
118 | | - <span>↓ {formatTokens(turn.tokens.output_tokens ?? 0)}</span> |
| 131 | + <span className="relative group/out flex items-center gap-1 cursor-default"> |
| 132 | + <span>↓ {formatTokens(turn.tokens.output_tokens ?? 0)}</span> |
| 133 | + <span className="pointer-events-none absolute bottom-full left-0 mb-1.5 w-44 rounded-md bg-popover border border-border px-2.5 py-1.5 text-[11px] leading-snug text-popover-foreground shadow-md opacity-0 group-hover/out:opacity-100 transition-opacity z-50"> |
| 134 | + Output tokens — text generated by the model in this turn |
| 135 | + </span> |
| 136 | + </span> |
119 | 137 | </> |
120 | 138 | )} |
121 | 139 | </div> |
|
0 commit comments