You are experiencing two key issues while using OpenWeb UI to upload and summarize PDF files in the chat interface:
Issue 1:
When a PDF file is uploaded, it is only processed and summarized correctly if it is the first request in the chat session.
If you interact with the chat (ask questions or make requests) and then upload a PDF, the file is not processed or summarized.
Issue 2:
When you upload multiple PDF files in the same chat session, the system processes and summarizes the first uploaded file, ignoring subsequent files.
Steps to Reproduce
Issue 1 (Single File, Delayed Upload):
Start a new chat in OpenWeb UI.
Interact with the chat by asking a question or making a request.
Upload a PDF file.
Observed Behavior: The PDF is not summarized or processed.
Issue 2 (Multiple Files):
Start a new chat in OpenWeb UI.
Upload a PDF file (File 1).
Observe that the file is processed and summarized correctly.
Upload another PDF file (File 2).
Observed Behavior: The system processes and summarizes the content of File 1 instead of File 2.
Expected Behavior
The system should process and summarize any PDF file uploaded, regardless of the order or timing of the upload.
When multiple files are uploaded, the system should summarize the most recently uploaded file (File 2 in the second scenario).
Root Cause Hypothesis
Issue 1:
The system likely initializes a state to handle the first request in the chat.
After subsequent interactions, it fails to properly handle or reset this state for PDF uploads.
Issue 2:
The system appears to cache the first uploaded file.
Instead of processing the newly uploaded file, it reuses the cached data from the first file.
Proposed Fixes
For Issue 1:
Ensure that the system listens for new file uploads at any point in the chat session.
Reset or reinitialize the file processing pipeline whenever a new file is uploaded.
For Issue 2:
Clear the cached file data after processing each upload.
Add a mechanism to ensure that the most recently uploaded file is prioritized for processing.
Recommended Changes
State Management:
Implement a dynamic state handler that can process new uploads regardless of previous interactions.
Reset the file handler after each file is processed.
File Cache Clearing:
Introduce a mechanism to clear cached file data before processing new uploads.
Testing:
Test the system with various scenarios:
Uploading files after interacting with the chat.
Uploading multiple files in the same session.
Next Steps
Review and debug the file upload handling logic in the OpenWeb UI backend.
Implement the proposed fixes to manage file states dynamically.
Test the fixes in both single and multi-file upload scenarios to ensure expected behavior.
Originally created by @AzizDXT on GitHub (Dec 22, 2024).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/8000
### **Error Report**
#### **Summary**
You are experiencing two key issues while using OpenWeb UI to upload and summarize PDF files in the chat interface:
1. **Issue 1**:
- When a PDF file is uploaded, it is only processed and summarized correctly if it is the first request in the chat session.
- If you interact with the chat (ask questions or make requests) and then upload a PDF, the file is not processed or summarized.
2. **Issue 2**:
- When you upload multiple PDF files in the same chat session, the system processes and summarizes the **first uploaded file**, ignoring subsequent files.
---
#### **Steps to Reproduce**
1. **Issue 1 (Single File, Delayed Upload):**
- Start a new chat in OpenWeb UI.
- Interact with the chat by asking a question or making a request.
- Upload a PDF file.
- **Observed Behavior**: The PDF is not summarized or processed.
2. **Issue 2 (Multiple Files):**
- Start a new chat in OpenWeb UI.
- Upload a PDF file (File 1).
- Observe that the file is processed and summarized correctly.
- Upload another PDF file (File 2).
- **Observed Behavior**: The system processes and summarizes the content of File 1 instead of File 2.
---
#### **Expected Behavior**
- The system should process and summarize any PDF file uploaded, regardless of the order or timing of the upload.
- When multiple files are uploaded, the system should summarize the most recently uploaded file (File 2 in the second scenario).
---
#### **Root Cause Hypothesis**
1. **Issue 1**:
- The system likely initializes a state to handle the first request in the chat.
- After subsequent interactions, it fails to properly handle or reset this state for PDF uploads.
2. **Issue 2**:
- The system appears to cache the first uploaded file.
- Instead of processing the newly uploaded file, it reuses the cached data from the first file.
---
#### **Proposed Fixes**
1. **For Issue 1**:
- Ensure that the system listens for new file uploads at any point in the chat session.
- Reset or reinitialize the file processing pipeline whenever a new file is uploaded.
2. **For Issue 2**:
- Clear the cached file data after processing each upload.
- Add a mechanism to ensure that the most recently uploaded file is prioritized for processing.
---
#### **Recommended Changes**
1. **State Management:**
- Implement a dynamic state handler that can process new uploads regardless of previous interactions.
- Reset the file handler after each file is processed.
2. **File Cache Clearing:**
- Introduce a mechanism to clear cached file data before processing new uploads.
3. **Testing:**
- Test the system with various scenarios:
- Uploading files after interacting with the chat.
- Uploading multiple files in the same session.
---
#### **Next Steps**
1. Review and debug the file upload handling logic in the OpenWeb UI backend.
2. Implement the proposed fixes to manage file states dynamically.
3. Test the fixes in both single and multi-file upload scenarios to ensure expected behavior.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Originally created by @AzizDXT on GitHub (Dec 22, 2024).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/8000
Error Report
Summary
You are experiencing two key issues while using OpenWeb UI to upload and summarize PDF files in the chat interface:
Issue 1:
Issue 2:
Steps to Reproduce
Issue 1 (Single File, Delayed Upload):
Issue 2 (Multiple Files):
Expected Behavior
Root Cause Hypothesis
Issue 1:
Issue 2:
Proposed Fixes
For Issue 1:
For Issue 2:
Recommended Changes
State Management:
File Cache Clearing:
Testing:
Next Steps