diff --git a/src/components/ChatWindow.tsx b/src/components/ChatWindow.tsx index 47bbab2..0c956e8 100644 --- a/src/components/ChatWindow.tsx +++ b/src/components/ChatWindow.tsx @@ -343,30 +343,6 @@ const ChatWindow = ({ id }: { id?: string }) => { messageId = messageId ?? crypto.randomBytes(7).toString('hex'); - console.log( - JSON.stringify({ - content: message, - message: { - messageId: messageId, - chatId: chatId!, - content: message, - }, - chatId: chatId!, - files: fileIds, - focusMode: focusMode, - optimizationMode: optimizationMode, - history: chatHistory, - chatModel: { - name: chatModelProvider.name, - provider: chatModelProvider.provider, - }, - embeddingModel: { - name: embeddingModelProvider.name, - provider: embeddingModelProvider.provider, - }, - }), - ); - setMessages((prevMessages) => [ ...prevMessages, { @@ -445,6 +421,21 @@ const ChatWindow = ({ id }: { id?: string }) => { const lastMsg = messagesRef.current[messagesRef.current.length - 1]; + const autoImageSearch = localStorage.getItem('autoImageSearch'); + const autoVideoSearch = localStorage.getItem('autoVideoSearch'); + + if (autoImageSearch === 'true') { + document + .getElementById(`search-images-${lastMsg.messageId}`) + ?.click(); + } + + if (autoVideoSearch === 'true') { + document + .getElementById(`search-videos-${lastMsg.messageId}`) + ?.click(); + } + if ( lastMsg.role === 'assistant' && lastMsg.sources && @@ -461,21 +452,6 @@ const ChatWindow = ({ id }: { id?: string }) => { }), ); } - - const autoImageSearch = localStorage.getItem('autoImageSearch'); - const autoVideoSearch = localStorage.getItem('autoVideoSearch'); - - if (autoImageSearch === 'true') { - document - .getElementById(`search-images-${lastMsg.messageId}`) - ?.click(); - } - - if (autoVideoSearch === 'true') { - document - .getElementById(`search-videos-${lastMsg.messageId}`) - ?.click(); - } } };