Knowledge base image recall cannot be accessed
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.7.0
Cloud or Self Hosted
Self Hosted (Docker)
Steps to reproduce
The markdown file link returned by the knowledge base storage file is as follows, but it seems that this link cannot be displayed or accessed in the intelligent agent image_map[rel.target_part] = ( f"! image"
✔️ Expected Behavior
The markdown link that needs to be saved can be accessed so that the agent can display recommendations for the user
❌ Actual Behavior
No response
I found some similar discussions that might be relevant to your issue:
- How to access image in knowledge repository? - This discussion is still open and might provide insights into accessing images in the knowledge repository [1].
- knowledge base usage - This discussion is also open and discusses the usage of the knowledge base [2].
- Where are the images and files generated by Dify stored? Also, the tool's API cannot access the generated files. - This discussion is open and addresses issues related to file storage and API access [3].
Regarding your specific issue, it seems like the CONSOLE_API_URL might not be correctly set, which is crucial for accessing files. Ensure that the CONSOLE_API_URL and FILES_URL are properly configured in your environment settings. Here are the relevant configurations:
# Console API base URL
CONSOLE_API_URL=http://127.0.0.1:5001
# Files URL
FILES_URL=http://127.0.0.1:5001
# The time in seconds after the signature is rejected
FILES_ACCESS_TIMEOUT=300
These settings should be updated in your environment configuration file to match your deployment requirements [4][5][6][7].
Additionally, the image-preview endpoint implementation in the Dify codebase handles image retrieval and display. Ensure that the timestamp, nonce, and sign parameters are correctly passed and validated. Here is the relevant code snippet:
class ImagePreviewApi(Resource):
def get(self, file_id):
file_id = str(file_id)
timestamp = request.args.get("timestamp")
nonce = request.args.get("nonce")
sign = request.args.get("sign")
if not timestamp or not nonce or not sign:
return {"content": "Invalid request."}, 400
try:
generator, mimetype = FileService.get_image_preview(file_id, timestamp, nonce, sign)
except services.errors.file.UnsupportedFileTypeError:
raise UnsupportedFileTypeError()
return Response(generator, mimetype=mimetype)
This method ensures that the image content is retrieved and displayed correctly [8].
Make sure these configurations and implementations are correctly set up in your environment to resolve the issue with accessing the markdown link for images.
To continue talking to Dosu, mention @dosu.
If you would like to let the agent to understand the image. You need to make sure below things:
- The LLM is vision ready
- You need to to turn on the image uploading feature
- You need to upload image or insert the link in the UI