An AI-powered search engine with a generative UI
TypeScript generative-aigenerative-uinextjsollamareactsearxngshadcn-uitailwindcsstavilytypescriptupstashvercel-ai-sdk
refactor: remove unused getModels and models prop throughout codebase
Yoshiki Miura921509a90b6d
diff --git a/app/page.tsx b/app/page.tsxindex 61a6dd9d..2addc52d 100644--- a/app/page.tsx+++ b/app/page.tsx@@ -1,4 +1,3 @@-import { getModels } from '@/lib/config/models'import { generateId } from '@/lib/db/schema'import { ChangelogBanner } from '@/components/changelog-banner'@@ -6,10 +5,9 @@ import { Chat } from '@/components/chat'export default async function Page() {const id = generateId()- const models = await getModels()return (<>- <Chat id={id} models={models} />+ <Chat id={id} /><ChangelogBanner /></>)diff --git a/app/search/[id]/page.tsx b/app/search/[id]/page.tsxindex f96a8bc2..f2347061 100644--- a/app/search/[id]/page.tsx+++ b/app/search/[id]/page.tsx@@ -4,7 +4,6 @@ import { UIMessage } from 'ai'import { loadChat } from '@/lib/actions/chat'import { getCurrentUserId } from '@/lib/auth/get-current-user'-import { getModels } from '@/lib/config/models'import { Chat } from '@/components/chat'@@ -45,6 +44,5 @@ export default async function SearchPage(props: {const messages: UIMessage[] = chat.messages- const models = await getModels()- return <Chat id={id} savedMessages={messages} models={models} />+ return <Chat id={id} savedMessages={messages} />}diff --git a/app/search/page.tsx b/app/search/page.tsxindex 3c99e38c..11f92654 100644--- a/app/search/page.tsx+++ b/app/search/page.tsx@@ -1,6 +1,5 @@import { redirect } from 'next/navigation'-import { getModels } from '@/lib/config/models'import { generateUUID } from '@/lib/utils'import { Chat } from '@/components/chat'@@ -16,6 +15,5 @@ export default async function SearchPage(props: {}const id = generateUUID()- const models = await getModels()- return <Chat id={id} query={q} models={models} />+ return <Chat id={id} query={q} />}diff --git a/components/chat-panel.tsx b/components/chat-panel.tsxindex 626752ed..41e77560 100644--- a/components/chat-panel.tsx+++ b/components/chat-panel.tsx@@ -10,7 +10,6 @@ import { toast } from 'sonner'import { UploadedFile } from '@/lib/types'import type { UIDataTypes, UIMessage, UITools } from '@/lib/types/ai'-import { Model } from '@/lib/types/models'import { cn } from '@/lib/utils'import { useArtifact } from './artifact/artifact-context'@@ -36,7 +35,6 @@ interface ChatPanelProps {query?: stringstop: () => voidappend: (message: any) => void- models?: Model[]/** Whether to show the scroll to bottom button */showScrollToBottomButton: boolean/** Reference to the scroll container */@@ -56,7 +54,6 @@ export function ChatPanel({query,stop,append,- models,showScrollToBottomButton,uploadedFiles,setUploadedFiles,diff --git a/components/chat.tsx b/components/chat.tsxindex f2904832..044723c9 100644--- a/components/chat.tsx+++ b/components/chat.tsx@@ -14,7 +14,6 @@ import {isToolCallPart,isToolTypePart} from '@/lib/types/dynamic-tools'-import { Model } from '@/lib/types/models'import { SearchMode } from '@/lib/types/search'import { cn } from '@/lib/utils'import { getCookie } from '@/lib/utils/cookies'@@ -38,13 +37,11 @@ interface ChatSection {export function Chat({id,savedMessages = [],- query,- models+ query}: {id: stringsavedMessages?: UIMessage[]query?: string- models?: Model[]}) {const scrollContainerRef = useRef<HTMLDivElement>(null)const [isAtBottom, setIsAtBottom] = useState(true)@@ -410,7 +407,6 @@ export function Chat({append={(message: any) => {sendMessage(message)}}- models={models}showScrollToBottomButton={!isAtBottom}uploadedFiles={uploadedFiles}setUploadedFiles={setUploadedFiles}