Fix writing error
This commit is contained in:
@@ -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
|
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")"
|
KB_ID="$(_kb_id_by_name "$kb_name")"
|
||||||
if [ -z "$KB_ID" ]; then echo "KB '$kb_name' not found"; exit 1; fi
|
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\"}" \
|
-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)
|
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_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")"
|
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
|
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\"}" \
|
-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
|
done
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user