fixed localStorage access for system-prompt

This commit is contained in:
YasinOnm08 2024-09-30 08:44:19 +02:00
parent f1cf2e1e7a
commit bd4e3af47f

View file

@ -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<string | null>("")
const [preferredLanguage, setPreferredLanguage] = useState<string | null>("")
const [timeFormat, setTimeFormat] = useState<string | null>("")
const [preferredMeasurement, setPreferredMeasurement] = useState<string | null>("")
const [timeZone, setTimeZone] = useState<string | null>("")
const [dateFormat, setDateFormat] = useState<string | null>("")
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<string>("")
const [inputDisabled, setInputDisabled] = useState(false)
const [isRecording, setIsRecording] = useState(false)
const [audioURL, setAudioURL] = useState<string | null>(null)
const mediaRecorderRef = useRef<MediaRecorder | null>(null)
const audioChunks = useRef<Blob[]>([])
@ -189,16 +197,6 @@ const InputOutputBackend: React.FC = () => {
mediaRecorder.start()
setIsRecording(true)
}
const ffmpegRef = useRef<FFmpeg | null>(null)
const audioRef = useRef("")
const loadFFmpeg = async () => {
if (!ffmpegRef.current) {
ffmpegRef.current = new FFmpeg()
await ffmpegRef.current.load()
}
}
const stopRecording = () => {
mediaRecorderRef.current?.stop()