From 304c79130ec45bbfe0c32635f4cce8e6b8e01473 Mon Sep 17 00:00:00 2001
From: ali asaria <aliasaria@users.noreply.github.com>
Date: Mon, 10 Feb 2025 09:53:01 -0500
Subject: [PATCH] make it clear when you need to install an inference engine

---
 .../Experiment/Foundation/RunModelButton.tsx  | 30 +++++++++++++++++--
 1 file changed, 27 insertions(+), 3 deletions(-)

diff --git a/src/renderer/components/Experiment/Foundation/RunModelButton.tsx b/src/renderer/components/Experiment/Foundation/RunModelButton.tsx
index d200c625..de051243 100644
--- a/src/renderer/components/Experiment/Foundation/RunModelButton.tsx
+++ b/src/renderer/components/Experiment/Foundation/RunModelButton.tsx
@@ -1,5 +1,11 @@
-import { Button, CircularProgress } from '@mui/joy';
-import { PlayCircleIcon, StopCircleIcon } from 'lucide-react';
+import { Alert, Button, CircularProgress, Typography } from '@mui/joy';
+import {
+  InfoIcon,
+  PlayCircleIcon,
+  Plug2Icon,
+  StopCircleIcon,
+  TriangleAlertIcon,
+} from 'lucide-react';
 import { useEffect, useState } from 'react';
 
 import { activateWorker } from 'renderer/lib/transformerlab-api-sdk';
@@ -10,6 +16,8 @@ import OneTimePopup from 'renderer/components/Shared/OneTimePopup';
 
 const fetcher = (url) => fetch(url).then((res) => res.json());
 
+import { Link } from 'react-router-dom';
+
 function removeServerFromEndOfString(str) {
   if (str == null) {
     return null;
@@ -187,7 +195,23 @@ export default function RunModelButton({
       {/* {jobId} */}
       {/* {JSON.stringify(experimentInfo)} */}
       {/* {JSON.stringify(inferenceSettings)} */}
-      <Engine />
+      {isPossibleToRunAModel() ? (
+        <Engine />
+      ) : (
+        <Alert startDecorator={<TriangleAlertIcon />} color="warning" size="lg">
+          <Typography>
+            You do not have an installed Inference Engine that is compatible
+            with this model. Go to{' '}
+            <Link to="/projects/plugins">
+              <Plug2Icon size="15px" />
+              Plugins
+            </Link>{' '}
+            and install an Inference Engine. <b>FastChat Server</b> is a good
+            default for systems with a GPU. <b>Apple MLX Server</b> is the best
+            default for MacOS with Apple Silicon.
+          </Typography>
+        </Alert>
+      )}
       <InferenceEngineModal
         showModal={showRunSettings}
         setShowModal={setShowRunSettings}
-- 
GitLab