From 7ef443abc33e9a573be7f1d37353238c013c09b2 Mon Sep 17 00:00:00 2001 From: Tomas Kracmar Date: Mon, 8 Sep 2025 10:44:35 +0200 Subject: [PATCH] Fix writing error --- scripts/podx-tools.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/podx-tools.sh b/scripts/podx-tools.sh index 83dd4a6..93c08be 100755 --- a/scripts/podx-tools.sh +++ b/scripts/podx-tools.sh @@ -257,9 +257,10 @@ print(f\"Indexed {n} document(s).\")" if [ -z "$FILE_ID" ]; then echo "Upload failed (no file id)"; echo "$FILE_JSON" | ppjson; exit 1; fi KB_ID="$(_kb_id_by_name "$kb_name")" if [ -z "$KB_ID" ]; then echo "KB '$kb_name' not found"; exit 1; fi - curl -sS -H "Authorization: Bearer $OPENWEBUI_API_KEY" -H "Content-Type: application/json" \ + RESP="$(curl -sS -H "Authorization: Bearer $OPENWEBUI_API_KEY" -H "Content-Type: application/json" \ -d "{\"file_id\":\"$FILE_ID\"}" \ - "$(_owui_url)/api/v1/knowledge/$KB_ID/file/add" | ppjson + "$(_owui_url)/api/v1/knowledge/$KB_ID/file/add")" + echo "$RESP" | ppjson ;; owui-kb-files) @@ -293,9 +294,10 @@ print(f\"Indexed {n} document(s).\")" FILE_JSON="$(curl -sS -H "Authorization: Bearer $OPENWEBUI_API_KEY" -F "file=@$f" "$(_owui_url)/api/v1/files/")" FILE_ID="$(python3 -c 'import sys,json; d=json.loads(sys.stdin.read()); print(d.get("id") or (d.get("data") or {}).get("id",""))' <<<"$FILE_JSON")" if [ -z "$FILE_ID" ]; then echo " upload failed, skipping"; continue; fi - curl -sS -H "Authorization: Bearer $OPENWEBUI_API_KEY" -H "Content-Type: application/json" \ + RESP="$(curl -sS -H "Authorization: Bearer $OPENWEBUI_API_KEY" -H "Content-Type: application/json" \ -d "{\"file_id\":\"$FILE_ID\"}" \ - "$(_owui_url)/api/v1/knowledge/$KB_ID/file/add" | ppjson + "$(_owui_url)/api/v1/knowledge/$KB_ID/file/add")" + echo "$RESP" | ppjson done ;;