Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -149,5 +149,5 @@ cython_debug/

node_modules/
package-lock.json
/.chainlit
.chainlit/
chainlit.md
10 changes: 10 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@ Here we show you how to use isek to quickly build an agent, and how to build an
isek setup
```

## 1️⃣ Set Up Environment

Create a `.env` file:

```env
OPENAI_MODEL_NAME=gpt-4o-mini
OPENAI_BASE_URL=https://api.openai.com/v1
OPENAI_API_KEY=your_api_key
```

## 🧪 Understanding how ISEK works

- 【LV1】Show you how to build a simple agent
Expand Down
6 changes: 4 additions & 2 deletions examples/UI/chainlit/start_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,9 @@ def start_server():

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

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

time.sleep(2)
Expand Down
19 changes: 17 additions & 2 deletions isek/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,22 @@
import importlib.util
import subprocess
import sys
import shutil
import platform
from pathlib import Path


def get_npm_command():
"""
Returns the available npm executable path on the current platform
(supports Windows, Linux, and macOS).
"""
if platform.system() == "Windows":
return shutil.which("npm.cmd") or shutil.which("npm")
else:
return shutil.which("npm")


def load_module(script_path: Path):
"""Dynamically load module"""
try:
Expand Down Expand Up @@ -104,7 +117,9 @@ def is_development_environment():
# Step 2: Check if Node.js is installed
try:
subprocess.run(["node", "--version"], check=True, capture_output=True)
subprocess.run(["npm", "--version"], check=True, capture_output=True)
subprocess.run(
[get_npm_command(), "--version"], check=True, capture_output=True
)
except (subprocess.CalledProcessError, FileNotFoundError):
click.secho(
"⚠️ Node.js and npm are required for P2P functionality", fg="yellow"
Expand All @@ -118,7 +133,7 @@ def is_development_environment():
click.secho("📦 Installing JavaScript dependencies for P2P...", fg="yellow")
try:
subprocess.check_call(
["npm", "install"],
[get_npm_command(), "install"],
cwd=p2p_dir,
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
Expand Down