new model support
This commit is contained in:
@@ -3,12 +3,45 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import socket
|
||||
import sys
|
||||
import time
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def _load_env_file(path: Path) -> None:
|
||||
"""Load simple KEY=VALUE pairs from an env file without overriding env vars."""
|
||||
if not path.exists():
|
||||
return
|
||||
try:
|
||||
lines = path.read_text().splitlines()
|
||||
except OSError:
|
||||
return
|
||||
for line in lines:
|
||||
text = line.strip()
|
||||
if not text or text.startswith("#"):
|
||||
continue
|
||||
if text.startswith("export "):
|
||||
text = text[len("export "):].strip()
|
||||
if "=" not in text:
|
||||
continue
|
||||
key, value = text.split("=", 1)
|
||||
key = key.strip()
|
||||
if not key or key in os.environ:
|
||||
continue
|
||||
value = value.strip()
|
||||
if len(value) >= 2 and value[0] == value[-1] and value[0] in {"'", '"'}:
|
||||
value = value[1:-1]
|
||||
os.environ[key] = value
|
||||
|
||||
|
||||
def _load_env_defaults() -> None:
|
||||
"""Load local and user-level node env defaults before config defaults are imported."""
|
||||
_load_env_file(Path.cwd() / ".env")
|
||||
_load_env_file(Path.home() / ".config" / "meshnet" / "secrets.env")
|
||||
|
||||
|
||||
def _run_node(cfg: dict) -> None:
|
||||
"""Start the node and hand off to the live dashboard. Blocks until Ctrl-C."""
|
||||
from .startup import run_startup
|
||||
@@ -224,6 +257,8 @@ def _cmd_start(args) -> int:
|
||||
|
||||
|
||||
def main() -> None:
|
||||
_load_env_defaults()
|
||||
|
||||
parser = argparse.ArgumentParser(
|
||||
prog="meshnet-node",
|
||||
description="Distributed AI Inference — Node Client",
|
||||
|
||||
Reference in New Issue
Block a user