Merge pull request 'hamburgre' (#26) from React-Group/interstellar_ai:main into main

Reviewed-on: https://interstellardevelopment.org/code/code/sageTheDm/interstellar_ai/pulls/26
This commit is contained in:
Patrick 2024-09-30 08:45:34 +02:00
commit 76027180b4
5 changed files with 40 additions and 27 deletions

View file

@ -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()

View file

@ -43,7 +43,7 @@ const Header: React.FC<HeaderProps> = ({ onViewChange, showDivs, toggleDivs, sho
<div className="header-button header-logo"> <div className="header-button header-logo">
{/* AI logo or text */} {/* AI logo or text */}
</div> </div>
<div className="login-button"> <div className="login-button-container">
<Login /> <Login />
</div> </div>
</header> </header>

View file

@ -40,7 +40,7 @@ const InputFrontend = React.forwardRef<HTMLDivElement, InputProps>(
<button type="button" onClick={() => onSendClick(inputValue, false)} disabled={inputDisabled ? true : false}> <button type="button" onClick={() => onSendClick(inputValue, false)} disabled={inputDisabled ? true : false}>
<img src="/img/send.svg" alt="send" /> <img src="/img/send.svg" alt="send" />
</button> </button>
<button className={`microphone-button ${isRecording ? "red":"green"}`} type="button" onClick={onMicClick}> <button className={`microphone-button ${isRecording ? "red": "var(--input-button-color)"}`} type="button" onClick={onMicClick}>
<img src="/img/microphone.svg" alt="microphone" /> <img src="/img/microphone.svg" alt="microphone" />
</button> </button>
</div> </div>

View file

@ -1,3 +1,4 @@
"use client";
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
// Define the available model options // Define the available model options
@ -18,9 +19,10 @@ const modelDropdown = {
const Models: React.FC = () => { const Models: React.FC = () => {
// Initialize state with value from localStorage or default to '' // Initialize state with value from localStorage or default to ''
const [selectedModel, setSelectedModel] = useState(''); const [selectedModel, setSelectedModel] = useState('');
const radioSelection = localStorage.getItem('radioSelection') const [radioSelection, setRadioSelection] = useState<string | null>("")
useEffect(() => { useEffect(() => {
setRadioSelection(localStorage.getItem('radioSelection'))
const handleStorageChange = () => { const handleStorageChange = () => {
setSelectedModel(localStorage.getItem('selectedModel') || ''); setSelectedModel(localStorage.getItem('selectedModel') || '');
}; };

View file

@ -40,16 +40,23 @@ header{
.nav-links{ .nav-links{
position: absolute; position: absolute;
display: flex; display: flex;
top: 2vh;
gap: 1em; gap: 1em;
width: 25em; width: 35vw;
height: 2em; height: 100%;
align-items: center;
} }
.nav-btn{ .nav-btn{
background-color: transparent; background-color: var(--input-button-color);
border: none; border: none;
font-size: 0.9em; font-size: 0.9em;
height: 50%;
border-radius: 5px;
padding: 1px 15px;
}
.nav-btn:hover{
background-color: var(--input-button-hover-color);
} }
.header-logo{ .header-logo{
@ -64,7 +71,13 @@ header{
border: none; border: none;
} }
.login-button .header-login-button{ .login-button-container{
height: 100%;
display: flex;
align-items: center;
}
.header-login-button{
font-size: 2vh; font-size: 2vh;
position: absolute; position: absolute;
top: 1.5vh; top: 1.5vh;
@ -78,6 +91,6 @@ header{
transition: background-color 0.3s; transition: background-color 0.3s;
} }
.login-button button:hover { .header-login-button:hover {
background-color: var(--input-button-hover-color); background-color: var(--input-button-hover-color);
} }