fix: read KB files from /knowledge/{id}/files endpoint (#89) - #90
Open
plevart wants to merge 1 commit into
Open
Conversation
`validate --deep`, `status`, and `ls` derived the KB file list from
`GET /knowledge/{id}`, whose `files` field is a server-hydrated
convenience that some Open WebUI versions return as null. Reading
`len(kb.get("files", []))` then crashed with "object of type 'NoneType'
has no len()" because .get()'s default only applies to a missing key,
not an explicit null. `ls` silently printed "(empty)" for the same
reason. Sync was unaffected as it uses the server-side /sync/diff
endpoint.
Point the file listing at the real `GET /knowledge/{id}/files`
endpoint (returns {items, total}): fix list_kb_files, add
count_kb_files for the authoritative total, and use them in the
affected commands.
Fixes open-webui#89
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
validate --deep,status, andlsderived the KB file list fromGET /knowledge/{id}, whosefilesfield is a server-hydrated convenience that Open WebUI version 0.11.0 returns as null. Readinglen(kb.get("files", []))then crashed with "object of type 'NoneType' has no len()" because .get()'s default only applies to a missing key, not an explicit null.lssilently printed "(empty)" for the same reason. Sync was unaffected as it uses the server-side /sync/diff endpoint.Point the file listing at the real
GET /knowledge/{id}/filesendpoint (returns {items, total}): fix list_kb_files, add count_kb_files for the authoritative total, and use them in the affected commands.Fixes #89