An AI-powered search engine with a generative UI
TypeScript generative-aigenerative-uinextjsollamareactsearxngshadcn-uitailwindcsstavilytypescriptupstashvercel-ai-sdk
Fix: Remove icon space when showIcon is false and hide icons for non-user/assistant roles
Yoshiki Miurac1ee4e0fc2d0
diff --git a/.gitignore b/.gitignoreindex fd3dbb57..564feb2c 100644--- a/.gitignore+++ b/.gitignore@@ -34,3 +34,6 @@ yarn-error.log*# typescript*.tsbuildinfonext-env.d.ts++# cursor+.cursordiff --git a/components/chat-panel.tsx b/components/chat-panel.tsxindex 5d1b1c53..bc9c22a9 100644--- a/components/chat-panel.tsx+++ b/components/chat-panel.tsx@@ -90,7 +90,7 @@ export function ChatPanel({onSubmit={handleSubmit}className={cn('max-w-3xl w-full mx-auto',- messages.length > 0 ? 'px-2 py-4' : 'px-6'+ messages.length > 0 ? 'px-2 pb-4' : 'px-6')}><div className="relative flex flex-col w-full gap-2 bg-muted rounded-3xl border border-input">diff --git a/components/chat.tsx b/components/chat.tsxindex 7d16278c..e6c5be89 100644--- a/components/chat.tsx+++ b/components/chat.tsx@@ -63,7 +63,7 @@ export function Chat({}return (- <div className="flex flex-col w-full max-w-3xl pt-14 pb-60 mx-auto stretch">+ <div className="flex flex-col w-full max-w-3xl pt-14 pb-40 mx-auto stretch"><ChatMessagesmessages={messages}data={data}diff --git a/components/related-questions.tsx b/components/related-questions.tsxindex a63e4170..f20bd379 100644--- a/components/related-questions.tsx+++ b/components/related-questions.tsx@@ -74,6 +74,7 @@ export const RelatedQuestions: React.FC<RelatedQuestionsProps> = ({header={header}isOpen={isOpen}onOpenChange={onOpenChange}+ showIcon={false}><div className="flex flex-wrap">{Array.isArray(relatedQuestions.items) ? (diff --git a/components/retrieve-section.tsx b/components/retrieve-section.tsxindex 1a9a1919..0d0faeb3 100644--- a/components/retrieve-section.tsx+++ b/components/retrieve-section.tsx@@ -1,11 +1,11 @@'use client'-import { Section, ToolArgsSection } from '@/components/section'import { SearchResults } from '@/components/search-results'+import { Section, ToolArgsSection } from '@/components/section'import { SearchResults as SearchResultsType } from '@/lib/types'import { ToolInvocation } from 'ai'-import { DefaultSkeleton } from './default-skeleton'import { CollapsibleMessage } from './collapsible-message'+import { DefaultSkeleton } from './default-skeleton'interface RetrieveSectionProps {tool: ToolInvocation@@ -32,6 +32,7 @@ export function RetrieveSection({header={header}isOpen={isOpen}onOpenChange={onOpenChange}+ showIcon={false}>{!isLoading && data ? (<Section title="Sources">diff --git a/components/search-section.tsx b/components/search-section.tsxindex f890832f..aaed52e8 100644--- a/components/search-section.tsx+++ b/components/search-section.tsx@@ -47,6 +47,7 @@ export function SearchSection({header={header}isOpen={isOpen}onOpenChange={onOpenChange}+ showIcon={false}>{searchResults &&searchResults.images &&diff --git a/components/tool-section.tsx b/components/tool-section.tsxindex da93863a..3357c28e 100644--- a/components/tool-section.tsx+++ b/components/tool-section.tsx@@ -1,9 +1,9 @@'use client'import { ToolInvocation } from 'ai'+import RetrieveSection from './retrieve-section'import { SearchSection } from './search-section'import { VideoSearchSection } from './video-search-section'-import RetrieveSection from './retrieve-section'interface ToolSectionProps {tool: ToolInvocationdiff --git a/components/video-search-section.tsx b/components/video-search-section.tsxindex 7233e74c..de128f56 100644--- a/components/video-search-section.tsx+++ b/components/video-search-section.tsx@@ -1,11 +1,11 @@'use client'-import { DefaultSkeleton } from './default-skeleton'-import { Section, ToolArgsSection } from './section'import type { SerperSearchResults } from '@/lib/types'import { ToolInvocation } from 'ai'-import { VideoSearchResults } from './video-search-results'import { CollapsibleMessage } from './collapsible-message'+import { DefaultSkeleton } from './default-skeleton'+import { Section, ToolArgsSection } from './section'+import { VideoSearchResults } from './video-search-results'interface VideoSearchSectionProps {tool: ToolInvocation@@ -32,6 +32,7 @@ export function VideoSearchSection({header={header}isOpen={isOpen}onOpenChange={onOpenChange}+ showIcon={false}>{!isLoading && searchResults ? (<Section title="Videos">