From f98235a1d804a2d5255b56f2da381a3922ed98e2 Mon Sep 17 00:00:00 2001 From: Deep Date: Mon, 12 Aug 2024 11:21:57 -0400 Subject: [PATCH] style: Remove console.log statements and unused code --- src/components/messages/ai/ai-related-questions.tsx | 1 - src/components/messages/recent-message.tsx | 9 +++++++++ src/components/welcome-message/opensource-copy.tsx | 2 +- src/helper/animations.tsx | 4 +--- src/hooks/use-editor.tsx | 1 - src/hooks/use-image-attachment.tsx | 1 - 6 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/components/messages/ai/ai-related-questions.tsx b/src/components/messages/ai/ai-related-questions.tsx index 5694dfa..539ba3f 100644 --- a/src/components/messages/ai/ai-related-questions.tsx +++ b/src/components/messages/ai/ai-related-questions.tsx @@ -26,7 +26,6 @@ export const AIRelatedQuestions: FC = ({ const { invokeModel } = useLLMRunner(); const handleOnClick = (question: string) => { - console.log("question", question); const assistant = preferences.defaultAssistant; const props = getAssistantByKey(assistant); diff --git a/src/components/messages/recent-message.tsx b/src/components/messages/recent-message.tsx index dac9eb9..6417fa0 100644 --- a/src/components/messages/recent-message.tsx +++ b/src/components/messages/recent-message.tsx @@ -10,6 +10,9 @@ export const RecentMessage = () => { const { store } = useChatContext(); const currentMessage = store((state) => state.currentMessage); const isGenerating = store((state) => state.isGenerating); + const prevMessagesIds = store((state) => + state.messages.map((message) => message.id), + ); const setIsGenerating = store((state) => state.setIsGenerating); const setCurrentMessage = store((state) => state.setCurrentMessage); const { generateTitleForSession } = useTitleGenerator(); @@ -17,6 +20,12 @@ export const RecentMessage = () => { const { addMessageMutation } = useSessions(); const { isAtBottom, scrollToBottom } = useScrollToBottom(); + useEffect(() => { + if (currentMessage?.id && prevMessagesIds?.includes(currentMessage?.id)) { + setCurrentMessage(undefined); + } + }, [currentMessage?.id, prevMessagesIds?.length]); + useEffect(() => { if ( !currentMessage || diff --git a/src/components/welcome-message/opensource-copy.tsx b/src/components/welcome-message/opensource-copy.tsx index dfd59b5..32bffa8 100644 --- a/src/components/welcome-message/opensource-copy.tsx +++ b/src/components/welcome-message/opensource-copy.tsx @@ -9,7 +9,7 @@ export const OpenSourceCopy = () => { return ( <> We're shipping new features every week. Check out{" "} - + what's coming {" "} or{" "} diff --git a/src/helper/animations.tsx b/src/helper/animations.tsx index 6b43a1a..a92131b 100644 --- a/src/helper/animations.tsx +++ b/src/helper/animations.tsx @@ -1,10 +1,8 @@ export const REVEAL_ANIMATION_VARIANTS = { - hidden: { opacity: 0, filter: "blur(1px)", y: -10 }, + hidden: { opacity: 0 }, visible: { opacity: 1, y: 0, - filter: "blur(0px)", - backgroundColor: "transparent", transition: { duration: 1, ease: "easeIn", diff --git a/src/hooks/use-editor.tsx b/src/hooks/use-editor.tsx index 7c0cc12..92bd428 100644 --- a/src/hooks/use-editor.tsx +++ b/src/hooks/use-editor.tsx @@ -39,7 +39,6 @@ export const useChatEditor = () => { const { editor } = props; const text = editor.getText(); const html = editor.getHTML(); - console.log("text", html); if (text === "/") { // setOpenPromptsBotCombo(true); } else { diff --git a/src/hooks/use-image-attachment.tsx b/src/hooks/use-image-attachment.tsx index 5e9ac90..d22ed46 100644 --- a/src/hooks/use-image-attachment.tsx +++ b/src/hooks/use-image-attachment.tsx @@ -29,7 +29,6 @@ export const useImageAttachment = () => { const [attachment, setAttachment] = useState(); const onDrop = useCallback((acceptedFiles: File[]) => { - console.log("ACCEPTED FILES", acceptedFiles); const file = acceptedFiles?.[0]; readImageFile(file); }, []);