diff --git a/src/renderer/components/Experiment/Export/Export.tsx b/src/renderer/components/Experiment/Export/Export.tsx index 97a103f4..c175d857 100644 --- a/src/renderer/components/Experiment/Export/Export.tsx +++ b/src/renderer/components/Experiment/Export/Export.tsx @@ -12,16 +12,6 @@ import { ClockIcon, } from 'lucide-react'; -// run an exporter plugin on the current experiment's model -function exportRun( - experimentId: string, - plugin: string -) { - return fetch( - chatAPI.Endpoints.Experiment.RunExport(experimentId, plugin) - ); -} - // fetcher used by SWR const fetcher = (url) => fetch(url).then((res) => res.json()); @@ -66,6 +56,16 @@ export default function Export({experimentInfo}) { && supported_architectures.includes(experimentInfo?.config?.foundation_model_architecture); } + // run an exporter plugin on the current experiment's model + async function exportRun(experiment_id: string, plugin_id: string) { + setJobId(-1); + const response = await fetch(chatAPI.Endpoints.Experiment.RunExport(experiment_id, plugin_id)); + + // If we want to track job details we can get this from response + // But as long as jobId isn't < 0 the spinner on the export button will stop + setJobId(null); + } + return ( <> @@ -74,7 +74,6 @@ export default function Export({experimentInfo}) { setJobId={setViewExportDetails} /> -{/** Temporarily disable plugin settings modal until testing complete { @@ -83,10 +82,10 @@ export default function Export({experimentInfo}) { setPluginModalOpen(false); //mutate(); }} + onSubmit={exportRun} experimentInfo = {experimentInfo} pluginId = {selectedPlugin} /> -*/} { - setJobId(-1); setSelectedPlugin(row.uniqueId); setPluginModalOpen(true); // Currently this call blocks until the export is done - const response = await exportRun( - experimentInfo.id, - row.uniqueId - ); - - // If we want to track job details we can get this from response - // But as long as jobId isn't < 0 the spinner on the export button will stop - setJobId(null); + // const response = await exportRun(experimentInfo.id, row.uniqueId); }} disabled={!isModelValidArchitecture(row.model_architectures)} > diff --git a/src/renderer/components/Experiment/Export/PluginSettingsModal.tsx b/src/renderer/components/Experiment/Export/PluginSettingsModal.tsx index ddff4cd8..9ff80f61 100644 --- a/src/renderer/components/Experiment/Export/PluginSettingsModal.tsx +++ b/src/renderer/components/Experiment/Export/PluginSettingsModal.tsx @@ -40,7 +40,13 @@ function defaultOutputModelName(input_model_name, plugin_info) { return input_model_name + plugin_info; } -export default function PluginSettingsModal({ open, onClose, experimentInfo, pluginId }) { +/** + * PluginSettingsModal + * open is a boolean stored in state by Export to know if this modal is open + * onClose is a function that gets executed anytime this modal gets closed (cancel or submit) + * onSubmit is a function that gets executed only when this form is submitted + */ +export default function PluginSettingsModal({ open, onClose, onSubmit, experimentInfo, pluginId }) { const [selectedPlugin, setSelectedPlugin] = useState(null); const [config, setConfig] = useState(DefaultPluginConfig); @@ -74,13 +80,10 @@ export default function PluginSettingsModal({ open, onClose, experimentInfo, plu }} onSubmit={(event: FormEvent) => { event.preventDefault(); - const formData = new FormData(event.currentTarget); - const formJson = Object.fromEntries((formData as any).entries()); - /**chatAPI.RunExport( - experimentInfo?.id, - pluginId, - JSON.stringify(formJson) - );*/ + const form_data = new FormData(event.currentTarget); + const form_json = Object.fromEntries((form_data as any).entries()); + + onSubmit(experimentInfo.id, pluginId); onClose(); }} >