Uploaded file name does not match the name in the knowledge base
Self Checks
- [x] This is only for bug report, if you would like to ask a question, please head to Discussions.
- [x] I have searched for existing issues search for existing issues, including closed ones.
- [x] I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
- [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
- [x] Please do not modify this template :) and fill in all the required fields.
Dify version
0.15.3
Cloud or Self Hosted
Self Hosted (Docker)
Steps to reproduce
Modify the file name in the knowledge base. Call the GET /datasets/{dataset_id}/documents/{document_id}/upload-file API to retrieve file details. The file name returned does not match the file name in the knowledge base.
✔️ Expected Behavior
The file name returned should match the modified file name in the knowledge base to ensure consistency.
❌ Actual Behavior
The file name returned does not match the file name in the knowledge base.
The discrepancy between the uploaded file name and the name in the knowledge base could be due to caching mechanisms. The ApolloClient class uses both a local cache and a file cache to store configurations, which might lead to outdated data being served if the cache is not updated correctly [1].
To address this issue, you might want to ensure that the cache is properly invalidated or updated after modifying the file name in the knowledge base. This could involve checking the implementation of the _update_cache_and_file method to ensure it is functioning as expected. Additionally, verify that any caching layers in your deployment environment are configured to refresh or invalidate appropriately after updates.
To continue talking to Dosu, mention @dosu.
Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other | Bug Report
After querying the upload_files table in the database, it was found that the fields stored in the database were not updated to the changed names. @dosu
It seems that the issue might be related to the synchronization between the knowledge base and the upload_files table in the database. If the file names in the database are not updated after changes in the knowledge base, it could be due to a lack of triggers or mechanisms to propagate these changes.
Unfortunately, I couldn't find specific information in the repository about any triggers or events that update the upload_files table when a file name is changed in the knowledge base. You might need to implement a mechanism to ensure that changes in the knowledge base are reflected in the database. This could involve adding a function or method to handle the synchronization process or checking if there are any existing processes that should be doing this but are not functioning correctly.
To continue talking to Dosu, mention @dosu.
Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other | Bug Report
Can you paste the original payload and the endpoint you mentioned above?
怎么修改上传文件名
改名后获取文件和下载文件都是原本的名字 @crazywoola
This endpoint only upload the file.
``
@crazywoola
How can I get the document name through the upload file field_id ? @dosu
To retrieve the document name using the upload_file_id, you would typically need to query the database where the upload_files table is stored. This table should have a relationship with the documents in the knowledge base. However, if you're looking to do this through an API, you might need to use an endpoint that allows you to fetch document details based on the upload_file_id.
If the current API does not support this directly, you might need to implement a custom query or endpoint that joins the upload_files table with the documents table to retrieve the document name using the upload_file_id. This would involve accessing the database directly or modifying the backend to support such a query.
If you have access to the database schema, you can write a SQL query to join the tables and fetch the document name. If not, you might need to check if there's an existing API endpoint that can be extended or modified to include this functionality.
To continue talking to Dosu, mention @dosu.
Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other | Bug Report