forked from React-Group/interstellar_ai
HelloWorld
This commit is contained in:
parent
9100b0c0f4
commit
ce4dac8227
1 changed files with 20 additions and 16 deletions
|
@ -154,15 +154,15 @@ const modelDropdown = {
|
||||||
};
|
};
|
||||||
|
|
||||||
const selectedAIFunction = [
|
const selectedAIFunction = [
|
||||||
'Code',
|
'Code',
|
||||||
'Math',
|
'Math',
|
||||||
'Language',
|
'Language',
|
||||||
'Character',
|
'Character',
|
||||||
'Finance',
|
'Finance',
|
||||||
'Weather',
|
'Weather',
|
||||||
'Time',
|
'Time',
|
||||||
'Image',
|
'Image',
|
||||||
'Custom1',
|
'Custom1',
|
||||||
'Custom2'
|
'Custom2'
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -172,25 +172,29 @@ const ModelSection: React.FC = () => {
|
||||||
const [radioSelection, setRadioSelection] = useState<string | null>("")
|
const [radioSelection, setRadioSelection] = useState<string | null>("")
|
||||||
const [activeSelectedAIFunction, setActiveSelectedAIFunction] = useState('');
|
const [activeSelectedAIFunction, setActiveSelectedAIFunction] = useState('');
|
||||||
const [currentSelectedAIFunction, setCurrentSelectedAIFunction] = useState<string | null>("");
|
const [currentSelectedAIFunction, setCurrentSelectedAIFunction] = useState<string | null>("");
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
var temp = localStorage.getItem("activeSelectedAIFunction") || ""
|
var temp = localStorage.getItem("activeSelectedAIFunction") || ""
|
||||||
setActiveSelectedAIFunction(temp)
|
setActiveSelectedAIFunction(temp)
|
||||||
if (!localStorage.getItem('selectedModelDropdown')) {
|
if (!localStorage.getItem('selectedModelDropdown')) {
|
||||||
localStorage.setItem("selectedModelDropdown", "Offline Fast" )
|
localStorage.setItem("selectedModelDropdown", "Offline Fast")
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!localStorage.getItem("activeSelectedAIFunction")) {
|
if (!localStorage.getItem("activeSelectedAIFunction")) {
|
||||||
setActiveSelectedAIFunction('Code')
|
setActiveSelectedAIFunction('Code')
|
||||||
localStorage.setItem('activeSelectedAIFunction' ,'Code')
|
localStorage.setItem('activeSelectedAIFunction', 'Code')
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!localStorage.getItem("model")) {
|
if (!localStorage.getItem("model")) {
|
||||||
localStorage.setItem("model" ,'starcoder2')
|
localStorage.setItem("model", 'starcoder2')
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!localStorage.getItem("radioSelection")) {
|
if (!localStorage.getItem("radioSelection")) {
|
||||||
localStorage.setItem("radioSelection" ,'None')
|
localStorage.setItem("radioSelection", 'None')
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!localStorage.getItem("type")) {
|
||||||
|
localStorage.setItem("type", 'local')
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleStorageChange = () => {
|
const handleStorageChange = () => {
|
||||||
|
@ -277,7 +281,7 @@ const ModelSection: React.FC = () => {
|
||||||
modelDropdown.offlineNonFoss.includes(model) || modelDropdown.offlineFoss.includes(model);
|
modelDropdown.offlineNonFoss.includes(model) || modelDropdown.offlineFoss.includes(model);
|
||||||
|
|
||||||
const modelClicked = (model: string) => {
|
const modelClicked = (model: string) => {
|
||||||
localStorage.setItem('activeSelectedAIFunction' , model)
|
localStorage.setItem('activeSelectedAIFunction', model)
|
||||||
setActiveSelectedAIFunction(model)
|
setActiveSelectedAIFunction(model)
|
||||||
const selectedAIFunction = selectedModelDropdown as keyof typeof modelList;
|
const selectedAIFunction = selectedModelDropdown as keyof typeof modelList;
|
||||||
localStorage.setItem("model", modelList[selectedAIFunction][model as keyof typeof modelList[typeof selectedAIFunction]])
|
localStorage.setItem("model", modelList[selectedAIFunction][model as keyof typeof modelList[typeof selectedAIFunction]])
|
||||||
|
@ -309,7 +313,7 @@ const ModelSection: React.FC = () => {
|
||||||
(displayedCategory) => (
|
(displayedCategory) => (
|
||||||
<button
|
<button
|
||||||
key={displayedCategory}
|
key={displayedCategory}
|
||||||
className={`${displayedCategory.toLowerCase()}-model model-box ${currentSelectedAIFunction === displayedCategory ? 'selected' : ''}`}
|
className={`${displayedCategory.toLowerCase()}-model model-box ${currentSelectedAIFunction === displayedCategory ? 'selected' : ''}`}
|
||||||
onClick={() => modelClicked(displayedCategory)}
|
onClick={() => modelClicked(displayedCategory)}
|
||||||
>
|
>
|
||||||
<div className="overlay">
|
<div className="overlay">
|
||||||
|
|
Loading…
Reference in a new issue