diff --git a/src/components/layout/InputPrompt.js b/src/components/layout/InputPrompt.js index d17a5f6..b1d52e5 100644 --- a/src/components/layout/InputPrompt.js +++ b/src/components/layout/InputPrompt.js @@ -2,76 +2,76 @@ import React, { useState } from 'react'; import { HiOutlineTrash, HiOutlineAnnotation } from "react-icons/hi"; const InputPrompt = ({ onSend, onClear }) => { - const [prompt, setPrompt] = useState(''); - const [isComposing, setIsComposing] = useState(false); + const [prompt, setPrompt] = useState(''); + const [isComposing, setIsComposing] = useState(false); - const handleChange = (e) => { - setPrompt(e.target.value); - }; + const handleChange = (e) => { + setPrompt(e.target.value); + }; - const handleCompositionStart = () => { - setIsComposing(true); - }; + const handleCompositionStart = () => { + setIsComposing(true); + }; - const handleCompositionEnd = () => { - setIsComposing(false); - }; + const handleCompositionEnd = () => { + setIsComposing(false); + }; - const handleKeyDown = (e) => { - if (!isComposing && e.key === 'Enter' && !e.shiftKey) { - e.preventDefault(); - handleSend(); - } - }; + const handleKeyDown = (e) => { + if (!isComposing && e.key === 'Enter' && !e.shiftKey) { + e.preventDefault(); + handleSend(); + } + }; - const handleSend = () => { - if (prompt.trim() === '') return; - onSend(prompt); - setPrompt(''); - }; + const handleSend = () => { + if (prompt.trim() === '') return; + onSend(prompt); + setPrompt(''); + }; - const handleClear = () => { - const confirmed = window.confirm('确定要清空消息记录吗?'); - if (confirmed) { - onClear(); - } - }; + const handleClear = () => { + const confirmed = window.confirm('确定要清空消息记录吗?'); + if (confirmed) { + onClear(); + } + }; - return ( -
-
-
- -