forked from React-Group/interstellar_ai
fixed localStorage access for system-prompt
This commit is contained in:
parent
f1cf2e1e7a
commit
bd4e3af47f
1 changed files with 15 additions and 17 deletions
|
@ -17,12 +17,21 @@ const InputOutputBackend: React.FC = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Variables for System-prompt */
|
/* Variables for System-prompt */
|
||||||
const [preferredCurrency, setPreferredCurrency] = useState(localStorage.getItem("preferredCurrency") || "")
|
const [preferredCurrency, setPreferredCurrency] = useState<string | null>("")
|
||||||
const [preferredLanguage, setPreferredLanguage] = useState(localStorage.getItem("preferredLanguage") || "")
|
const [preferredLanguage, setPreferredLanguage] = useState<string | null>("")
|
||||||
const [timeFormat, setTimeFormat] = useState(localStorage.getItem("timeFormat") || "")
|
const [timeFormat, setTimeFormat] = useState<string | null>("")
|
||||||
const [preferredMeasurement, setPreferredMeasurement] = useState(localStorage.getItem("preferredMeasurement") || "")
|
const [preferredMeasurement, setPreferredMeasurement] = useState<string | null>("")
|
||||||
const [timeZone, setTimeZone] = useState(localStorage.getItem("timeZone") || "")
|
const [timeZone, setTimeZone] = useState<string | null>("")
|
||||||
const [dateFormat, setDateFormat] = useState(localStorage.getItem("dateFormat") || "")
|
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 [copyClicked, setCopyClicked] = useState(false)
|
||||||
const [accessToken, setAccessToken] = useState("")
|
const [accessToken, setAccessToken] = useState("")
|
||||||
|
@ -41,7 +50,6 @@ const InputOutputBackend: React.FC = () => {
|
||||||
const [inputMessage, setInputMessage] = useState<string>("")
|
const [inputMessage, setInputMessage] = useState<string>("")
|
||||||
const [inputDisabled, setInputDisabled] = useState(false)
|
const [inputDisabled, setInputDisabled] = useState(false)
|
||||||
const [isRecording, setIsRecording] = useState(false)
|
const [isRecording, setIsRecording] = useState(false)
|
||||||
const [audioURL, setAudioURL] = useState<string | null>(null)
|
|
||||||
const mediaRecorderRef = useRef<MediaRecorder | null>(null)
|
const mediaRecorderRef = useRef<MediaRecorder | null>(null)
|
||||||
const audioChunks = useRef<Blob[]>([])
|
const audioChunks = useRef<Blob[]>([])
|
||||||
|
|
||||||
|
@ -189,16 +197,6 @@ const InputOutputBackend: React.FC = () => {
|
||||||
mediaRecorder.start()
|
mediaRecorder.start()
|
||||||
setIsRecording(true)
|
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 = () => {
|
const stopRecording = () => {
|
||||||
mediaRecorderRef.current?.stop()
|
mediaRecorderRef.current?.stop()
|
||||||
|
|
Loading…
Reference in a new issue