diff --git a/web/src/app/chat/Refinement.tsx b/web/src/app/chat/Refinement.tsx index fe679ed9a..df296eb8d 100644 --- a/web/src/app/chat/Refinement.tsx +++ b/web/src/app/chat/Refinement.tsx @@ -28,11 +28,7 @@ export function useOrderedPhases(externalPhase: StreamingPhase) { // Whenever externalPhase changes, add any missing steps into the queue useEffect(() => { setPhaseQueue((prevQueue) => { - const lastDisplayed = displayedPhases[displayedPhases.length - 1]; const lastIndex = finalPhaseIndex.current || 0; - // lastDisplayed - // ? getPhaseIndex(lastDisplayed) - // : getPhaseIndex(StreamingPhase.WAITING); let targetPhase = externalPhase; let targetIndex = getPhaseIndex(targetPhase); @@ -50,11 +46,6 @@ export function useOrderedPhases(externalPhase: StreamingPhase) { targetIndex + 1 ); - // []; - - // for (let i = lastIndex + 1; i <= targetIndex; i++) { - // missingPhases= PHASES_ORDER[i]); - // } return [...prevQueue, ...missingPhases]; }); }, [externalPhase, displayedPhases]); @@ -125,6 +116,7 @@ export function RefinemenetBadge({ // Expand/collapse, hover states const [expanded, setExpanded] = useState(true); + const [toolTipHoveredInternal, setToolTipHoveredInternal] = useState(false); const [isHovered, setIsHovered] = useState(false); const [shouldShow, setShouldShow] = useState(true); @@ -145,7 +137,7 @@ export function RefinemenetBadge({ return ( - +
setIsHovered(true)} @@ -167,10 +159,16 @@ export function RefinemenetBadge({ {expanded && ( setToolTipHovered(true)} + onMouseEnter={() => { + setToolTipHoveredInternal(true); + setToolTipHovered(true); + }} + onMouseLeave={() => { + setToolTipHoveredInternal(false); + }} side="bottom" align="start" - className="w-fit p-4 bg-white border-2 border-border shadow-lg rounded-md" + className="w-fit -mt-1 p-4 bg-white border-2 border-border shadow-lg rounded-md" > {/* If not done, show the "Refining" box + a chevron */} @@ -322,7 +320,9 @@ export function StatusRefinement({ { const viewInitialAnswer = !isViewingInitialAnswer; setIsViewingInitialAnswer(viewInitialAnswer); diff --git a/web/src/app/chat/message/AgenticMessage.tsx b/web/src/app/chat/message/AgenticMessage.tsx index 867485008..3b9843a46 100644 --- a/web/src/app/chat/message/AgenticMessage.tsx +++ b/web/src/app/chat/message/AgenticMessage.tsx @@ -147,7 +147,7 @@ export const AgenticMessage = ({ processed = processed.replace(/\]\](?!\()/g, "]]()"); - return preprocessLaTeX(processed) + (!isComplete ? " [*]() " : ""); + return preprocessLaTeX(processed); }; const finalContent = processContent(content) as string; @@ -322,10 +322,11 @@ export const AgenticMessage = ({ remarkPlugins={[remarkGfm, remarkMath]} rehypePlugins={[[rehypePrism, { ignoreMissing: true }], rehypeKatex]} > - {streamedContent} + {streamedContent + + (!isComplete && !secondLevelGenerating ? " [*]() " : "")} ); - }, [streamedContent, markdownComponents]); + }, [streamedContent, markdownComponents, isComplete]); const includeMessageSwitcher = currentMessageInd !== undefined && @@ -335,10 +336,6 @@ export const AgenticMessage = ({ useEffect(() => { if (!allowStreaming) { - // if (typeof content === "string") { - // setStreamedContent(finalContent); - // setLastKnownContentLength(finalContent.length); - // } return; } diff --git a/web/src/app/chat/message/MemoizedTextComponents.tsx b/web/src/app/chat/message/MemoizedTextComponents.tsx index fbb67dadd..9fbfd4bd2 100644 --- a/web/src/app/chat/message/MemoizedTextComponents.tsx +++ b/web/src/app/chat/message/MemoizedTextComponents.tsx @@ -31,7 +31,7 @@ export const MemoizedAnchor = memo( if (value?.startsWith("[") && value?.endsWith("]")) { const match = value.match(/\[(D|Q)?(\d+)\]/); if (match) { - const index = parseInt(match[1], 10) - 1; + const index = parseInt(match[2], 10) - 1; const associatedDoc = docs?.[index]; if (!associatedDoc) { return {children}; @@ -53,7 +53,7 @@ export const MemoizedAnchor = memo( if (!associatedDoc && !associatedSubQuestion) { return ( <> - {children} + l{children} {/* No associated docs or subquestions.

Number of questions: {subQuestions?.length}

@@ -114,7 +114,7 @@ export const MemoizedAnchor = memo( } return ( - {children} + {children}l ); } diff --git a/web/src/components/ui/badge.tsx b/web/src/components/ui/badge.tsx index 387d457e1..3b2746600 100644 --- a/web/src/components/ui/badge.tsx +++ b/web/src/components/ui/badge.tsx @@ -8,6 +8,8 @@ const badgeVariants = cva( { variants: { variant: { + "agent-faded": + "border-neutral-200 bg-neutral-100 text-neutral-600 hover:bg-neutral-200", agent: "border-agent bg-agent text-white hover:bg-agent-hover", canceled: "border-gray-200 bg-gray-50 text-gray-600 hover:bg-gray-75 dark:bg-gray-900 dark:text-neutral-50 dark:hover:bg-gray-850",