diff --git a/frontend/src/components/gpt_page/main_content/MainContent.jsx b/frontend/src/components/gpt_page/main_content/MainContent.jsx index cf6222d..9b10017 100644 --- a/frontend/src/components/gpt_page/main_content/MainContent.jsx +++ b/frontend/src/components/gpt_page/main_content/MainContent.jsx @@ -102,9 +102,9 @@ const MainContent = () => { // Function for CreatorChat submission const onCreatorChatSubmit = useCallback( - (query) => { + async (query) => { let fullUrl = `${window.location.origin}${window.location.pathname}?query=${encodeURIComponent(query)}`; - generateShortUrl(fullUrl); // Call without awaiting + await generateShortUrl(fullUrl); setLlmQuery(query); setIsCreatorChatSubmitted(true); // Do not start countdown; set static response @@ -120,10 +120,10 @@ const MainContent = () => { // Updated handleSendMessage function const handleSendMessage = useCallback( - (message) => { + async (message) => { console.log(`MainContent: User sent message: ${message}`); let fullUrl = `${window.location.origin}${window.location.pathname}?query=${encodeURIComponent(message)}`; - generateShortUrl(fullUrl); // Call without awaiting + await generateShortUrl(fullUrl); setLlmQuery(message); setLlmResponse(''); setIsAnimationChatDoneAnimating(true);