Cloud/on-prem install choice, omp auth (Copilot + Anthropic), omp status in GUI
This commit is contained in:
+155
-25
@@ -1,4 +1,4 @@
|
||||
import json, sqlite3, ssl, subprocess, time, urllib.error, urllib.request
|
||||
import functools, hashlib, json, os, shutil, socket, ssl, subprocess, sys, time, urllib.error, urllib.request
|
||||
from pathlib import Path
|
||||
|
||||
HERE = Path(__file__).parent
|
||||
@@ -26,19 +26,41 @@ PORT = 18081
|
||||
EMBED, EMBED_PORT = MD / "bge-m3-Q8_0.gguf", 18082
|
||||
_open = urllib.request.build_opener(urllib.request.ProxyHandler({})).open # corp proxy must not see localhost
|
||||
|
||||
PROXY = "http://zproxy.idg.audi.vwg:9400" # corp proxy for internet calls (docs.py twg, Copilot)
|
||||
OMP_DB = Path.home() / ".omp" / "agent" / "agent.db" # omp stores the github-copilot OAuth login here
|
||||
# key -> (label, Copilot model id, vision). Vision=False: report/docs/memory/ask only (BYOK italdesign/ models reject images).
|
||||
PROXY = "http://zproxy.idg.audi.vwg:9400" # corp proxy for internet calls (docs.py twg, cloud LLMs)
|
||||
# key -> (label, model id, vision, provider). Vision=False: report/docs/memory/ask only (BYOK italdesign/ models reject images).
|
||||
REMOTE = {
|
||||
"cp-haiku": ("Claude Haiku 5.5 (Copilot, crediti)", "claude-haiku-5.5", True),
|
||||
"cp-kimi": ("Kimi K2.5 (italdesign BYOK)", "italdesign/Bedrock_Mantle/moonshotai.kimi-k2.5", False),
|
||||
"cp-deepseek": ("DeepSeek V3.2 (italdesign BYOK)", "italdesign/Bedrock_Mantle/deepseek.v3.2", False),
|
||||
"cp-sonnet": ("Claude Sonnet 5.5 (Copilot, crediti)", "claude-sonnet-5.5", False),
|
||||
"cp-gemini": ("Gemini 3.8 Flash (Copilot, crediti)", "gemini-3.8-flash", False),
|
||||
"cp-haiku": ("Claude Haiku 5.5 (Copilot, crediti)", "claude-haiku-5.5", True, "github-copilot"),
|
||||
"cp-kimi": ("Kimi K2.5 (italdesign BYOK)", "italdesign/Bedrock_Mantle/moonshotai.kimi-k2.5", False, "github-copilot"),
|
||||
"cp-deepseek": ("DeepSeek V3.2 (italdesign BYOK)", "italdesign/Bedrock_Mantle/deepseek.v3.2", False, "github-copilot"),
|
||||
"cp-sonnet": ("Claude Sonnet 5.5 (Copilot, crediti)", "claude-sonnet-5.5", False, "github-copilot"),
|
||||
"cp-gemini": ("Gemini 3.8 Flash (Copilot, crediti)", "gemini-3.8-flash", False, "github-copilot"),
|
||||
"an-haiku": ("Claude Haiku 5.5 (Anthropic, abbonamento)", "claude-haiku-5-5", True, "anthropic"),
|
||||
"an-sonnet": ("Claude Sonnet 5.5 (Anthropic, abbonamento)", "claude-sonnet-5-5", True, "anthropic"),
|
||||
}
|
||||
_HDR = {"Editor-Version": "vscode/1.107.1", "Editor-Plugin-Version": "copilot-chat/0.26.7", "Copilot-Integration-Id": "copilot-developer-cli"}
|
||||
_ctx = ssl.create_default_context(); _ctx.verify_flags &= ~ssl.VERIFY_X509_STRICT # corp TLS proxy CA lacks critical basicConstraints
|
||||
_ropen = urllib.request.build_opener(urllib.request.ProxyHandler({"https": PROXY}), urllib.request.HTTPSHandler(context=_ctx)).open
|
||||
_NO_PROXY = "localhost,127.0.0.1,.audi.vwg,.vwgroup.com,.vwg,.italdesign.it" # same list as $PROFILE
|
||||
_PX = [0.0, None]
|
||||
def proxy():
|
||||
"""PROXY if reachable right now (TCP connect, 2 s; = $PROFILE's Test-Connection), else None. Re-checked every 5 min: laptops move between office/VPN/home."""
|
||||
if time.time() - _PX[0] > 300:
|
||||
try: socket.create_connection(("zproxy.idg.audi.vwg", 9400), timeout=2).close(); px = PROXY
|
||||
except OSError: px = None
|
||||
_PX[:] = [time.time(), px]
|
||||
return _PX[1]
|
||||
|
||||
@functools.cache
|
||||
def _opener(px):
|
||||
return urllib.request.build_opener(urllib.request.ProxyHandler({"https": px, "http": px} if px else {}), urllib.request.HTTPSHandler(context=_ctx)).open
|
||||
def _ropen():
|
||||
"""Opener for internet calls: through the corp proxy when reachable, else direct (ProxyHandler({}) ignores stale env proxies, like $PROFILE's else branch)."""
|
||||
return _opener(proxy())
|
||||
|
||||
def omp_env():
|
||||
"""Env for omp subprocesses: omp ignores HTTP(S)_PROXY and reads PI_PROXY; the corp proxy re-signs TLS. Without the proxy, strip every proxy var."""
|
||||
env = {k: v for k, v in os.environ.items() if k.upper() not in ("HTTP_PROXY", "HTTPS_PROXY", "PI_PROXY", "NO_PROXY")}
|
||||
if px := proxy(): env.update(HTTP_PROXY=px, HTTPS_PROXY=px, PI_PROXY=px, NO_PROXY=_NO_PROXY, NODE_TLS_REJECT_UNAUTHORIZED="0")
|
||||
return env
|
||||
|
||||
def _local(): return [k for k, m in MODELS.items() if m[1].exists()]
|
||||
def available(vision=True): return _local() + [k for k, r in REMOTE.items() if r[2] or not vision]
|
||||
@@ -46,34 +68,70 @@ def label(k): return (MODELS.get(k) or REMOTE[k])[0]
|
||||
|
||||
def current(vision=True):
|
||||
"""Model for shots (vision) or report/ask (text): GUI choice if available, else 4B for shots (VRAM-only, near-35B shots)
|
||||
and the biggest local model for reports (4B reports lose structure on long transcripts). Never falls back to remote."""
|
||||
and the biggest local model for reports (4B reports lose structure on long transcripts). Falls back to the first cloud model only when no local model is installed (cloud-only install)."""
|
||||
ks = (CHOICE.read_text().split() if CHOICE.exists() else []) or [""]
|
||||
k = ks[0] if vision else ks[-1] # a single key (old format) applies to both
|
||||
if k in available(vision): return k
|
||||
loc = _local()
|
||||
if vision and "qwen4b" in loc: return "qwen4b"
|
||||
return (loc or ["qwen4b"])[0]
|
||||
return (loc or available(vision))[0]
|
||||
|
||||
def _copilot():
|
||||
"""(token, api base) of omp's github-copilot login."""
|
||||
try:
|
||||
c = sqlite3.connect(f"file:{OMP_DB.as_posix()}?mode=ro", uri=True)
|
||||
try: row = c.execute("SELECT data FROM auth_credentials WHERE provider='github-copilot' AND disabled_cause IS NULL ORDER BY id DESC LIMIT 1").fetchone()
|
||||
finally: c.close()
|
||||
except sqlite3.Error as e: raise RuntimeError(f"omp agent.db non leggibile ({OMP_DB}): {e}") from e
|
||||
if not row: raise RuntimeError("nessun login github-copilot in omp: esegui /login github-copilot in omp")
|
||||
d = json.loads(row[0]); return d["access"], d.get("apiEndpoint") or "https://api.githubcopilot.com"
|
||||
OMP_LOCAL = HERE / "bin" / "omp.exe" # Pinokio-local install (llama.py install-omp); wins over a PATH omp so the install's own copy is always the one used
|
||||
def omp_exe(): return str(OMP_LOCAL) if OMP_LOCAL.exists() else shutil.which("omp")
|
||||
|
||||
_TOK = {} # provider -> (token, api base, fetched at)
|
||||
def _token(provider):
|
||||
"""(token, api base) via `omp token` (it refreshes expired OAuth). ponytail: 5-min cache, re-query on every call if a token ever dies inside it."""
|
||||
t = _TOK.get(provider)
|
||||
if t and time.time() - t[2] < 300: return t[:2]
|
||||
exe = omp_exe()
|
||||
if not exe: raise RuntimeError("omp non installato: esegui Install da Pinokio")
|
||||
r = subprocess.run([exe, "token", provider, "--raw"], capture_output=True, text=True, encoding="utf-8", errors="replace", timeout=60, env=omp_env())
|
||||
if r.returncode: raise RuntimeError(f"{provider}: login necessario (Pinokio → Cloud login). {r.stderr.strip()[:200]}")
|
||||
out = r.stdout.strip(); d = json.loads(out) if out.startswith("{") else {"token": out}
|
||||
base = d.get("apiEndpoint") or ("https://api.githubcopilot.com" if provider == "github-copilot" else "https://api.anthropic.com")
|
||||
_TOK[provider] = (d["token"], base, time.time()); return _TOK[provider][:2]
|
||||
|
||||
_ST = [0.0, None]
|
||||
def omp_status():
|
||||
"""{'exe': path|None, 'github-copilot': None|reason, 'anthropic': None|reason}: can omp hand out a valid (refreshed) token right now. Cached 60 s (GUI polls every 3 s).
|
||||
ponytail: a revoked Copilot token only shows up on the next API call (its expiresAt is years away)."""
|
||||
if time.time() - _ST[0] < 60: return _ST[1]
|
||||
s = {"exe": omp_exe()}
|
||||
for p in ("github-copilot", "anthropic"):
|
||||
_TOK.pop(p, None)
|
||||
try: _token(p); s[p] = None
|
||||
except Exception as e: s[p] = str(e)
|
||||
_ST[:] = [time.time(), s]; return s
|
||||
_AHDR = {"anthropic-version": "2023-06-01", "anthropic-beta": "claude-code-20250219,oauth-2025-04-20", "user-agent": "claude-cli/2.1.280", "x-app": "cli"}
|
||||
def _anthropic(body, model, tok, timeout):
|
||||
"""OpenAI chat body -> Anthropic Messages (subscription OAuth needs the Claude Code identity first, as omp/pi send) -> OpenAI-shaped response."""
|
||||
system, msgs = [{"type": "text", "text": "You are Claude Code, Anthropic's official CLI for Claude."}], []
|
||||
for m in body["messages"]:
|
||||
if m["role"] == "system": system.append({"type": "text", "text": m["content"]}); continue
|
||||
c = m["content"]
|
||||
if isinstance(c, list): # shots.py: text + data-URL jpeg
|
||||
c = [{"type": "text", "text": p["text"]} if p["type"] == "text" else
|
||||
{"type": "image", "source": {"type": "base64", "media_type": p["image_url"]["url"][5:].split(";")[0], "data": p["image_url"]["url"].split(",", 1)[1]}} for p in c]
|
||||
msgs.append({"role": m["role"], "content": c})
|
||||
req = {"model": model, "max_tokens": body.get("max_tokens", 8192), "system": system, "messages": msgs, "thinking": {"type": "disabled"}} # no temperature: deprecated on these models (HTTP 400); thinking off: it eats max_tokens (empty text)
|
||||
h = {"Authorization": "Bearer " + tok, "Content-Type": "application/json", **_AHDR}
|
||||
try: d = json.load(_ropen()(urllib.request.Request("https://api.anthropic.com/v1/messages", json.dumps(req).encode(), h), timeout=timeout))
|
||||
except urllib.error.HTTPError as e: raise RuntimeError(f"Anthropic {model}: HTTP {e.code} {e.read()[:300].decode(errors='replace')}") from e
|
||||
return {"choices": [{"message": {"content": "".join(b.get("text", "") for b in d["content"] if b["type"] == "text")}}],
|
||||
"usage": {"prompt_tokens": d["usage"]["input_tokens"], "completion_tokens": d["usage"]["output_tokens"]}}
|
||||
|
||||
def post(body, vision, timeout):
|
||||
"""Chat completion on llama-server, or on GitHub Copilot when the GUI picked a REMOTE model."""
|
||||
"""Chat completion on llama-server, or on a cloud model (Copilot / Anthropic via omp login) when the GUI picked a REMOTE model."""
|
||||
k = current(vision); r = REMOTE.get(k)
|
||||
if not r:
|
||||
req = urllib.request.Request(f"http://127.0.0.1:{PORT}/v1/chat/completions", json.dumps({**body, "model": k}).encode(), {"Content-Type": "application/json"})
|
||||
return json.load(_open(req, timeout=timeout))
|
||||
tok, base = _copilot()
|
||||
tok, base = _token(r[3])
|
||||
body = {**{x: v for x, v in body.items() if x != "chat_template_kwargs"}, "model": r[1]}
|
||||
if r[3] == "anthropic": return _anthropic(body, r[1], tok, timeout)
|
||||
h = {"Authorization": "Bearer " + tok, "Content-Type": "application/json", **_HDR, **({"Copilot-Vision-Request": "true"} if vision else {})}
|
||||
try: return json.load(_ropen(urllib.request.Request(base + "/chat/completions", json.dumps(body).encode(), h), timeout=timeout))
|
||||
try: return json.load(_ropen()(urllib.request.Request(base + "/chat/completions", json.dumps(body).encode(), h), timeout=timeout))
|
||||
except urllib.error.HTTPError as e:
|
||||
if e.code == 400: raise # callers retry 400 without response_format
|
||||
raise RuntimeError(f"Copilot {r[1]}: HTTP {e.code} {e.read()[:300].decode(errors='replace')}") from e
|
||||
@@ -86,7 +144,7 @@ def content(resp, what):
|
||||
think = len((resp["choices"][0]["message"].get("reasoning_content") or "").split())
|
||||
if t: print(f"llm {what}: prompt {t.get('prompt_n', 0)} tok @ {t.get('prompt_per_second', 0):.0f} t/s, "
|
||||
f"gen {t.get('predicted_n', 0)} tok @ {t.get('predicted_per_second', 0):.1f} t/s" + (f" (thinking ~{think} words)" if think else ""), flush=True)
|
||||
elif resp.get("usage"): print(f"llm {what}: prompt {resp['usage'].get('prompt_tokens', 0)} tok, gen {resp['usage'].get('completion_tokens', 0)} tok (Copilot)", flush=True)
|
||||
elif resp.get("usage"): print(f"llm {what}: prompt {resp['usage'].get('prompt_tokens', 0)} tok, gen {resp['usage'].get('completion_tokens', 0)} tok (cloud)", flush=True)
|
||||
return resp["choices"][0]["message"]["content"]
|
||||
|
||||
def up(port=PORT):
|
||||
@@ -112,3 +170,75 @@ def start_embed(log="embed.log"):
|
||||
"""bge-m3 embeddings on CPU (never competes with the GPU model). None if already running."""
|
||||
if not EMBED.exists(): raise FileNotFoundError(f"{EMBED} missing: hf download gpustack/bge-m3-GGUF bge-m3-Q8_0.gguf --local-dir models")
|
||||
return _spawn(["-m", str(EMBED), "--embeddings", "--pooling", "cls", "-ngl", "0", "-c", "8192", "-b", "2048", "-ub", "2048"], EMBED_PORT, log)
|
||||
|
||||
OMP_BUILD = "https://build.stencil.so/api/products/omp/latest/windows-x86_64?channel=stable"
|
||||
MODELS_YML = """providers:
|
||||
github-copilot:
|
||||
auth: none
|
||||
baseUrl: https://api.githubcopilot.com
|
||||
models:
|
||||
- id: italdesign/Bedrock_Mantle/qwen.qwen3-coder-480b-a35b-instruct
|
||||
name: Qwen3 Coder 480B (Mantle)
|
||||
api: openai-completions
|
||||
supportsTools: true
|
||||
contextWindow: 128000
|
||||
maxTokens: 16384
|
||||
tokenizer: qwen3
|
||||
headers: &copilot_headers
|
||||
Editor-Version: vscode/1.107.1
|
||||
Editor-Plugin-Version: copilot-chat/0.26.7
|
||||
Copilot-Integration-Id: copilot-developer-cli
|
||||
- id: italdesign/Bedrock_Mantle/qwen.qwen3-vl-235b-a22b-instruct
|
||||
name: Qwen3 VL 235B (Mantle)
|
||||
api: openai-completions
|
||||
tokenizer: qwen3
|
||||
input: [text, image]
|
||||
supportsTools: true
|
||||
contextWindow: 256000
|
||||
maxTokens: 8192
|
||||
headers: *copilot_headers
|
||||
- id: italdesign/Bedrock_Mantle/deepseek.v3.2
|
||||
name: DeepSeek V3.2 (Mantle)
|
||||
api: openai-completions
|
||||
supportsTools: true
|
||||
contextWindow: 163840
|
||||
maxTokens: 8192
|
||||
tokenizer: deepseek-v3
|
||||
headers: *copilot_headers
|
||||
- id: italdesign/Bedrock_Mantle/moonshotai.kimi-k2.5
|
||||
name: Kimi K2.5 (Mantle)
|
||||
api: openai-completions
|
||||
supportsTools: true
|
||||
contextWindow: 262144
|
||||
tokenizer: kimi-k2
|
||||
maxTokens: 16384
|
||||
headers: *copilot_headers
|
||||
"""
|
||||
|
||||
def install_omp():
|
||||
"""omp into bin/ unless one is already available; seed ~/.omp/agent/models.yml (Copilot BYOK models) only if absent."""
|
||||
if omp_exe(): print("omp already available:", omp_exe())
|
||||
else:
|
||||
OMP_LOCAL.parent.mkdir(exist_ok=True)
|
||||
ua = {"User-Agent": "teams-whisper-install"} # the build API answers 403 to python-urllib's default UA
|
||||
j = json.load(_ropen()(urllib.request.Request(OMP_BUILD, headers=ua), timeout=60)); part = OMP_LOCAL.with_suffix(".part"); h = hashlib.sha256()
|
||||
with _ropen()(urllib.request.Request(j["download"], headers=ua), timeout=900) as r, open(part, "wb") as f:
|
||||
while b := r.read(1 << 20): h.update(b); f.write(b)
|
||||
if h.hexdigest() != j["file"]["sha256"].lower(): part.unlink(); raise RuntimeError("omp download: checksum mismatch")
|
||||
part.replace(OMP_LOCAL); print("omp", j["build"]["version"], "->", OMP_LOCAL)
|
||||
y = Path.home() / ".omp" / "agent" / "models.yml"
|
||||
if y.exists(): print("kept existing", y)
|
||||
else: y.parent.mkdir(parents=True, exist_ok=True); y.write_text(MODELS_YML, encoding="utf-8"); print("written", y)
|
||||
|
||||
def login(provider, if_needed=False):
|
||||
"""Interactive `omp login` in this console with the proxy env; if_needed: skip when omp already hands out a valid token (install)."""
|
||||
exe = omp_exe()
|
||||
if not exe: raise RuntimeError("omp non installato: esegui Install da Pinokio")
|
||||
if if_needed:
|
||||
try: _token(provider); print(provider, "already logged in"); return
|
||||
except RuntimeError: pass
|
||||
subprocess.run([exe, "login", provider], env=omp_env()) # inherits stdin/stdout: device code / browser URL shown in the Pinokio terminal
|
||||
|
||||
if __name__ == "__main__":
|
||||
if sys.argv[1:] == ["install-omp"]: install_omp()
|
||||
elif sys.argv[1:2] == ["login"]: login(sys.argv[2], "--if-needed" in sys.argv)
|
||||
|
||||
+3
-2
@@ -310,7 +310,7 @@ def status():
|
||||
w = db.media(n)[0]; d["mb"] = round(w.stat().st_size / 1e6, 1) if w else 0
|
||||
rs.append(d)
|
||||
return {"now": t, "recs": rs, "busy": busy(), "queue": len(QUEUE), "skip_shots": (db.GLOBAL / "skip_shots.txt").exists(),
|
||||
"llm": [llama.current(True), llama.current(False)], "llms": [[[k, llama.label(k)] for k in llama.available(v)] for v in (True, False)]}
|
||||
"llm": [llama.current(True), llama.current(False)], "omp": llama.omp_status(), "llms": [[[k, llama.label(k)] for k in llama.available(v)] for v in (True, False)]}
|
||||
|
||||
|
||||
def fts(sql, q):
|
||||
@@ -408,7 +408,7 @@ body.drag main{outline:3px dashed var(--acc);outline-offset:8px;border-radius:14
|
||||
button.del{color:var(--redf)}button.del:hover{background:var(--red);border-color:var(--redf)}
|
||||
dialog{border:1px solid var(--line);border-radius:14px;background:var(--card);color:var(--fg);padding:16px;width:min(960px,94vw)}dialog::backdrop{background:rgba(0,0,0,.5)}
|
||||
dialog video{width:100%;max-height:68vh;background:#000;border-radius:8px}dialog input.tm{width:90px}#cmsg{color:var(--mut);font-size:13px}</style>
|
||||
<main><header><h1>Riunioni</h1><div class=row><span id=qs></span><label title="non legge le schermate condivise: elaborazione molto più veloce, report solo dal parlato"><input type=checkbox id=skp onchange=setSkip()> Salta schermate</label><select id=llm title="modello per le schermate (shots)" onchange=setLlm()></select><select id=llmr title="modello per il report" onchange=setLlm()></select><button onclick=mergeSel() title="unisce in un solo video le registrazioni spuntate (stessa chiamata riavviata)">Unisci spuntati</button><button class=pri onclick=pick() title="mp4, mkv, mov, webm, wav, m4a, mp3">⬆ Carica video</button>
|
||||
<main><header><h1>Riunioni</h1><div class=row><span id=omps title="login: menu Pinokio → Cloud login"></span><span id=qs></span><label title="non legge le schermate condivise: elaborazione molto più veloce, report solo dal parlato"><input type=checkbox id=skp onchange=setSkip()> Salta schermate</label><select id=llm title="modello per le schermate (shots)" onchange=setLlm()></select><select id=llmr title="modello per il report" onchange=setLlm()></select><button onclick=mergeSel() title="unisce in un solo video le registrazioni spuntate (stessa chiamata riavviata)">Unisci spuntati</button><button class=pri onclick=pick() title="mp4, mkv, mov, webm, wav, m4a, mp3">⬆ Carica video</button>
|
||||
<input type=file id=up accept="video/*,audio/*,.mkv" hidden></div></header>
|
||||
<div id=hint>Trascina qui un video o un audio di una riunione per elaborarlo.</div>
|
||||
<div class="card" id=ub hidden><div class=pg style="margin:0;border:0;padding:0;background:none"><div class=pgh><span><span class=big id=ubig>0%</span> <b id=utitle></b></span><button id=ucancel>annulla</button></div>
|
||||
@@ -511,6 +511,7 @@ async function tick(){try{const j=await (await fetch("/status")).json();ab.disab
|
||||
const runp=j.recs.map(r=>r.prog).filter(p=>p&&p.pct!=null);document.title=runp.length?`${Math.round(runp[0].pct*100)}% · ${LBL[runp[0].step]} · Riunioni`:"Riunioni";
|
||||
for(const [s,i,p] of [[llm,0,"shots: "],[llmr,1,"report: "]])if(document.activeElement!==s){s.innerHTML=j.llms[i].map(([k,l])=>`<option value=${k}>${p}${E(l)}`).join("");s.value=j.llm[i];s.disabled=j.busy}
|
||||
skp.checked=j.skip_shots;skp.disabled=j.busy;
|
||||
const o=j.omp;omps.innerHTML=!o.exe?`<span style="color:var(--redf)">omp non installato</span>`:[["github-copilot","Copilot"],["anthropic","Anthropic"]].map(([k,l])=>`<span title="${E(o[k]||"login valido")}"${o[k]?' style="color:var(--redf)"':""}>${o[k]?"✗":"✓"} ${l}</span>`).join(" · ");
|
||||
qs.textContent=j.queue?`rielaborazione: ${j.queue} da completare`:"";
|
||||
document.querySelectorAll("select[id^=f-]").forEach(s=>sel[s.id]=s.value);
|
||||
let h="<thead><tr><th>recording<th>status<th>duration<th>speakers<th>MB<th>links<th>actions</tr></thead>";
|
||||
|
||||
+104
-21
@@ -1,3 +1,5 @@
|
||||
const { execFileSync } = require("child_process")
|
||||
|
||||
module.exports = {
|
||||
requires: {
|
||||
bundle: "ai"
|
||||
@@ -9,14 +11,66 @@ module.exports = {
|
||||
raw: "Hardware: {{gpu_model}} · {{vram}} GB VRAM · {{ram}} GB RAM"
|
||||
}
|
||||
},
|
||||
// floor: NVIDIA with 4 GB VRAM (llama.cpp CUDA build + whisper on GPU)
|
||||
{
|
||||
when: "{{gpu !== 'nvidia' || vram < 4}}",
|
||||
method: "notify",
|
||||
// highest CUDA the driver supports ("CUDA Version: 13.0", newer drivers "CUDA UMD Version: 13.4" in nvidia-smi) -> llama.cpp build; no NVIDIA/driver -> CPU build
|
||||
method: async (req, ondata, kernel) => {
|
||||
let m = null
|
||||
try { m = execFileSync("nvidia-smi", { encoding: "utf8" }).match(/CUDA (?:UMD )?Version:\s*(\d+)\.(\d+)/) } catch (e) {}
|
||||
const v = m ? +m[1] * 100 + +m[2] : 0
|
||||
const build = v >= 1300 ? "cuda-13.4" : v >= 1204 ? "cuda-12.4" : "cpu"
|
||||
ondata({ raw: `CUDA: ${m ? m[1] + "." + m[2] : "none"} -> llama.cpp ${build}\r\n` })
|
||||
return { build }
|
||||
}
|
||||
},
|
||||
{ method: "local.set", params: { build: "{{input.build}}" } },
|
||||
// on-prem LLM choice (35B needs 48+ GB RAM); transcription, diarization and embeddings always stay local
|
||||
{
|
||||
when: "{{local.build !== 'cpu' && vram >= 4 && ram >= 48}}",
|
||||
method: "input",
|
||||
params: {
|
||||
html: "Teams Whisper needs an NVIDIA GPU with at least 4 GB VRAM (found: {{gpu_model}}, {{vram}} GB)."
|
||||
},
|
||||
next: null
|
||||
title: "Local LLM",
|
||||
description: "Transcription, speakers and search always run locally. Cloud models (GitHub Copilot / Anthropic via omp) stay selectable in the Web UI either way.",
|
||||
form: [{
|
||||
type: "select", key: "onprem", title: "On-prem models", default: "35b",
|
||||
items: [
|
||||
{ text: "Cloud only (no LLM download)", value: "none" },
|
||||
{ text: "Qwen3.5 4B on-prem (~3.3 GB, all in VRAM)", value: "4b" },
|
||||
{ text: "Qwen3.5 4B + Qwen3.6 35B on-prem (~26 GB, experts in RAM)", value: "35b" }
|
||||
]
|
||||
}]
|
||||
}
|
||||
},
|
||||
{
|
||||
when: "{{local.build !== 'cpu' && vram >= 4 && ram >= 48}}",
|
||||
method: "local.set",
|
||||
params: { onprem: "{{input.onprem}}" }
|
||||
},
|
||||
{
|
||||
when: "{{local.build !== 'cpu' && vram >= 4 && ram < 48}}",
|
||||
method: "input",
|
||||
params: {
|
||||
title: "Local LLM",
|
||||
description: "Transcription, speakers and search always run locally. Cloud models (GitHub Copilot / Anthropic via omp) stay selectable in the Web UI either way.",
|
||||
form: [{
|
||||
type: "select", key: "onprem", title: "On-prem models", default: "4b",
|
||||
items: [
|
||||
{ text: "Cloud only (no LLM download)", value: "none" },
|
||||
{ text: "Qwen3.5 4B on-prem (~3.3 GB, all in VRAM)", value: "4b" }
|
||||
]
|
||||
}]
|
||||
}
|
||||
},
|
||||
{
|
||||
when: "{{local.build !== 'cpu' && vram >= 4 && ram < 48}}",
|
||||
method: "local.set",
|
||||
params: { onprem: "{{input.onprem}}" }
|
||||
},
|
||||
{
|
||||
when: "{{local.build === 'cpu' || vram < 4}}",
|
||||
method: "log",
|
||||
params: {
|
||||
raw: "No CUDA GPU with 4+ GB VRAM: cloud models only; transcription, diarization and embeddings run on CPU."
|
||||
}
|
||||
},
|
||||
{
|
||||
method: "shell.run",
|
||||
@@ -24,14 +78,19 @@ module.exports = {
|
||||
message: "conda install -y -c conda-forge ffmpeg 7zip"
|
||||
}
|
||||
},
|
||||
// llama.cpp server (CUDA 13) for the Qwen VLM + bge-m3 embeddings
|
||||
// llama.cpp server (CUDA 13.4 / 12.4 / CPU build, per detection above) for the Qwen VLM + bge-m3 embeddings
|
||||
{
|
||||
method: "fs.download",
|
||||
params: {
|
||||
uri: [
|
||||
"https://github.com/ggml-org/llama.cpp/releases/download/b11889/llama-b11889-bin-win-cuda-13.4-x64.zip",
|
||||
"https://github.com/ggml-org/llama.cpp/releases/download/b11889/cudart-llama-bin-win-cuda-13.4-x64.zip"
|
||||
],
|
||||
uri: "https://github.com/ggml-org/llama.cpp/releases/download/b11889/llama-b11889-bin-win-{{local.build}}-x64.zip",
|
||||
dir: "app/bin"
|
||||
}
|
||||
},
|
||||
{
|
||||
when: "{{local.build !== 'cpu'}}",
|
||||
method: "fs.download",
|
||||
params: {
|
||||
uri: "https://github.com/ggml-org/llama.cpp/releases/download/b11889/cudart-llama-bin-win-{{local.build}}-x64.zip",
|
||||
dir: "app/bin"
|
||||
}
|
||||
},
|
||||
@@ -39,22 +98,28 @@ module.exports = {
|
||||
method: "shell.run",
|
||||
params: {
|
||||
path: "app/bin",
|
||||
message: [
|
||||
"7z x -y llama-b11889-bin-win-cuda-13.4-x64.zip",
|
||||
"7z x -y cudart-llama-bin-win-cuda-13.4-x64.zip"
|
||||
]
|
||||
message: "7z x -y llama-b11889-bin-win-{{local.build}}-x64.zip"
|
||||
}
|
||||
},
|
||||
{
|
||||
when: "{{local.build !== 'cpu'}}",
|
||||
method: "shell.run",
|
||||
params: {
|
||||
path: "app/bin",
|
||||
message: "7z x -y cudart-llama-bin-win-{{local.build}}-x64.zip"
|
||||
}
|
||||
},
|
||||
{
|
||||
method: "fs.rm",
|
||||
params: {
|
||||
path: "app/bin/llama-b11889-bin-win-cuda-13.4-x64.zip"
|
||||
path: "app/bin/llama-b11889-bin-win-{{local.build}}-x64.zip"
|
||||
}
|
||||
},
|
||||
{
|
||||
when: "{{local.build !== 'cpu'}}",
|
||||
method: "fs.rm",
|
||||
params: {
|
||||
path: "app/bin/cudart-llama-bin-win-cuda-13.4-x64.zip"
|
||||
path: "app/bin/cudart-llama-bin-win-{{local.build}}-x64.zip"
|
||||
}
|
||||
},
|
||||
// speaker diarization (sherpa-onnx)
|
||||
@@ -88,8 +153,9 @@ module.exports = {
|
||||
"local-dir": "models"
|
||||
}
|
||||
},
|
||||
// small VLM (Qwen3.5 4B, ~3.3 GB), all layers in 4 GB VRAM: always installed, enough for 32 GB RAM machines
|
||||
// small VLM (Qwen3.5 4B, ~3.3 GB), all layers in 4 GB VRAM: chosen at install
|
||||
{
|
||||
when: "{{local.onprem === '4b' || local.onprem === '35b'}}",
|
||||
method: "hf.download",
|
||||
params: {
|
||||
path: "app",
|
||||
@@ -97,9 +163,9 @@ module.exports = {
|
||||
"local-dir": "models/qwen3.5-4b"
|
||||
}
|
||||
},
|
||||
// big MoE LLM + vision projector (~23 GB, experts in RAM): only with 48+ GB RAM
|
||||
// big MoE LLM + vision projector (~23 GB, experts in RAM): only when chosen at install
|
||||
{
|
||||
when: "{{ram >= 48}}",
|
||||
when: "{{local.onprem === '35b'}}",
|
||||
method: "hf.download",
|
||||
params: {
|
||||
path: "app",
|
||||
@@ -119,10 +185,27 @@ module.exports = {
|
||||
]
|
||||
}
|
||||
},
|
||||
// omp (cloud auth): installed into app/bin unless already on PATH; seeds ~/.omp/agent/models.yml only if absent
|
||||
{
|
||||
method: "shell.run",
|
||||
params: {
|
||||
path: "app",
|
||||
message: "uv run --script llama.py install-omp"
|
||||
}
|
||||
},
|
||||
{
|
||||
method: "notify",
|
||||
params: {
|
||||
html: "Installation finished ({{ram >= 48 ? 'Qwen3.6 35B + Qwen3.5 4B: pick one in the Web UI header' : 'Qwen3.5 4B'}}). Click 'Start', then load the browser extension from the 'Extension' tab."
|
||||
html: "Installation finished ({{local.onprem === '35b' ? 'Qwen3.6 35B + Qwen3.5 4B' : local.onprem === '4b' ? 'Qwen3.5 4B' : 'cloud models only'}}; pick the model in the Web UI header). Log in to GitHub Copilot in this terminal now; Anthropic: menu 'Cloud login'."
|
||||
}
|
||||
},
|
||||
// last: an aborted device flow cannot leave the install half done; skips itself when omp already has a valid login
|
||||
{
|
||||
method: "shell.run",
|
||||
params: {
|
||||
path: "app",
|
||||
input: true,
|
||||
message: "uv run --script llama.py login github-copilot --if-needed"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
module.exports = {
|
||||
run: [{
|
||||
method: "input",
|
||||
params: {
|
||||
title: "Cloud login (omp)",
|
||||
form: [{ type: "select", key: "provider", title: "Provider", default: "github-copilot",
|
||||
items: [{ text: "GitHub Copilot", value: "github-copilot" }, { text: "Anthropic (Claude Pro/Max)", value: "anthropic" }] }]
|
||||
}
|
||||
}, {
|
||||
method: "shell.run",
|
||||
params: { path: "app", input: true, message: "uv run --script llama.py login {{input.provider}}" }
|
||||
}]
|
||||
}
|
||||
+9
-1
@@ -3,7 +3,7 @@ module.exports = {
|
||||
title: "Teams Whisper",
|
||||
description: "Record Teams calls and turn them into meeting reports, fully local",
|
||||
menu: async (kernel, info) => {
|
||||
let installed = info.exists("app/models/qwen3.5-4b/Qwen3.5-4B-Q4_K_S.gguf")
|
||||
let installed = info.exists("app/models/bge-m3-Q8_0.gguf")
|
||||
let running = {
|
||||
install: info.running("install.js"),
|
||||
start: info.running("start.js"),
|
||||
@@ -34,6 +34,10 @@ module.exports = {
|
||||
icon: "fa-solid fa-puzzle-piece",
|
||||
text: "Extension",
|
||||
href: "ext.js",
|
||||
}, {
|
||||
icon: "fa-solid fa-key",
|
||||
text: "Cloud login",
|
||||
href: "login.js",
|
||||
}, {
|
||||
icon: 'fa-solid fa-terminal',
|
||||
text: "Terminal",
|
||||
@@ -71,6 +75,10 @@ module.exports = {
|
||||
icon: "fa-solid fa-puzzle-piece",
|
||||
text: "Extension",
|
||||
href: "ext.js",
|
||||
}, {
|
||||
icon: "fa-solid fa-key",
|
||||
text: "Cloud login",
|
||||
href: "login.js",
|
||||
}, {
|
||||
icon: "fa-solid fa-plug",
|
||||
text: "Update",
|
||||
|
||||
+1
-2
@@ -1,6 +1,5 @@
|
||||
{
|
||||
"title": "Teams Whisper",
|
||||
"description": "Record Teams calls and turn them into meeting reports, fully local",
|
||||
"platform": "win32",
|
||||
"gpu": "nvidia"
|
||||
"platform": "win32"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user