production ready changes
This commit is contained in:
parent
4342e9a269
commit
8ec93d4f1c
1 changed files with 11 additions and 5 deletions
|
@ -107,14 +107,20 @@ const aiFunctions = ['Math', 'Code', 'Language', 'Weather'] as const;
|
|||
type AIFunction = typeof aiFunctions[number]; // Restrict to these exact function names
|
||||
|
||||
const ModelSection: React.FC = () => {
|
||||
const [selectedModelDropdown, setSelectedModelDropdown] = useState<string>(() => localStorage.getItem("selectedModelDropdown") || "Offline Fast");
|
||||
const [activeSelectedAIFunction, setActiveSelectedAIFunction] = useState<AIFunction>(() => (localStorage.getItem("activeSelectedAIFunction") as AIFunction) || "Code");
|
||||
const [selectedModel, setSelectedModel] = useState<string>("");
|
||||
const [selectedModelType, setSelectedModelType] = useState<string>("");
|
||||
const [selectedModelDropdown, setSelectedModelDropdown] = useState(() => "Offline Fast");
|
||||
const [activeSelectedAIFunction, setActiveSelectedAIFunction] = useState(() => "Code");
|
||||
const [, setSelectedModel] = useState<string>("");
|
||||
const [, setSelectedModelType] = useState<string>("");
|
||||
|
||||
useEffect(() => {
|
||||
setSelectedModelDropdown(localStorage.getItem("selectedModelDropdown")|| "Offline Fast");
|
||||
setActiveSelectedAIFunction(localStorage.getItem("activeSelectedAIFunction") || "Code");
|
||||
}, []);
|
||||
|
||||
// Update the model and type when the dropdown or function changes
|
||||
useEffect(() => {
|
||||
const newSelectedModel = modelList[selectedModelDropdown]?.[activeSelectedAIFunction] || "";
|
||||
const aiFunctionsActiveSelectedAIFunction = activeSelectedAIFunction as AIFunction
|
||||
const newSelectedModel = modelList[selectedModelDropdown]?.[aiFunctionsActiveSelectedAIFunction] || "";
|
||||
const newModelType = modelList[selectedModelDropdown]?.model_type || "";
|
||||
|
||||
setSelectedModel(newSelectedModel);
|
||||
|
|
Loading…
Reference in a new issue