Skip to content
This repository was archived by the owner on Oct 14, 2024. It is now read-only.

Commit b6fc31a

Browse files
committed
chore: wip update engine
1 parent eba15e5 commit b6fc31a

File tree

7 files changed

+220
-157
lines changed

7 files changed

+220
-157
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,4 @@
7171
"node": ">=18.0"
7272
},
7373
"packageManager": "[email protected]+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
74-
}
74+
}

src/containers/EngineCompatibility/index.tsx

Lines changed: 46 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import { useState } from "react";
1+
import { useCallback, useEffect, useState } from "react";
22
import { twMerge } from "tailwind-merge";
3+
import { FaWindows, FaApple, FaLinux } from "react-icons/fa";
34

45
const EngineCompatibility = () => {
56
const [Compatibility, setCompatibility] = useState({
@@ -17,14 +18,17 @@ const EngineCompatibility = () => {
1718
{
1819
name: "Windows",
1920
value: "win",
21+
logo: FaWindows,
2022
},
2123
{
2224
name: "Mac",
2325
value: "mac",
26+
logo: FaApple,
2427
},
2528
{
2629
name: "Linux",
2730
value: "linux",
31+
logo: FaLinux,
2832
},
2933
],
3034
},
@@ -62,7 +66,7 @@ const EngineCompatibility = () => {
6266
{
6367
name: "Apple Metal",
6468
value: "apple",
65-
disabled: Compatibility.os !== "mac",
69+
disabled: Compatibility.os !== "mac" || Compatibility.cpu === "amd",
6670
},
6771
{
6872
name: "Snapdragon NPU",
@@ -127,6 +131,8 @@ const EngineCompatibility = () => {
127131
},
128132
];
129133

134+
// console.log(Compatibility);
135+
130136
const handleClick = (level: string, value: string, disabled: boolean) => {
131137
if (disabled) return;
132138
setCompatibility((prev) => {
@@ -147,7 +153,6 @@ const EngineCompatibility = () => {
147153
return updatedCompatibility;
148154
});
149155
};
150-
151156
const isPreviousLevelSelected = (index: number) => {
152157
if (index === 0) return true; // The first level (OS) is always enabled
153158
if (index === 3) return !!Compatibility.cpu; // Enable Engine if CPU is selected
@@ -165,32 +170,50 @@ const EngineCompatibility = () => {
165170
return "cortex run llama3:onnx / llama3:tensorrt-llm / llama3:gguf";
166171
};
167172

173+
useEffect(() => {
174+
return () => {
175+
console.log(Compatibility);
176+
// if (Compatibility.os === "mac") {
177+
// console.log(Compatibility);
178+
// setCompatibility({
179+
// ...Compatibility,
180+
// accelerator: "apple",
181+
// engine: "llama",
182+
// format: "gguf",
183+
// });
184+
// }
185+
};
186+
}, [Compatibility]);
187+
168188
return (
169189
<div>
170190
{levels.map((level, i) => (
171191
<div key={i} className="flex justify-between items-center gap-4">
172192
<h5 className="mb-0">{level.name}</h5>
173193
<div className="flex w-3/4 gap-4">
174-
{level.child.map((c) => (
175-
<div
176-
key={c.value}
177-
className={twMerge(
178-
`border border-neutral-200 border-solid text-black p-4 my-2 rounded-lg cursor-pointer`,
179-
Compatibility[level.name.toLowerCase()] === c.value
180-
? "bg-neutral-900 text-white"
181-
: isPreviousLevelSelected(i)
182-
? ""
183-
: "opacity-50 bg-neutral-100 cursor-not-allowed",
184-
c?.disabled && "bg-neutral-100 cursor-not-allowed"
185-
)}
186-
onClick={() =>
187-
isPreviousLevelSelected(i) &&
188-
handleClick(level.name.toLowerCase(), c.value, c.disabled)
189-
}
190-
>
191-
{c.name}
192-
</div>
193-
))}
194+
{level.child.map((c) => {
195+
return (
196+
<div
197+
key={c.value}
198+
className={twMerge(
199+
`border border-neutral-200 border-solid text-black p-4 my-2 rounded-lg cursor-pointer flex items-center`,
200+
Compatibility[level.name.toLowerCase()] === c.value
201+
? "bg-neutral-900 text-white"
202+
: isPreviousLevelSelected(i)
203+
? ""
204+
: "opacity-50 bg-neutral-100 cursor-not-allowed",
205+
c?.disabled && "bg-neutral-100 cursor-not-allowed"
206+
)}
207+
onClick={() =>
208+
isPreviousLevelSelected(i) &&
209+
handleClick(level.name.toLowerCase(), c.value, c.disabled)
210+
}
211+
>
212+
{c.logo && <c.logo className="h-4 mr-2" />}
213+
{c.name}
214+
</div>
215+
);
216+
})}
194217
</div>
195218
</div>
196219
))}

src/containers/Homepage/HeroSection/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ const HeroSection = () => {
5656
<div className="text-center">
5757
<h1 className="text-6xl font-grotesk">
5858
{/* <FlipWords words={words} /> */}
59-
<h1 className="text-6xl">Local AI</h1>
59+
<span className="text-6xl">Local AI</span>
6060
</h1>
6161
<p className="text-xl w-full mx-auto lg:w-2/3 text-black/60 dark:text-white/60">
6262
Self-hosted alternative to the OpenAI Platform.

src/styles/apiReference.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
border-top: none !important;
1414
font-size: 14px !important;
1515
padding-left: 12px !important;
16-
}
16+
}

src/styles/main.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
@import "./pagination.scss";
1313
@import "./cardContainer.scss";
1414
@import "./models-detail.scss";
15-
@import "./apiReference.scss";
15+
@import "./apiReference.scss";

tailwind.config.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,7 @@ const config: Config = {
66
container: false,
77
},
88
darkMode: ["class", '[data-theme="dark"]'],
9-
content: [
10-
"./src/**/*.{jsx,tsx,html,md,scss}",
11-
"./src/components/**/*.{jsx,tsx,html,md,scss}",
12-
"./src/containers/**/*.{jsx,tsx,html,md,scss}",
13-
],
9+
content: ["./src/**/*.{jsx,tsx,html,md,scss}"],
1410
theme: {
1511
container: {
1612
center: true,

0 commit comments

Comments
 (0)