Skip to content

Commit d413d22

Browse files
committed
fix(ui): swap Q and K labels in QKTracing components for consistency
1 parent 3a82a3d commit d413d22

2 files changed

Lines changed: 36 additions & 36 deletions

File tree

ui-ssr/src/components/circuits/node-connections.tsx

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,12 @@ const QKTracingSection = memo(
122122
<div className="flex gap-3 min-h-0">
123123
<div className="flex flex-col w-1/2 gap-1.5 min-h-0">
124124
<div className="font-semibold tracking-tight flex items-center text-sm text-slate-700 gap-1 cursor-default shrink-0">
125-
<span>Q MARGINAL</span>
125+
<span>K MARGINAL</span>
126126
</div>
127127
<div className="flex flex-col gap-1 overflow-y-auto no-scrollbar max-h-40">
128-
{results.topQMarginalContributors.map(([nodeId, score], idx) => (
128+
{results.topKMarginalContributors.map(([nodeId, score], idx) => (
129129
<div
130-
key={`q-${nodeId}-${idx}`}
130+
key={`k-${nodeId}-${idx}`}
131131
className={cn(
132132
'py-2 px-2 mx-1 border rounded cursor-pointer transition-colors bg-gray-50 border-gray-200 flex justify-between items-center',
133133
nodeId === hoveredId && 'ring-2 ring-blue-300',
@@ -149,12 +149,12 @@ const QKTracingSection = memo(
149149

150150
<div className="flex flex-col w-1/2 gap-1.5 min-h-0">
151151
<div className="font-semibold tracking-tight flex items-center text-sm text-slate-700 gap-1 cursor-default shrink-0">
152-
<span>K MARGINAL</span>
152+
<span>Q MARGINAL</span>
153153
</div>
154154
<div className="flex flex-col gap-1 overflow-y-auto no-scrollbar max-h-40">
155-
{results.topKMarginalContributors.map(([nodeId, score], idx) => (
155+
{results.topQMarginalContributors.map(([nodeId, score], idx) => (
156156
<div
157-
key={`k-${nodeId}-${idx}`}
157+
key={`q-${nodeId}-${idx}`}
158158
className={cn(
159159
'py-2 px-2 mx-1 border rounded cursor-pointer transition-colors bg-gray-50 border-gray-200 flex justify-between items-center',
160160
nodeId === hoveredId && 'ring-2 ring-blue-300',
@@ -189,18 +189,18 @@ const QKTracingSection = memo(
189189
<div
190190
className={cn(
191191
'flex-1 min-w-0 cursor-pointer px-2 py-1.5 transition-colors flex items-center gap-1.5',
192-
qId === hoveredId ? 'bg-black/5' : 'hover:bg-black/5',
193-
qId === clickedId &&
192+
kId === hoveredId ? 'bg-black/5' : 'hover:bg-black/5',
193+
kId === clickedId &&
194194
'bg-blue-100/50 shadow-[inset_0_0_0_1px_#3b82f6]',
195195
)}
196-
onClick={(e) => onNodeClick(qId, e.metaKey || e.ctrlKey)}
197-
onMouseEnter={() => onNodeHover(qId)}
196+
onClick={(e) => onNodeClick(kId, e.metaKey || e.ctrlKey)}
197+
onMouseEnter={() => onNodeHover(kId)}
198198
onMouseLeave={() => onNodeHover(null)}
199199
>
200200
<span className="text-xs font-bold text-slate-400 shrink-0">
201-
Q:
201+
K:
202202
</span>
203-
{renderNodeLabel(qId)}
203+
{renderNodeLabel(kId)}
204204
</div>
205205

206206
<div className="flex items-center justify-center shrink-0">
@@ -210,18 +210,18 @@ const QKTracingSection = memo(
210210
<div
211211
className={cn(
212212
'flex-1 min-w-0 cursor-pointer px-2 py-1.5 transition-colors flex items-center gap-1.5',
213-
kId === hoveredId ? 'bg-black/5' : 'hover:bg-black/5',
214-
kId === clickedId &&
213+
qId === hoveredId ? 'bg-black/5' : 'hover:bg-black/5',
214+
qId === clickedId &&
215215
'bg-blue-100/50 shadow-[inset_0_0_0_1px_#3b82f6]',
216216
)}
217-
onClick={(e) => onNodeClick(kId, e.metaKey || e.ctrlKey)}
218-
onMouseEnter={() => onNodeHover(kId)}
217+
onClick={(e) => onNodeClick(qId, e.metaKey || e.ctrlKey)}
218+
onMouseEnter={() => onNodeHover(qId)}
219219
onMouseLeave={() => onNodeHover(null)}
220220
>
221221
<span className="text-xs font-bold text-slate-400 shrink-0">
222-
K:
222+
Q:
223223
</span>
224-
{renderNodeLabel(kId)}
224+
{renderNodeLabel(qId)}
225225
</div>
226226

227227
<div className="text-right flex flex-col justify-center items-end px-2 shrink-0 border-l border-black/5 bg-white/30">

ui-ssr/src/routes/embed.circuit.$id.qk.$nodeId.tsx

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -262,16 +262,16 @@ function QKTracingContent({
262262
}: QKTracingContentProps) {
263263
return (
264264
<div className="flex flex-col gap-6">
265-
{/* Q and K Marginal Contributors */}
265+
{/* K and Q Marginal Contributors */}
266266
<div className="flex gap-4 min-h-0">
267267
<div className="flex flex-col w-1/2 gap-2 min-h-0">
268268
<div className="font-semibold tracking-tight flex items-center text-sm text-slate-700 gap-1 cursor-default shrink-0">
269-
<span>Q MARGINAL</span>
269+
<span>K MARGINAL</span>
270270
</div>
271271
<div className="flex flex-col gap-1.5 overflow-y-auto no-scrollbar max-h-64">
272-
{results.topQMarginalContributors.map(([nodeId, score], idx) => (
272+
{results.topKMarginalContributors.map(([nodeId, score], idx) => (
273273
<div
274-
key={`q-${nodeId}-${idx}`}
274+
key={`k-${nodeId}-${idx}`}
275275
className={cn(
276276
'py-2 px-3 border rounded cursor-pointer transition-colors bg-gray-50 border-gray-200 flex justify-between items-center',
277277
nodeId === hoveredId && 'ring-2 ring-blue-300',
@@ -292,12 +292,12 @@ function QKTracingContent({
292292

293293
<div className="flex flex-col w-1/2 gap-2 min-h-0">
294294
<div className="font-semibold tracking-tight flex items-center text-sm text-slate-700 gap-1 cursor-default shrink-0">
295-
<span>K MARGINAL</span>
295+
<span>Q MARGINAL</span>
296296
</div>
297297
<div className="flex flex-col gap-1.5 overflow-y-auto no-scrollbar max-h-64">
298-
{results.topKMarginalContributors.map(([nodeId, score], idx) => (
298+
{results.topQMarginalContributors.map(([nodeId, score], idx) => (
299299
<div
300-
key={`k-${nodeId}-${idx}`}
300+
key={`q-${nodeId}-${idx}`}
301301
className={cn(
302302
'py-2 px-3 border rounded cursor-pointer transition-colors bg-gray-50 border-gray-200 flex justify-between items-center',
303303
nodeId === hoveredId && 'ring-2 ring-blue-300',
@@ -332,18 +332,17 @@ function QKTracingContent({
332332
<div
333333
className={cn(
334334
'flex-1 min-w-0 cursor-pointer px-3 py-2 transition-colors flex items-center gap-2',
335-
qId === hoveredId ? 'bg-black/5' : 'hover:bg-black/5',
336-
qId === clickedId &&
335+
kId === hoveredId ? 'bg-black/5' : 'hover:bg-black/5',
336+
kId === clickedId &&
337337
'bg-blue-100/50 shadow-[inset_0_0_0_1px_#3b82f6]',
338338
)}
339-
onClick={(e) => onNodeClick(qId, e.metaKey || e.ctrlKey)}
340-
onMouseEnter={() => onNodeHover(qId)}
339+
onMouseEnter={() => onNodeHover(kId)}
341340
onMouseLeave={() => onNodeHover(null)}
342341
>
343342
<span className="text-xs font-bold text-slate-400 shrink-0">
344-
Q:
343+
K:
345344
</span>
346-
{renderNodeLabel(qId)}
345+
{renderNodeLabel(kId)}
347346
</div>
348347

349348
<div className="flex items-center justify-center shrink-0 px-2">
@@ -353,17 +352,18 @@ function QKTracingContent({
353352
<div
354353
className={cn(
355354
'flex-1 min-w-0 cursor-pointer px-3 py-2 transition-colors flex items-center gap-2',
356-
kId === hoveredId ? 'bg-black/5' : 'hover:bg-black/5',
357-
kId === clickedId &&
355+
qId === hoveredId ? 'bg-black/5' : 'hover:bg-black/5',
356+
qId === clickedId &&
358357
'bg-blue-100/50 shadow-[inset_0_0_0_1px_#3b82f6]',
359358
)}
360-
onMouseEnter={() => onNodeHover(kId)}
359+
onClick={(e) => onNodeClick(qId, e.metaKey || e.ctrlKey)}
360+
onMouseEnter={() => onNodeHover(qId)}
361361
onMouseLeave={() => onNodeHover(null)}
362362
>
363363
<span className="text-xs font-bold text-slate-400 shrink-0">
364-
K:
364+
Q:
365365
</span>
366-
{renderNodeLabel(kId)}
366+
{renderNodeLabel(qId)}
367367
</div>
368368

369369
<div className="text-right flex flex-col justify-center items-end px-3 shrink-0 border-l border-black/5 bg-white/30">

0 commit comments

Comments
 (0)