An AI-powered search engine with a generative UI
TypeScript generative-aigenerative-uinextjsollamareactsearxngshadcn-uitailwindcsstavilytypescriptupstashvercel-ai-sdk
Fix the status being generated
Yoshiki Miura5959f16ec924
diff --git a/app/actions.tsx b/app/actions.tsxindex 32b88e07..269ea2f6 100644--- a/app/actions.tsx+++ b/app/actions.tsx@@ -118,7 +118,8 @@ async function submit({id: nanoid(),role: 'assistant',- content: `inquiry: ${inquiry?.question}`+ content: `inquiry: ${inquiry?.question}`,+ type: 'inquiry'}]})diff --git a/components/chat-panel.tsx b/components/chat-panel.tsxindex ba6f81ea..ca912f4b 100644--- a/components/chat-panel.tsx+++ b/components/chat-panel.tsx@@ -68,7 +68,7 @@ export function ChatPanel({ messages, query }: ChatPanelProps) {useEffect(() => {const lastMessage = aiMessage.messages.slice(-1)[0]- if (lastMessage?.type === 'followup') {+ if (lastMessage?.type === 'followup' || lastMessage?.type === 'inquiry') {setIsGenerating(false)}}, [aiMessage, setIsGenerating])diff --git a/components/copilot.tsx b/components/copilot.tsxindex 2c3e49e5..ca1fac1a 100644--- a/components/copilot.tsx+++ b/components/copilot.tsx@@ -15,6 +15,7 @@ import {} from 'ai/rsc'import type { AI } from '@/app/actions'import { IconLogo } from './ui/icons'+import { useAppState } from '@/lib/utils/app-state'export type CopilotProps = {inquiry?: StreamableValue<PartialInquiry>@@ -31,6 +32,7 @@ export const Copilot: React.FC<CopilotProps> = ({ inquiry }: CopilotProps) => {const [isButtonDisabled, setIsButtonDisabled] = useState(true)const [, setMessages] = useUIState<typeof AI>()const { submit } = useActions()+ const { setIsGenerating } = useAppState()const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>) => {setQuery(event.target.value)@@ -70,6 +72,7 @@ export const Copilot: React.FC<CopilotProps> = ({ inquiry }: CopilotProps) => {skip?: boolean) => {e.preventDefault()+ setIsGenerating(true)setCompleted(true)setSkipped(skip || false)