auto-model-router 0.1.1 → 0.1.2
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/hermes-plugin/__init__.py +18 -6
- package/package.json +1 -1
|
@@ -21,6 +21,7 @@ from __future__ import annotations
|
|
|
21
21
|
import os
|
|
22
22
|
import shutil
|
|
23
23
|
import subprocess
|
|
24
|
+
import sys
|
|
24
25
|
import time
|
|
25
26
|
import urllib.request
|
|
26
27
|
|
|
@@ -52,12 +53,23 @@ def _spawn_router() -> None:
|
|
|
52
53
|
"auto-model-router is not installed or not on PATH. "
|
|
53
54
|
"Run `npm install -g auto-model-router` first."
|
|
54
55
|
)
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
56
|
+
if sys.platform.startswith("win"):
|
|
57
|
+
# npm installs a `.cmd` shim that cannot be exec'd as a bare argv
|
|
58
|
+
# list; shell=True resolves it through the command shell.
|
|
59
|
+
subprocess.Popen(
|
|
60
|
+
f'"{BIN}" serve --port {PORT}',
|
|
61
|
+
stdout=subprocess.DEVNULL,
|
|
62
|
+
stderr=subprocess.DEVNULL,
|
|
63
|
+
shell=True,
|
|
64
|
+
start_new_session=True,
|
|
65
|
+
)
|
|
66
|
+
else:
|
|
67
|
+
subprocess.Popen(
|
|
68
|
+
[BIN, "serve", "--port", str(PORT)],
|
|
69
|
+
stdout=subprocess.DEVNULL,
|
|
70
|
+
stderr=subprocess.DEVNULL,
|
|
71
|
+
start_new_session=True,
|
|
72
|
+
)
|
|
61
73
|
# Wait for it to come up (bounded).
|
|
62
74
|
for _ in range(50):
|
|
63
75
|
if _router_running():
|