From 8df91ccac5c23e85fe81115c09f2b2d2018fdfd3 Mon Sep 17 00:00:00 2001 From: Tomas Kracmar Date: Mon, 8 Sep 2025 17:55:00 +0200 Subject: [PATCH] Tools update --- scripts/podx-tools.sh | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/scripts/podx-tools.sh b/scripts/podx-tools.sh index 24e5442..c1a22d4 100755 --- a/scripts/podx-tools.sh +++ b/scripts/podx-tools.sh @@ -191,6 +191,40 @@ PY printf '%s' "${__id:-}" } +# --- OWUI file helpers ------------------------------------------------------- + +_owui_file_get() { + # usage: _owui_file_get + local fid="$1" + curl -sS -H "Authorization: Bearer $OPENWEBUI_API_KEY" \ + "$(_owui_url)/api/v1/files/$fid" +} + +_owui_wait_file() { + # usage: _owui_wait_file [timeout_secs] + local fid="$1" + local timeout="${2:-120}" # default 2 minutes + local start now status content_len + start="$(date +%s)" + while :; do + now="$(date +%s)" + if [ $((now - start)) -ge "$timeout" ]; then + return 1 + fi + # Fetch status and content length + read -r status content_len <