From d9fc9cd198e8e090907c7109bd31326eae85ef3e Mon Sep 17 00:00:00 2001
From: angular-moon <xiaoxuss@gmail.com>
Date: Thu, 30 Mar 2023 10:16:00 +0800
Subject: [PATCH] onUserSubmit hide promptHints

---
 app/components/home.tsx | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/app/components/home.tsx b/app/components/home.tsx
index a44e5f16..10f58ebe 100644
--- a/app/components/home.tsx
+++ b/app/components/home.tsx
@@ -102,7 +102,7 @@ export function ChatList() {
       state.currentSessionIndex,
       state.selectSession,
       state.removeSession,
-    ],
+    ]
   );
 
   return (
@@ -196,7 +196,7 @@ export function Chat(props: {
       setPromptHints(promptStore.search(text));
     },
     100,
-    { leading: true, trailing: true },
+    { leading: true, trailing: true }
   );
 
   const onPromptSelect = (prompt: Prompt) => {
@@ -210,7 +210,7 @@ export function Chat(props: {
     if (!dom) return;
     const paddingBottomNum: number = parseInt(
       window.getComputedStyle(dom).paddingBottom,
-      10,
+      10
     );
     dom.scrollTop = dom.scrollHeight - dom.offsetHeight + paddingBottomNum;
   };
@@ -239,6 +239,7 @@ export function Chat(props: {
     setIsLoading(true);
     chatStore.onUserInput(userInput).then(() => setIsLoading(false));
     setUserInput("");
+    setPromptHints([]);
     inputRef.current?.focus();
   };
 
@@ -299,7 +300,7 @@ export function Chat(props: {
               preview: true,
             },
           ]
-        : [],
+        : []
     )
     .concat(
       userInput.length > 0
@@ -311,7 +312,7 @@ export function Chat(props: {
               preview: true,
             },
           ]
-        : [],
+        : []
     );
 
   // auto scroll
@@ -339,7 +340,7 @@ export function Chat(props: {
               const newTopic = prompt(Locale.Chat.Rename, session.topic);
               if (newTopic && newTopic !== session.topic) {
                 chatStore.updateCurrentSession(
-                  (session) => (session.topic = newTopic!),
+                  (session) => (session.topic = newTopic!)
                 );
               }
             }}
@@ -584,7 +585,7 @@ export function Home() {
       state.newSession,
       state.currentSessionIndex,
       state.removeSession,
-    ],
+    ]
   );
   const loading = !useHasHydrated();
   const [showSideBar, setShowSideBar] = useState(true);