An AI-powered search engine with a generative UI
TypeScript generative-aigenerative-uinextjsollamareactsearxngshadcn-uitailwindcsstavilytypescriptupstashvercel-ai-sdk
Update component to use StreamableValue for relatedQueries
Yoshiki Miura0c067cc9aecd
diff --git a/bun.lockb b/bun.lockbindex fcbb3f9d..ba5a1223 100755Binary files a/bun.lockb and b/bun.lockb differdiff --git a/components/search-related.tsx b/components/search-related.tsxindex af7b2b88..5b5a4e56 100644--- a/components/search-related.tsx+++ b/components/search-related.tsx@@ -1,20 +1,20 @@'use client'-import React, { useEffect, useState } from 'react'+import React from 'react'import { Button } from './ui/button'import { ArrowRight } from 'lucide-react'import {+ StreamableValue,useActions,useStreamableValue,- useUIState,- readStreamableValue+ useUIState} from 'ai/rsc'import { AI } from '@/app/actions'import { UserMessage } from './user-message'import { PartialRelated } from '@/lib/schema/related'export interface SearchRelatedProps {- relatedQueries: PartialRelated+ relatedQueries: StreamableValue<PartialRelated>}export const SearchRelated: React.FC<SearchRelatedProps> = ({@@ -22,8 +22,7 @@ export const SearchRelated: React.FC<SearchRelatedProps> = ({}) => {const { submit } = useActions()const [, setMessages] = useUIState<typeof AI>()- const [data, error, pending] =- useStreamableValue<PartialRelated>(relatedQueries)+ const [data, error, pending] = useStreamableValue(relatedQueries)const handleSubmit = async (event: React.FormEvent<HTMLFormElement>) => {event.preventDefault()