owui-cli 0.5.1__tar.gz → 0.5.2__tar.gz
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.
- {owui_cli-0.5.1 → owui_cli-0.5.2}/PKG-INFO +2 -2
- {owui_cli-0.5.1 → owui_cli-0.5.2}/pyproject.toml +1 -1
- owui_cli-0.5.2/src/owui_cli/__init__.py +1 -0
- {owui_cli-0.5.1 → owui_cli-0.5.2}/src/owui_cli/cli.py +38 -2
- {owui_cli-0.5.1 → owui_cli-0.5.2}/uv.lock +1 -1
- owui_cli-0.5.1/src/owui_cli/__init__.py +0 -1
- {owui_cli-0.5.1 → owui_cli-0.5.2}/.github/workflows/publish.yml +0 -0
- {owui_cli-0.5.1 → owui_cli-0.5.2}/.gitignore +0 -0
- {owui_cli-0.5.1 → owui_cli-0.5.2}/AGENTS.md +0 -0
- {owui_cli-0.5.1 → owui_cli-0.5.2}/LICENSE +0 -0
- {owui_cli-0.5.1 → owui_cli-0.5.2}/README.md +0 -0
- {owui_cli-0.5.1 → owui_cli-0.5.2}/src/owui_cli/data/api-schema.json +0 -0
- {owui_cli-0.5.1 → owui_cli-0.5.2}/update-schema.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
2
|
Name: owui-cli
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.2
|
|
4
4
|
Summary: Admin CLI for Open WebUI instances
|
|
5
5
|
Project-URL: Homepage, https://github.com/rndmcnlly/owui-cli
|
|
6
6
|
Project-URL: Repository, https://github.com/rndmcnlly/owui-cli
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.5.2"
|
|
@@ -602,20 +602,56 @@ def models_show(url, token, model_id):
|
|
|
602
602
|
("grants", str(len(m.get("access_grants") or [])))]
|
|
603
603
|
out_kv(pairs)
|
|
604
604
|
|
|
605
|
+
_MIME_BY_EXT = {
|
|
606
|
+
"png": "image/png",
|
|
607
|
+
"jpg": "image/jpeg",
|
|
608
|
+
"jpeg": "image/jpeg",
|
|
609
|
+
"gif": "image/gif",
|
|
610
|
+
"webp": "image/webp",
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
|
|
614
|
+
def _inline_sibling_images(json_path: str, payload: dict) -> list[str]:
|
|
615
|
+
"""Replace bare sibling-image references in meta.profile_image_url with data URIs.
|
|
616
|
+
|
|
617
|
+
The repo convention stores the icon as a sibling file referenced by bare
|
|
618
|
+
filename (e.g. "profile.png"). OWUI's stored-model validator (utils/validate.py)
|
|
619
|
+
rejects bare filenames and silently clears them to null, so push must inline
|
|
620
|
+
the sibling image instead — the mirror of models_pull_all's extraction.
|
|
621
|
+
Returns the list of inlined filenames.
|
|
622
|
+
"""
|
|
623
|
+
inlined = []
|
|
624
|
+
meta = payload.get("meta") if isinstance(payload, dict) else None
|
|
625
|
+
ref = (meta or {}).get("profile_image_url")
|
|
626
|
+
if not isinstance(ref, str) or not ref or ref.startswith(("data:", "http://", "https://", "/")):
|
|
627
|
+
return inlined
|
|
628
|
+
image_path = os.path.join(os.path.dirname(os.path.abspath(json_path)), ref)
|
|
629
|
+
ext = os.path.splitext(ref)[1].lstrip(".").lower()
|
|
630
|
+
mime = _MIME_BY_EXT.get(ext)
|
|
631
|
+
if mime and os.path.isfile(image_path):
|
|
632
|
+
with open(image_path, "rb") as f:
|
|
633
|
+
b64 = base64.b64encode(f.read()).decode()
|
|
634
|
+
payload["meta"]["profile_image_url"] = f"data:{mime};base64,{b64}"
|
|
635
|
+
inlined.append(ref)
|
|
636
|
+
return inlined
|
|
637
|
+
|
|
638
|
+
|
|
605
639
|
def models_create(url, token, json_path):
|
|
606
640
|
with open(json_path) as f:
|
|
607
641
|
payload = json.load(f)
|
|
642
|
+
inlined = _inline_sibling_images(json_path, payload)
|
|
608
643
|
with httpx.Client(timeout=TIMEOUT) as c:
|
|
609
644
|
r = _post(c, url, "/api/v1/models/create", token, payload)
|
|
610
645
|
m = r.json()
|
|
611
|
-
out(f"created {m.get('id')}")
|
|
646
|
+
out(f"created {m.get('id')}" + (f" (inlined {', '.join(inlined)})" if inlined else ""))
|
|
612
647
|
|
|
613
648
|
def models_update(url, token, json_path):
|
|
614
649
|
with open(json_path) as f:
|
|
615
650
|
payload = json.load(f)
|
|
651
|
+
inlined = _inline_sibling_images(json_path, payload)
|
|
616
652
|
with httpx.Client(timeout=TIMEOUT) as c:
|
|
617
653
|
r = _post(c, url, "/api/v1/models/model/update", token, payload)
|
|
618
|
-
out(f"updated {r.json().get('id')}")
|
|
654
|
+
out(f"updated {r.json().get('id')}" + (f" (inlined {', '.join(inlined)})" if inlined else ""))
|
|
619
655
|
|
|
620
656
|
def models_delete(url, token, model_id):
|
|
621
657
|
with httpx.Client(timeout=TIMEOUT) as c:
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.5.1"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|