Skip to content

Open WebUI 0.11.1: oikb status fails with TypeError and oikb ls returns 0 files #113

Description

@lhvo

Environment

  • Open WebUI 0.11.1
  • OIKB 0.4.0
  • Docker deployment

Problem

The Knowledge Base contains files and Open WebUI returns them correctly via:

GET /api/v1/knowledge/{kb_id}/files

However:

oikb ls
oikb status --kb-id

either return 0 files or fail with:

TypeError: object of type 'NoneType' has no len()

Traceback

File "/usr/local/lib/python3.11/site-packages/oikb/cli.py", line 770, in status
file_count = len(files)
TypeError: object of type 'NoneType' has no len()

Observed API responses

GET /api/v1/knowledge/

returns:

{
"items": [...],
"total": 1
}

GET /api/v1/knowledge//files

returns:

{
"items": [...],
"total": 2
}

Root cause

In oikb/client.py:

def list_kb_files(self, kb_id):
resp = self._http.get(f"/knowledge/{kb_id}")
data = resp.json()
return data.get("files", [])

The endpoint should instead be:

GET /knowledge/{kb_id}/files

and Open WebUI 0.11.1 returns file entries in:

data["items"]

rather than:

data["files"]

Proposed fix

client.py

def list_kb_files(self, kb_id):
resp = self._http.get(f"/knowledge/{kb_id}/files")
resp.raise_for_status()
data = resp.json()
return data.get("items") or data.get("files") or []

cli.py

Replace:

files = info.get("files", [])

with:

files = client.list_kb_files(kb)

This resolves both:

  • oikb status
  • oikb ls

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions