[PR #20098] [CLOSED] fix: correct FileModel to FileMetadataResponse conversion #48513

Closed
opened 2026-04-30 00:30:07 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/20098
Author: @majiayu000
Created: 12/22/2025
Status: Closed

Base: mainHead: fix/filemodel-validation-14220


📝 Commits (1)

  • d16bff4 fix: correct FileModel to FileMetadataResponse conversion

📊 Changes

3 files changed (+100 additions, -3 deletions)

View changed files

📝 backend/open_webui/models/knowledge.py (+11 -3)
backend/open_webui/test/models/__init__.py (+0 -0)
backend/open_webui/test/models/test_knowledge.py (+89 -0)

📄 Description

Summary

  • Use explicit field mapping instead of model_dump() to convert FileModel to FileMetadataResponse
  • Handle None timestamps by defaulting to 0 (required int field)
  • Remove unnecessary nested database session in get_file_metadatas_by_id

Fixes #14220

Test plan

  • Added unit tests for FileModel to FileMetadataResponse conversion
  • Upload files via API
  • Add uploaded files to knowledge base via batch add endpoint
  • Verify no validation errors occur

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/open-webui/open-webui/pull/20098 **Author:** [@majiayu000](https://github.com/majiayu000) **Created:** 12/22/2025 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/filemodel-validation-14220` --- ### 📝 Commits (1) - [`d16bff4`](https://github.com/open-webui/open-webui/commit/d16bff4d42bd8215ba43a91450c1cb225a049bd6) fix: correct FileModel to FileMetadataResponse conversion ### 📊 Changes **3 files changed** (+100 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `backend/open_webui/models/knowledge.py` (+11 -3) ➕ `backend/open_webui/test/models/__init__.py` (+0 -0) ➕ `backend/open_webui/test/models/test_knowledge.py` (+89 -0) </details> ### 📄 Description ## Summary - Use explicit field mapping instead of `model_dump()` to convert FileModel to FileMetadataResponse - Handle None timestamps by defaulting to 0 (required int field) - Remove unnecessary nested database session in `get_file_metadatas_by_id` Fixes #14220 ## Test plan - [x] Added unit tests for FileModel to FileMetadataResponse conversion - [ ] Upload files via API - [ ] Add uploaded files to knowledge base via batch add endpoint - [ ] Verify no validation errors occur --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-30 00:30:07 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#48513