-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstart.mjs
More file actions
32 lines (27 loc) · 877 Bytes
/
Copy pathstart.mjs
File metadata and controls
32 lines (27 loc) · 877 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Cross-platform launcher for AKI°
// please test on macOS, Linux, and Windows.
import { spawn } from 'child_process';
import open from 'open';
const isWindows = process.platform === 'win32';
const shell = isWindows ? 'cmd' : 'sh';
const shellFlag = isWindows ? '/c' : '-c';
/**
* Spawn a yarn script as a child process, inheriting stdio so all output
* flows through to the current terminal.
*/
function runScript(script) {
console.log(`AKI° ${script}`);
const child = spawn(shell, [shellFlag, `yarn ${script}`], {
stdio: 'inherit',
cwd: process.cwd(),
});
child.on('error', (err) => {
console.error(`AKI° Failed to start "yarn ${script}":`, err.message);
});
return child;
}
// Start Ollama server and the chosen model
runScript('ollama');
// Switch the comment below to use a different model
runScript('phi3');
// runScript('codellama');