codemaxxing 0.4.8 → 0.4.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +2 -3
- package/dist/utils/ollama.d.ts +1 -1
- package/dist/utils/ollama.js +17 -1
- package/package.json +1 -1
- package/src/index.tsx +2 -3
- package/src/utils/ollama.ts +18 -1
package/dist/index.js
CHANGED
|
@@ -1471,10 +1471,9 @@ function App() {
|
|
|
1471
1471
|
const installCmd = getOllamaInstallCommand(wizardHardware?.os ?? "linux");
|
|
1472
1472
|
(async () => {
|
|
1473
1473
|
try {
|
|
1474
|
-
const {
|
|
1475
|
-
const parts = installCmd.split(" ");
|
|
1474
|
+
const { exec } = _require("child_process");
|
|
1476
1475
|
await new Promise((resolve, reject) => {
|
|
1477
|
-
|
|
1476
|
+
exec(installCmd, { timeout: 180000 }, (err, _stdout, stderr) => {
|
|
1478
1477
|
if (err)
|
|
1479
1478
|
reject(new Error(stderr || err.message));
|
|
1480
1479
|
else
|
package/dist/utils/ollama.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Check if ollama binary exists on PATH */
|
|
1
|
+
/** Check if ollama binary exists on PATH or known install locations */
|
|
2
2
|
export declare function isOllamaInstalled(): boolean;
|
|
3
3
|
/** Check if ollama server is responding */
|
|
4
4
|
export declare function isOllamaRunning(): Promise<boolean>;
|
package/dist/utils/ollama.js
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
import { execSync, spawn } from "child_process";
|
|
2
|
-
|
|
2
|
+
import { existsSync } from "fs";
|
|
3
|
+
import { join } from "path";
|
|
4
|
+
/** Get known Ollama binary paths for Windows */
|
|
5
|
+
function getWindowsOllamaPaths() {
|
|
6
|
+
const paths = [];
|
|
7
|
+
const localAppData = process.env.LOCALAPPDATA || join(process.env.USERPROFILE || "", "AppData", "Local");
|
|
8
|
+
const programFiles = process.env.ProgramFiles || "C:\\Program Files";
|
|
9
|
+
paths.push(join(localAppData, "Programs", "Ollama", "ollama.exe"));
|
|
10
|
+
paths.push(join(programFiles, "Ollama", "ollama.exe"));
|
|
11
|
+
paths.push(join(localAppData, "Ollama", "ollama.exe"));
|
|
12
|
+
return paths;
|
|
13
|
+
}
|
|
14
|
+
/** Check if ollama binary exists on PATH or known install locations */
|
|
3
15
|
export function isOllamaInstalled() {
|
|
4
16
|
try {
|
|
5
17
|
const cmd = process.platform === "win32" ? "where ollama" : "which ollama";
|
|
@@ -7,6 +19,10 @@ export function isOllamaInstalled() {
|
|
|
7
19
|
return true;
|
|
8
20
|
}
|
|
9
21
|
catch {
|
|
22
|
+
// Fallback: check known install paths on Windows
|
|
23
|
+
if (process.platform === "win32") {
|
|
24
|
+
return getWindowsOllamaPaths().some(p => existsSync(p));
|
|
25
|
+
}
|
|
10
26
|
return false;
|
|
11
27
|
}
|
|
12
28
|
}
|
package/package.json
CHANGED
package/src/index.tsx
CHANGED
|
@@ -1496,10 +1496,9 @@ function App() {
|
|
|
1496
1496
|
const installCmd = getOllamaInstallCommand(wizardHardware?.os ?? "linux");
|
|
1497
1497
|
(async () => {
|
|
1498
1498
|
try {
|
|
1499
|
-
const {
|
|
1500
|
-
const parts = installCmd.split(" ");
|
|
1499
|
+
const { exec } = _require("child_process");
|
|
1501
1500
|
await new Promise<void>((resolve, reject) => {
|
|
1502
|
-
|
|
1501
|
+
exec(installCmd, { timeout: 180000 }, (err: any, _stdout: string, stderr: string) => {
|
|
1503
1502
|
if (err) reject(new Error(stderr || err.message));
|
|
1504
1503
|
else resolve();
|
|
1505
1504
|
});
|
package/src/utils/ollama.ts
CHANGED
|
@@ -1,12 +1,29 @@
|
|
|
1
1
|
import { execSync, spawn } from "child_process";
|
|
2
|
+
import { existsSync } from "fs";
|
|
3
|
+
import { join } from "path";
|
|
4
|
+
|
|
5
|
+
/** Get known Ollama binary paths for Windows */
|
|
6
|
+
function getWindowsOllamaPaths(): string[] {
|
|
7
|
+
const paths: string[] = [];
|
|
8
|
+
const localAppData = process.env.LOCALAPPDATA || join(process.env.USERPROFILE || "", "AppData", "Local");
|
|
9
|
+
const programFiles = process.env.ProgramFiles || "C:\\Program Files";
|
|
10
|
+
paths.push(join(localAppData, "Programs", "Ollama", "ollama.exe"));
|
|
11
|
+
paths.push(join(programFiles, "Ollama", "ollama.exe"));
|
|
12
|
+
paths.push(join(localAppData, "Ollama", "ollama.exe"));
|
|
13
|
+
return paths;
|
|
14
|
+
}
|
|
2
15
|
|
|
3
|
-
/** Check if ollama binary exists on PATH */
|
|
16
|
+
/** Check if ollama binary exists on PATH or known install locations */
|
|
4
17
|
export function isOllamaInstalled(): boolean {
|
|
5
18
|
try {
|
|
6
19
|
const cmd = process.platform === "win32" ? "where ollama" : "which ollama";
|
|
7
20
|
execSync(cmd, { stdio: ["pipe", "pipe", "pipe"], timeout: 3000 });
|
|
8
21
|
return true;
|
|
9
22
|
} catch {
|
|
23
|
+
// Fallback: check known install paths on Windows
|
|
24
|
+
if (process.platform === "win32") {
|
|
25
|
+
return getWindowsOllamaPaths().some(p => existsSync(p));
|
|
26
|
+
}
|
|
10
27
|
return false;
|
|
11
28
|
}
|
|
12
29
|
}
|