An AI-powered search engine with a generative UI
TypeScript generative-aigenerative-uinextjsollamareactsearxngshadcn-uitailwindcsstavilytypescriptupstashvercel-ai-sdk
chore: Add assistant answer to submit function
Yoshiki Miuraea0e76292e55
diff --git a/app/actions.tsx b/app/actions.tsxindex 7cfa6202..bda8accc 100644--- a/app/actions.tsx+++ b/app/actions.tsx@@ -186,6 +186,19 @@ async function submit(formData?: FormData, skip?: boolean) {processedMessages = transformToolMessages(aiState.get().messages)}+ aiState.update({+ ...aiState.get(),+ messages: [+ ...aiState.get().messages,+ {+ id: groupeId,+ role: 'assistant',+ content: answer,+ type: 'answer'+ }+ ]+ })+// Generate related queriesconst relatedQueries = await querySuggestor(uiStream, processedMessages)// Add follow-up panel@@ -195,20 +208,10 @@ async function submit(formData?: FormData, skip?: boolean) {</Section>)- // Add the answer, related queries, and follow-up panel to the state- // Wait for 0.5 second before adding the answer to the state- await new Promise(resolve => setTimeout(resolve, 500))-aiState.done({...aiState.get(),messages: [...aiState.get().messages,- {- id: groupeId,- role: 'assistant',- content: answer,- type: 'answer'- },{id: groupeId,role: 'assistant',