From 711452fc3beae15153711cbed5af0f59eb5398f2 Mon Sep 17 00:00:00 2001 From: YurenHao0426 Date: Fri, 13 Feb 2026 19:41:03 +0000 Subject: Add rendered/plain text toggle for response views Add an Eye/EyeOff toggle button to switch between rendered markdown and raw plain text in all three response locations: main response panel, expanded response modal, and Quick Chat messages. Useful for copying raw text without formatting artifacts. Co-Authored-By: Claude Opus 4.6 --- frontend/src/components/Sidebar.tsx | 53 ++++++++++++++++++++++++++++++++----- 1 file changed, 47 insertions(+), 6 deletions(-) (limited to 'frontend') diff --git a/frontend/src/components/Sidebar.tsx b/frontend/src/components/Sidebar.tsx index 079b4d5..b73c513 100644 --- a/frontend/src/components/Sidebar.tsx +++ b/frontend/src/components/Sidebar.tsx @@ -17,7 +17,7 @@ const preprocessLaTeX = (content: string): string => { .replace(/\\\(([\s\S]*?)\\\)/g, (_, math) => `$${math}$`); }; -import { Play, Settings, Info, ChevronLeft, ChevronRight, Maximize2, Edit3, X, Check, FileText, MessageCircle, Send, GripVertical, GitMerge, Trash2, AlertCircle, Loader2, Navigation, Upload, Search, Link, Layers } from 'lucide-react'; +import { Play, Settings, Info, ChevronLeft, ChevronRight, Maximize2, Edit3, X, Check, FileText, MessageCircle, Send, GripVertical, GitMerge, Trash2, AlertCircle, Loader2, Navigation, Upload, Search, Link, Layers, Eye, EyeOff } from 'lucide-react'; interface SidebarProps { isOpen: boolean; @@ -55,6 +55,7 @@ const Sidebar: React.FC = ({ isOpen, onToggle, onInteract }) => { const [isModalOpen, setIsModalOpen] = useState(false); const [isEditing, setIsEditing] = useState(false); const [editedResponse, setEditedResponse] = useState(''); + const [rawTextMode, setRawTextMode] = useState(false); // Summary states const [showSummaryModal, setShowSummaryModal] = useState(false); @@ -1854,6 +1855,15 @@ const Sidebar: React.FC = ({ isOpen, onToggle, onInteract }) => {
{selectedNode.data.response && ( <> +
+ ) : rawTextMode ? ( +
{selectedNode.data.response || (streamingNodeId === selectedNode.id ? streamBuffer : '')}
) : (
{preprocessLaTeX(selectedNode.data.response || (streamingNodeId === selectedNode.id ? streamBuffer : ''))} @@ -2186,18 +2202,30 @@ const Sidebar: React.FC = ({ isOpen, onToggle, onInteract }) => { {/* Modal Header */}

{selectedNode.data.label} - Response

-
+
+ {!isEditing && ( + + )} {!isEditing && ( )} @@ -2212,6 +2240,8 @@ const Sidebar: React.FC = ({ isOpen, onToggle, onInteract }) => { onChange={(e) => setEditedResponse(e.target.value)} className="w-full h-full min-h-[400px] border border-gray-300 rounded-md p-3 text-sm font-mono focus:ring-2 focus:ring-blue-500 resize-y" /> + ) : rawTextMode ? ( +
{selectedNode.data.response || ''}
) : (
{preprocessLaTeX(selectedNode.data.response || '')} @@ -2527,6 +2557,15 @@ const Sidebar: React.FC = ({ isOpen, onToggle, onInteract }) => { + @@ -2608,6 +2647,8 @@ const Sidebar: React.FC = ({ isOpen, onToggle, onInteract }) => { {msg.role === 'user' ? (

{msg.content}

+ ) : rawTextMode ? ( +
{msg.content}
) : (
{preprocessLaTeX(msg.content)} -- cgit v1.2.3