@@ -63,14 +63,6 @@ export function Chat({ conversationId }: ChatProps) {
6363 const messagesEndRef = useRef<HTMLDivElement>(null);
6464 const textareaRef = useRef<HTMLTextAreaElement>(null);
6565
66- const scrollToBottom = useCallback(() => {
67- messagesEndRef.current?.scrollIntoView({ behavior: "smooth" });
68- }, []);
69-
70- useEffect(() => {
71- scrollToBottom();
72- }, [messages, scrollToBottom]);
73-
7466 // Load existing conversation turns
7567 useEffect(() => {
7668 async function loadConversation() {
@@ -328,7 +320,7 @@ export function Chat({ conversationId }: ChatProps) {
328320 setIsStreaming(false);
329321 // Navigate to new conversation URL after streaming completes
330322 if (shouldNavigate && newConversationId) {
331- router.push(`/conversation/${newConversationId}`);
323+ router.push(`/conversation/${newConversationId}`, { scroll: false });
332324 }
333325 }
334326 },
@@ -464,10 +456,7 @@ function MessageBubble({ message }: { message: Message }) {
464456 </Avatar>
465457
466458 {isUser ? (
467- <Card
468- size="sm"
469- className="bg-primary text-primary-foreground max-w-[80%]"
470- >
459+ <Card size="sm" className="max-w-[80%]">
471460 <CardContent>
472461 <p className="whitespace-pre-wrap">{message.content}</p>
473462 </CardContent>
@@ -477,19 +466,31 @@ function MessageBubble({ message }: { message: Message }) {
477466 {/* Reasoning section */}
478467 {message.reasoning && (
479468 <CardContent>
480- <Collapsible>
481- <div className="border-muted-foreground/20 bg-muted/30 rounded-lg border p-2">
482- <CollapsibleTrigger className="text-muted-foreground hover:text-foreground flex w-full items-center gap-1 text-xs transition-colors [&[data-state=open]>svg:first-child]:rotate-90">
483- <ChevronRight className="size-3 transition-transform" />
484- <span>Thinking...</span>
485- </CollapsibleTrigger>
486- <CollapsibleContent>
487- <p className="text-muted-foreground mt-2 whitespace-pre-wrap text-xs">
488- {message.reasoning}
469+ {(() => {
470+ const lines = message.reasoning.split("\n");
471+ const visibleLines = lines.slice(-5).join("\n");
472+ const hiddenLines = lines.slice(0, -5).join("\n");
473+ const hasHiddenContent = lines.length > 5;
474+
475+ return (
476+ <Collapsible>
477+ <CollapsibleTrigger className="text-muted-foreground hover:text-foreground flex w-full items-center gap-1 text-xs transition-colors [&[data-state=open]>svg:first-child]:rotate-90">
478+ <ChevronRight className="size-3 transition-transform" />
479+ <span>Show more reasoning</span>
480+ </CollapsibleTrigger>
481+ {hasHiddenContent && (
482+ <CollapsibleContent>
483+ <p className="text-muted-foreground whitespace-pre-wrap text-xs mt-2">
484+ {hiddenLines}
485+ </p>
486+ </CollapsibleContent>
487+ )}
488+ <p className="text-muted-foreground whitespace-pre-wrap text-xs">
489+ {visibleLines}
489490 </p>
490- </CollapsibleContent>
491- </div>
492- </Collapsible>
491+ </Collapsible>
492+ );
493+ })()}
493494 </CardContent>
494495 )}
495496
@@ -515,28 +516,23 @@ function MessageBubble({ message }: { message: Message }) {
515516 }
516517
517518 function ToolCallBubble({ toolCall }: { toolCall: ToolCall }) {
518- const isSearch = toolCall.name === "search_web";
519-
520519 return (
521- <Collapsible>
522- <Card size="sm" className="border-blue-500/20 bg-blue-500/5">
520+ <Collapsible className="my-4">
521+ <Card size="sm">
523522 <CardContent>
524523 <div className="flex items-center gap-2">
525524 {toolCall.status === "pending" ? (
526- <Loader2 className="size-3 animate-spin text-blue-500" />
527- ) : isSearch ? (
528- <Search className="size-3 text-blue-500" />
525+ <Loader2 className="size-3 animate-spin" />
529526 ) : (
530- <Wrench className="size-3 text-blue-500" />
527+ <Wrench className="size-3" />
531528 )}
532529 <span className="text-xs font-medium">
533- {isSearch ? "Searching" : toolCall.name}
534- {isSearch &&
535- typeof toolCall.args.query === "string" &&
530+ Calling {toolCall.name}
531+ {typeof toolCall.args.query === "string" &&
536532 toolCall.args.query && (
537533 <span className="text-muted-foreground font-normal">
538534 {" "}
539- for "{toolCall.args.query}"
535+ with "{toolCall.args.query}"
540536 </span>
541537 )}
542538 </span>