feat: Add sliding window effect for streaming reasoning text
- Use overflow:hidden + whitespace:nowrap to prevent line breaks - Apply justify-end flexbox to push content to the right - New tokens push older ones out to the left edge and hide them - Creates smooth sliding window effect showing only recent tokens - Only applies during streaming, keeps normal wrap after completion This creates a nice visual effect where you can see the latest reasoning tokens flowing in from right to left as the model thinks.
This commit is contained in:
parent
78e01032ae
commit
ccad616e02
1 changed files with 7 additions and 5 deletions
|
|
@ -54,11 +54,13 @@ const ReasoningBlock: React.FC<ReasoningBlockProps> = ({
|
|||
|
||||
{isExpanded ? (
|
||||
// Expanded view: show reasoning content
|
||||
<div className="whitespace-pre-wrap flex-1">
|
||||
{reasoning}
|
||||
{isStreaming && (
|
||||
<span className="inline-block w-2 h-4 bg-zinc-400 ml-1 animate-pulse"></span>
|
||||
)}
|
||||
<div className={`flex-1 ${isStreaming ? "overflow-hidden whitespace-nowrap flex justify-end" : "whitespace-pre-wrap"}`}>
|
||||
<span className={isStreaming ? "inline-block" : ""}>
|
||||
{reasoning}
|
||||
{isStreaming && (
|
||||
<span className="inline-block w-2 h-4 bg-zinc-400 ml-1 animate-pulse"></span>
|
||||
)}
|
||||
</span>
|
||||
</div>
|
||||
) : (
|
||||
// Collapsed view: show timing summary
|
||||
|
|
|
|||
Loading…
Reference in a new issue