diff --git a/backend/open_webui/models/functions.py b/backend/open_webui/models/functions.py index 3747d9e09a..573880d521 100644 --- a/backend/open_webui/models/functions.py +++ b/backend/open_webui/models/functions.py @@ -42,7 +42,7 @@ class FunctionMeta(BaseModel): class FunctionModel(BaseModel): id: str - user_id: str + user_id: str | None = None # may be null for legacy/malformed records name: str type: str content: str @@ -58,7 +58,7 @@ class FunctionModel(BaseModel): # --- form / schema definitions --- class FunctionWithValvesModel(BaseModel): id: str - user_id: str + user_id: str | None = None # may be null for legacy/malformed records name: str type: str content: str @@ -79,7 +79,7 @@ class FunctionWithValvesModel(BaseModel): class FunctionResponse(BaseModel): id: str - user_id: str + user_id: str | None = None # may be null for legacy/malformed records type: str name: str meta: FunctionMeta diff --git a/backend/open_webui/models/tools.py b/backend/open_webui/models/tools.py index d4bcf1f631..86568288e0 100644 --- a/backend/open_webui/models/tools.py +++ b/backend/open_webui/models/tools.py @@ -41,7 +41,7 @@ class ToolMeta(BaseModel): class ToolModel(BaseModel): id: str - user_id: str + user_id: str | None = None # may be null for legacy/malformed records name: str # None when listed with defer_content=True (source skipped for listings) content: str | None = None @@ -66,7 +66,7 @@ class ToolUserModel(ToolModel): class ToolResponse(BaseModel): id: str - user_id: str + user_id: str | None = None # may be null for legacy/malformed records name: str meta: ToolMeta access_grants: list[AccessGrantModel] = Field(default_factory=list)