An AI-powered search engine with a generative UI
TypeScript generative-aigenerative-uinextjsollamareactsearxngshadcn-uitailwindcsstavilytypescriptupstashvercel-ai-sdk
refactor: adjust layout and component structure in answer and reasoning sections
Yoshiki Miura65de15393940
diff --git a/components/answer-section.tsx b/components/answer-section.tsxindex 67588375..e093d87c 100644--- a/components/answer-section.tsx+++ b/components/answer-section.tsx@@ -34,7 +34,6 @@ export function AnswerSection({message={content}chatId={chatId}enableShare={enableShare}- className="self-end"/></div>) : (diff --git a/components/chat.tsx b/components/chat.tsxindex f9e73486..ce895460 100644--- a/components/chat.tsx+++ b/components/chat.tsx@@ -60,7 +60,7 @@ export function Chat({}return (- <div className="flex flex-col w-full max-w-3xl pt-14 pb-36 mx-auto stretch">+ <div className="flex flex-col w-full max-w-3xl pt-14 pb-60 mx-auto stretch"><ChatMessagesmessages={messages}data={data}diff --git a/components/message-actions.tsx b/components/message-actions.tsxindex d912f9ad..ac0d520f 100644--- a/components/message-actions.tsx+++ b/components/message-actions.tsx@@ -34,7 +34,7 @@ export function MessageActions({}return (- <div className={cn('flex items-center gap-0.5', className)}>+ <div className={cn('flex items-center gap-0.5 self-end', className)}><Buttonvariant="ghost"size="icon"diff --git a/components/reasoning-answer-section.tsx b/components/reasoning-answer-section.tsxindex c87f323b..5349af16 100644--- a/components/reasoning-answer-section.tsx+++ b/components/reasoning-answer-section.tsx@@ -3,10 +3,10 @@import { CHAT_ID } from '@/lib/constants'import { useChat } from 'ai/react'import { Check, Lightbulb, Loader2 } from 'lucide-react'-import { ChatShare } from './chat-share'import { CollapsibleMessage } from './collapsible-message'import { DefaultSkeleton } from './default-skeleton'import { BotMessage } from './message'+import { MessageActions } from './message-actions'import { StatusIndicator } from './ui/status-indicator'interface ReasoningAnswerContent {@@ -74,9 +74,11 @@ export function ReasoningAnswerSection({><div className="flex flex-col gap-4"><BotMessage message={content.answer || ''} />- {enableShare && chatId && (- <ChatShare chatId={chatId} className="self-end" />- )}+ <MessageActions+ message={content.answer || ''}+ chatId={chatId}+ enableShare={enableShare}+ /></div></CollapsibleMessage></div>diff --git a/lib/streaming/create-manual-tool-stream.ts b/lib/streaming/create-manual-tool-stream.tsindex 90f59a23..ac7d563d 100644--- a/lib/streaming/create-manual-tool-stream.ts+++ b/lib/streaming/create-manual-tool-stream.ts@@ -51,7 +51,7 @@ export function createManualToolStreamResponse(config: BaseStreamConfig) {model,chatId,dataStream,- skipRelatedQuestions: true,+ skipRelatedQuestions: false,annotations})}