diff --git a/app/[docs_id]/chatForm.tsx b/app/[docs_id]/chatForm.tsx index 0b86077..acaaa7a 100644 --- a/app/[docs_id]/chatForm.tsx +++ b/app/[docs_id]/chatForm.tsx @@ -10,6 +10,7 @@ export function ChatForm() { const [inputValue, setInputValue] = useState(""); const [response, setResponse] = useState(""); const [isLoading, setIsLoading] = useState(false); + const [isFormVisible, setIsFormVisible] = useState(false); const handleSubmit = async (e: FormEvent) => { e.preventDefault(); @@ -42,111 +43,38 @@ export function ChatForm() { }; return ( <> - - -
-
+ {isFormVisible && ( + +

+ AIへ質問 +

+
-
-
+
+
+
+ +
- {response &&
{response}
} + )} + {!isFormVisible && ( + + )} + + {response && ( +
+

AIの回答

+
+
+
{response}
+
+
+
+ )} + + {isLoading && ( +
+ AIが考え中です… +
+ )} + ); }