Initial commit: OpenCode vLLM autostart plugin and launchers
- Desktop plugin: on-demand vLLM model start, eject, media budgets - WSL-native twin plugin for WSL project sessions - Launchers for Qwen3.6 35B-A3B, Qwen3.8 27B (uncensored/fast), Agents-A1 - Config templates, diagnostics, video-processor workaround
This commit is contained in:
commit
40656fd046
27 files changed
+6710
No files matched your search
@@ -0,0 +1,33 @@
|
||||
import json, urllib.request, time, sys
|
||||
BASE = "http://127.0.0.1:8000"
|
||||
|
||||
# discover served model
|
||||
m = json.loads(urllib.request.urlopen(BASE + "/v1/models", timeout=15).read())
|
||||
MODEL = m["data"][0]["id"]
|
||||
print("model:", MODEL)
|
||||
|
||||
def ask(prompt, n=128, temperature=0.7):
|
||||
body = json.dumps({
|
||||
"model": MODEL, "messages": [{"role": "user", "content": prompt}],
|
||||
"max_tokens": n, "temperature": temperature,
|
||||
"chat_template_kwargs": {"enable_thinking": False},
|
||||
}).encode()
|
||||
req = urllib.request.Request(BASE + "/v1/chat/completions", data=body,
|
||||
headers={"Content-Type": "application/json"})
|
||||
t0 = time.time()
|
||||
r = urllib.request.urlopen(req, timeout=300)
|
||||
dt = time.time() - t0
|
||||
j = json.loads(r.read())
|
||||
return dt, j["usage"]["completion_tokens"], j["choices"][0]["message"].get("content")
|
||||
|
||||
# warm
|
||||
dt, tok, _ = ask("Hi", 8)
|
||||
print(f"warmup : {dt:.2f}s {tok}tok")
|
||||
for label, prompt, n in [
|
||||
("chat ", "Write a short paragraph about why the sky is blue.", 120),
|
||||
("code ", "Write a Python function `fib(n)` with a docstring and a usage example. Concise.", 200),
|
||||
("json ", 'Return JSON only: {"name": "...", "age": 0, "city": "..."} for a fictional person named Ada.', 120),
|
||||
]:
|
||||
dt, tok, txt = ask(prompt, n)
|
||||
print(f"{label}: {dt:5.2f}s {tok:3d}tok -> {tok/dt:6.1f} tok/s")
|
||||
print(" ", (txt or "")[:160].replace("\n", " "))
|
||||
@@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
fail=0
|
||||
for f in /mnt/c/Users/dfj/projects/vllm-autostart/launchers/*.sh; do
|
||||
if ! bash -n "$f"; then
|
||||
echo "FAIL $f"
|
||||
fail=1
|
||||
fi
|
||||
done
|
||||
if [ "$fail" -eq 0 ]; then
|
||||
echo "all launcher scripts parse OK"
|
||||
fi
|
||||
exit "$fail"
|
||||
@@ -0,0 +1,13 @@
|
||||
import socket, urllib.request, json
|
||||
s = socket.socket(); s.settimeout(3)
|
||||
try:
|
||||
s.connect(("127.0.0.1", 8000)); print("PORT_OPEN")
|
||||
except Exception as e:
|
||||
print("PORT_CLOSED", repr(e))
|
||||
finally:
|
||||
s.close()
|
||||
try:
|
||||
r = urllib.request.urlopen("http://127.0.0.1:8000/v1/models", timeout=5)
|
||||
print("MODELS", json.loads(r.read())["data"][0]["id"])
|
||||
except Exception as e:
|
||||
print("NO_API", repr(e))
|
||||
Reference in new issue
Block a user