diff --git a/app/backend/InputOutputHandler.tsx b/app/backend/InputOutputHandler.tsx index 47a6e1f..4fa0042 100644 --- a/app/backend/InputOutputHandler.tsx +++ b/app/backend/InputOutputHandler.tsx @@ -17,12 +17,21 @@ const InputOutputBackend: React.FC = () => { } /* Variables for System-prompt */ - const [preferredCurrency, setPreferredCurrency] = useState(localStorage.getItem("preferredCurrency") || "") - const [preferredLanguage, setPreferredLanguage] = useState(localStorage.getItem("preferredLanguage") || "") - const [timeFormat, setTimeFormat] = useState(localStorage.getItem("timeFormat") || "") - const [preferredMeasurement, setPreferredMeasurement] = useState(localStorage.getItem("preferredMeasurement") || "") - const [timeZone, setTimeZone] = useState(localStorage.getItem("timeZone") || "") - const [dateFormat, setDateFormat] = useState(localStorage.getItem("dateFormat") || "") + const [preferredCurrency, setPreferredCurrency] = useState("") + const [preferredLanguage, setPreferredLanguage] = useState("") + const [timeFormat, setTimeFormat] = useState("") + const [preferredMeasurement, setPreferredMeasurement] = useState("") + const [timeZone, setTimeZone] = useState("") + const [dateFormat, setDateFormat] = useState("") + + useEffect(() => { + setPreferredCurrency(localStorage.getItem("preferredCurrency")) + setPreferredLanguage(localStorage.getItem("preferredLanguage")) + setTimeFormat(localStorage.getItem("timeFormat")) + setPreferredMeasurement(localStorage.getItem("preferredMeasurement")) + setTimeZone(localStorage.getItem("timeZone")) + setDateFormat(localStorage.getItem("dateFormat")) + }) const [copyClicked, setCopyClicked] = useState(false) const [accessToken, setAccessToken] = useState("") @@ -41,7 +50,6 @@ const InputOutputBackend: React.FC = () => { const [inputMessage, setInputMessage] = useState("") const [inputDisabled, setInputDisabled] = useState(false) const [isRecording, setIsRecording] = useState(false) - const [audioURL, setAudioURL] = useState(null) const mediaRecorderRef = useRef(null) const audioChunks = useRef([]) @@ -189,16 +197,6 @@ const InputOutputBackend: React.FC = () => { mediaRecorder.start() setIsRecording(true) } - - const ffmpegRef = useRef(null) - const audioRef = useRef("") - - const loadFFmpeg = async () => { - if (!ffmpegRef.current) { - ffmpegRef.current = new FFmpeg() - await ffmpegRef.current.load() - } - } const stopRecording = () => { mediaRecorderRef.current?.stop()