diff --git a/src/components/FormGenerator/FormGeneratorControls/FormGeneratorControls.tsx b/src/components/FormGenerator/FormGeneratorControls/FormGeneratorControls.tsx index 0299707..c08e7ee 100644 --- a/src/components/FormGenerator/FormGeneratorControls/FormGeneratorControls.tsx +++ b/src/components/FormGenerator/FormGeneratorControls/FormGeneratorControls.tsx @@ -181,7 +181,11 @@ export function FormGeneratorControls({ size="sm" icon={FaTrash} > +<<<<<<< HEAD {allItemsSelected +======= + {selectedCount === displayData.length && displayData.length > 0 +>>>>>>> c76e7efd28210f45737b5afbdddff2712b2c0cc7 ? t('formgen.delete.all', `Delete all ${selectedCount} items`).replace('{count}', selectedCount.toString()) : t('formgen.delete.multiple', `Delete ${selectedCount} selected items`).replace('{count}', selectedCount.toString())} diff --git a/src/hooks/useChatbot.ts b/src/hooks/useChatbot.ts index 76549b0..60c6797 100644 --- a/src/hooks/useChatbot.ts +++ b/src/hooks/useChatbot.ts @@ -348,6 +348,7 @@ export function useChatbot() { setInputValue(value); }, []); +<<<<<<< HEAD // Handle file upload const handleFileUpload = useCallback(async (file: File): Promise<{ success: boolean; data?: any }> => { setUploadError(null); @@ -415,6 +416,8 @@ export function useChatbot() { setUploadedFiles(prev => prev.filter(f => f.fileId !== fileId)); }, []); +======= +>>>>>>> c76e7efd28210f45737b5afbdddff2712b2c0cc7 // Stop chatbot workflow const stopChatbot = useCallback(async () => { if (!workflowId || !isRunning) { @@ -473,6 +476,7 @@ export function useChatbot() { const abortController = new AbortController(); streamAbortControllerRef.current = abortController; +<<<<<<< HEAD // Use ref to get current file IDs (avoids closure issues) const fileIdsToSend = pendingFileIdsRef.current.length > 0 ? pendingFileIdsRef.current @@ -483,11 +487,15 @@ export function useChatbot() { console.log('[handleSubmit] pendingFileIds from ref:', pendingFileIdsRef.current); console.log('[handleSubmit] fileIdsToSend:', fileIdsToSend); +======= + // Prepare request body +>>>>>>> c76e7efd28210f45737b5afbdddff2712b2c0cc7 const requestBody: StartChatbotRequest = { prompt: trimmedInput, userLanguage: 'en', ...(workflowId && { workflowId }) }; +<<<<<<< HEAD // Always include listFileId if there are any files if (fileIdsToSend.length > 0) { @@ -498,6 +506,8 @@ export function useChatbot() { } console.log('[handleSubmit] Final requestBody:', JSON.stringify(requestBody, null, 2)); +======= +>>>>>>> c76e7efd28210f45737b5afbdddff2712b2c0cc7 // Track if workflow was created in this request let workflowCreated = false; @@ -546,10 +556,13 @@ export function useChatbot() { if (!abortController.signal.aborted) { setIsRunning(false); setInputValue(''); // Clear input on completion +<<<<<<< HEAD // Clear pending file IDs after successful submission (files are now part of conversation) setPendingFileIds([]); pendingFileIdsRef.current = []; // Clear ref too setUploadedFiles([]); +======= +>>>>>>> c76e7efd28210f45737b5afbdddff2712b2c0cc7 // Clear thinking message on completion if no final message was received setTimeout(() => { clearThinkingMessage(); @@ -572,7 +585,11 @@ export function useChatbot() { setIsSubmitting(false); streamAbortControllerRef.current = null; } +<<<<<<< HEAD }, [inputValue, workflowId, isRunning, isSubmitting, stopChatbot, processChatDataItem, clearThinkingMessage, loadThreads, pendingFileIds]); +======= + }, [inputValue, workflowId, isRunning, isSubmitting, stopChatbot, processChatDataItem, clearThinkingMessage, loadThreads]); +>>>>>>> c76e7efd28210f45737b5afbdddff2712b2c0cc7 // Delete a chatbot workflow const handleDeleteThread = useCallback(async (workflowIdToDelete: string): Promise => { @@ -632,9 +649,12 @@ export function useChatbot() { setSelectedThreadId(null); setError(null); setInputValue(''); +<<<<<<< HEAD setPendingFileIds([]); pendingFileIdsRef.current = []; setUploadedFiles([]); +======= +>>>>>>> c76e7efd28210f45737b5afbdddff2712b2c0cc7 thinkingLogsRef.current = []; thinkingMessageIdRef.current = null; clearProcessedMessages(); @@ -655,9 +675,12 @@ export function useChatbot() { setIsSubmitting(false); setError(null); setInputValue(''); +<<<<<<< HEAD setPendingFileIds([]); pendingFileIdsRef.current = []; setUploadedFiles([]); +======= +>>>>>>> c76e7efd28210f45737b5afbdddff2712b2c0cc7 thinkingLogsRef.current = []; thinkingMessageIdRef.current = null; clearProcessedMessages(); @@ -717,6 +740,7 @@ export function useChatbot() { stopChatbot, resetChatbot, startNewChat, +<<<<<<< HEAD cleanup, // File upload interface @@ -727,6 +751,9 @@ export function useChatbot() { uploadedFiles, uploadingFile, uploadError +======= + cleanup +>>>>>>> c76e7efd28210f45737b5afbdddff2712b2c0cc7 }; }