Skip to content

Commit 93a7e0e

Browse files
authored
Fix cli for windows
Fix cli for windows
2 parents dc2f61b + 77c5d9c commit 93a7e0e

File tree

4 files changed

+32
-5
lines changed

4 files changed

+32
-5
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,5 +149,5 @@ cython_debug/
149149

150150
node_modules/
151151
package-lock.json
152-
/.chainlit
152+
.chainlit/
153153
chainlit.md

examples/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,16 @@ Here we show you how to use isek to quickly build an agent, and how to build an
1010
isek setup
1111
```
1212

13+
## 1️⃣ Set Up Environment
14+
15+
Create a `.env` file:
16+
17+
```env
18+
OPENAI_MODEL_NAME=gpt-4o-mini
19+
OPENAI_BASE_URL=https://api.openai.com/v1
20+
OPENAI_API_KEY=your_api_key
21+
```
22+
1323
## 🧪 Understanding how ISEK works
1424

1525
- 【LV1】Show you how to build a simple agent

examples/UI/chainlit/start_ui.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,9 @@ def start_server():
101101

102102
try:
103103
# Start the server in a subprocess
104+
dirc = os.path.dirname(__file__)
104105
server_process = subprocess.Popen([
105-
sys.executable, "examples/UI/chainlit/agent_server.py"
106+
sys.executable, f"{dirc}/agent_server.py"
106107
], stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
107108
# Wait a moment for server to start
108109
time.sleep(3)
@@ -130,8 +131,9 @@ def start_chainlit():
130131

131132
try:
132133
# Start Chainlit in a subprocess
134+
dirc = os.path.dirname(__file__)
133135
chainlit_process = subprocess.Popen([
134-
sys.executable, "-m", "chainlit", "run", "examples/UI/chainlit/chainlit_app.py"
136+
sys.executable, "-m", "chainlit", "run", f"{dirc}/chainlit_app.py"
135137
])
136138

137139
time.sleep(2)

isek/cli.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,22 @@
33
import importlib.util
44
import subprocess
55
import sys
6+
import shutil
7+
import platform
68
from pathlib import Path
79

810

11+
def get_npm_command():
12+
"""
13+
Returns the available npm executable path on the current platform
14+
(supports Windows, Linux, and macOS).
15+
"""
16+
if platform.system() == "Windows":
17+
return shutil.which("npm.cmd") or shutil.which("npm")
18+
else:
19+
return shutil.which("npm")
20+
21+
922
def load_module(script_path: Path):
1023
"""Dynamically load module"""
1124
try:
@@ -104,7 +117,9 @@ def is_development_environment():
104117
# Step 2: Check if Node.js is installed
105118
try:
106119
subprocess.run(["node", "--version"], check=True, capture_output=True)
107-
subprocess.run(["npm", "--version"], check=True, capture_output=True)
120+
subprocess.run(
121+
[get_npm_command(), "--version"], check=True, capture_output=True
122+
)
108123
except (subprocess.CalledProcessError, FileNotFoundError):
109124
click.secho(
110125
"⚠️ Node.js and npm are required for P2P functionality", fg="yellow"
@@ -118,7 +133,7 @@ def is_development_environment():
118133
click.secho("📦 Installing JavaScript dependencies for P2P...", fg="yellow")
119134
try:
120135
subprocess.check_call(
121-
["npm", "install"],
136+
[get_npm_command(), "install"],
122137
cwd=p2p_dir,
123138
stdout=subprocess.DEVNULL,
124139
stderr=subprocess.DEVNULL,

0 commit comments

Comments
 (0)