umanggarg Claude Sonnet 4.6 commited on
Commit
019b48f
Β·
1 Parent(s): daa9559

feat: add RAG/Agent mode tag to chat messages

Browse files

Each assistant response now shows a compact mode label at the top:
"✦ Agent Β· 4 steps Β· model-name" β€” for agentic responses
"β—Ž RAG Β· hybrid Β· model-name" β€” for RAG responses

Uses msg.phase as the reliable mode signal (phase=null β†’ agent,
phase=string β†’ RAG, set at message creation in App.jsx). Visible
immediately when streaming starts so the user always knows the mode.
Makes long chat histories scannable without having to decode avatars
or look for pipeline bars.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Files changed (2) hide show
  1. ui/src/components/Message.jsx +32 -0
  2. ui/src/index.css +34 -0
ui/src/components/Message.jsx CHANGED
@@ -357,6 +357,38 @@ const Message = forwardRef(function Message({ msg, onDiagramThis, onRetry, showR
357
 
358
  {/* All assistant content in a column wrapper */}
359
  <div className="message-content">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
360
  {/* Agent reasoning trace */}
361
  {msg.toolCalls && msg.toolCalls.length > 0 && (
362
  <ToolCallTrace steps={msg.toolCalls} streaming={msg.streaming} iterations={msg.iterations} model={msg.model} />
 
357
 
358
  {/* All assistant content in a column wrapper */}
359
  <div className="message-content">
360
+ {/* Mode tag β€” always shown on assistant responses so chat history is scannable.
361
+ "phase" is the reliable mode signal: null = agent, string = RAG (set at message
362
+ creation in App.jsx). Compact label: "✦ Agent Β· 4 steps" or "β—Ž RAG Β· hybrid". */}
363
+ {"phase" in msg && (
364
+ <div className="msg-mode-tag">
365
+ {msg.phase === null ? (
366
+ // Agent mode: phase is explicitly null (set before any tools run)
367
+ <>
368
+ <span className="msg-mode-icon">✦</span>
369
+ <span className="msg-mode-label">Agent</span>
370
+ {msg.iterations > 0 && (
371
+ <span className="msg-mode-detail">Β· {msg.iterations} step{msg.iterations !== 1 ? "s" : ""}</span>
372
+ )}
373
+ </>
374
+ ) : (
375
+ // RAG mode: phase = "searching" β†’ "generating" β†’ done
376
+ <>
377
+ <span className="msg-mode-icon">β—Ž</span>
378
+ <span className="msg-mode-label">RAG</span>
379
+ {msg.queryType && (
380
+ <span className="msg-mode-detail">Β· {msg.queryType}</span>
381
+ )}
382
+ </>
383
+ )}
384
+ {msg.model && (
385
+ <span className="msg-mode-model" title={`Model: ${msg.model}`}>
386
+ Β· {msg.model.split("/").pop()}
387
+ </span>
388
+ )}
389
+ </div>
390
+ )}
391
+
392
  {/* Agent reasoning trace */}
393
  {msg.toolCalls && msg.toolCalls.length > 0 && (
394
  <ToolCallTrace steps={msg.toolCalls} streaming={msg.streaming} iterations={msg.iterations} model={msg.model} />
ui/src/index.css CHANGED
@@ -684,6 +684,40 @@ textarea:focus-visible {
684
  min-width: 0;
685
  }
686
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
687
  /* ── Avatar ───────────────────────────────────────────────── */
688
  .message-avatar {
689
  width: 32px;
 
684
  min-width: 0;
685
  }
686
 
687
+ /* ── Mode tag (RAG / Agent label) ─────────────────────────── */
688
+ /* Compact label above each assistant response β€” makes chat history scannable.
689
+ "✦ Agent Β· 4 steps" vs "β—Ž RAG Β· hybrid" at a glance. */
690
+ .msg-mode-tag {
691
+ display: flex;
692
+ align-items: center;
693
+ gap: 4px;
694
+ font-size: 11px;
695
+ color: var(--muted);
696
+ user-select: none;
697
+ }
698
+
699
+ .msg-mode-icon {
700
+ font-size: 10px;
701
+ opacity: 0.7;
702
+ }
703
+
704
+ .msg-mode-label {
705
+ font-weight: 600;
706
+ letter-spacing: 0.03em;
707
+ color: var(--text-2);
708
+ text-transform: uppercase;
709
+ font-size: 10px;
710
+ }
711
+
712
+ .msg-mode-detail {
713
+ color: var(--muted);
714
+ }
715
+
716
+ .msg-mode-model {
717
+ color: var(--faint);
718
+ font-style: italic;
719
+ }
720
+
721
  /* ── Avatar ───────────────────────────────────────────────── */
722
  .message-avatar {
723
  width: 32px;