An AI-powered search engine with a generative UI
TypeScript generative-aigenerative-uinextjsollamareactsearxngshadcn-uitailwindcsstavilytypescriptupstashvercel-ai-sdk
Remove unused pending and isGenerating states from question confirmation
Yoshiki Miura17d789b17350
diff --git a/components/question-confirmation.tsx b/components/question-confirmation.tsxindex a7e5ef32..ee7db408 100644--- a/components/question-confirmation.tsx+++ b/components/question-confirmation.tsx@@ -11,7 +11,6 @@ import { useState } from 'react'interface QuestionConfirmationProps {toolInvocation: ToolInvocationonConfirm: (toolCallId: string, approved: boolean, response?: any) => void- pending?: booleanisCompleted?: boolean}@@ -23,7 +22,6 @@ interface QuestionOption {export function QuestionConfirmation({toolInvocation,onConfirm,- pending = false,isCompleted = false}: QuestionConfirmationProps) {const { question, options, allowsInput, inputLabel, inputPlaceholder } =@@ -38,14 +36,10 @@ export function QuestionConfirmation({const [selectedOptions, setSelectedOptions] = useState<string[]>([])const [inputText, setInputText] = useState('')const [completed, setCompleted] = useState(isCompleted)- const [isGenerating, setIsGenerating] = useState(false)const [skipped, setSkipped] = useState(false)const isButtonDisabled =- (selectedOptions.length === 0 &&- (!allowsInput || inputText.trim() === '')) ||- pending ||- isGenerating+ selectedOptions.length === 0 && (!allowsInput || inputText.trim() === '')const handleOptionChange = (label: string) => {setSelectedOptions(prev => {@@ -69,7 +63,6 @@ export function QuestionConfirmation({const handleSubmit = (e: React.FormEvent) => {e.preventDefault()- setIsGenerating(true)const response = {selectedOptions,@@ -193,12 +186,7 @@ export function QuestionConfirmation({)}<div className="flex justify-end space-x-2">- <Button- type="button"- variant="outline"- onClick={handleSkip}- disabled={pending || isGenerating}- >+ <Button type="button" variant="outline" onClick={handleSkip}><SkipForward size={16} className="mr-1" />Skip</Button>diff --git a/components/tool-section.tsx b/components/tool-section.tsxindex 38d2eec1..0bbb35a6 100644--- a/components/tool-section.tsx+++ b/components/tool-section.tsx@@ -27,8 +27,6 @@ export function ToolSection({<QuestionConfirmationtoolInvocation={tool}onConfirm={(toolCallId, approved, response) => {- // If approved, return the response with user selections- // If declined, return a message that the user declinedaddToolResult({toolCallId,result: approved