import { useState, useEffect } from "react"; import System from "@/models/system"; export default function MistralOptions({ settings }) { const [inputValue, setInputValue] = useState(settings?.MistralApiKey); const [mistralKey, setMistralKey] = useState(settings?.MistralApiKey); return (
setInputValue(e.target.value)} onBlur={() => setMistralKey(inputValue)} />
{!settings?.credentialsOnly && ( )}
); } function MistralModelSelection({ apiKey, settings }) { const [customModels, setCustomModels] = useState([]); const [loading, setLoading] = useState(true); useEffect(() => { async function findCustomModels() { if (!apiKey) { setCustomModels([]); setLoading(false); return; } setLoading(true); const { models } = await System.customModels( "mistral", typeof apiKey === "boolean" ? null : apiKey ); setCustomModels(models || []); setLoading(false); } findCustomModels(); }, [apiKey]); if (loading || customModels.length == 0) { return (
); } return (
); }