Knowledge base image recall cannot be accessed #5555

Closed
opened 2026-02-21 18:11:35 -05:00 by yindo · 2 comments
Owner

Originally created by @401557122 on GitHub (Sep 11, 2024).

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • 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"

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

Originally created by @401557122 on GitHub (Sep 11, 2024). ### Self Checks - [X] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [X] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [X] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [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]({dify_config.CONSOLE_API_URL}/files/{upload_file.id}/image-preview)" ![image](https://github.com/user-attachments/assets/9c89fc23-9abd-464a-8c9a-2fd241472135) ### ✔️ 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_
yindo closed this issue 2026-02-21 18:11:35 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Sep 11, 2024):

I found some similar discussions that might be relevant to your issue:

  1. How to access image in knowledge repository? - This discussion is still open and might provide insights into accessing images in the knowledge repository [1].
  2. knowledge base usage - This discussion is also open and discusses the usage of the knowledge base [2].
  3. 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.

@dosubot[bot] commented on GitHub (Sep 11, 2024): <!-- Answer --> I found some similar discussions that might be relevant to your issue: 1. [How to access image in knowledge repository?](https://github.com/langgenius/dify/discussions/8122) - This discussion is still open and might provide insights into accessing images in the knowledge repository <sup>[[1]](https://github.com/langgenius/dify/discussions/8122)</sup>. 2. [knowledge base usage](https://github.com/langgenius/dify/discussions/7604) - This discussion is also open and discusses the usage of the knowledge base <sup>[[2]](https://github.com/langgenius/dify/discussions/7604)</sup>. 3. [Where are the images and files generated by Dify stored? Also, the tool's API cannot access the generated files.](https://github.com/langgenius/dify/discussions/7380) - This discussion is open and addresses issues related to file storage and API access <sup>[[3]](https://github.com/langgenius/dify/discussions/7380)</sup>. 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: ```plaintext # 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 <sup>[[4]](https://github.com/langgenius/dify/blob/main/api/tests/unit_tests/configs/test_dify_config.py)</sup><sup>[[5]](https://github.com/langgenius/dify-docs/blob/main/jp/getting-started/install-self-hosted/environments.md)</sup><sup>[[6]](https://github.com/langgenius/dify/blob/main/api/.env.example)</sup><sup>[[7]](https://github.com/langgenius/dify-docs/blob/main/en/getting-started/install-self-hosted/environments.md)</sup>. 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: ```python 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 <sup>[[8]](https://github.com/langgenius/dify/blob/main/api/controllers/files/image_preview.py)</sup>. Make sure these configurations and implementations are correctly set up in your environment to resolve the issue with accessing the markdown link for images. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Author
Owner

@crazywoola commented on GitHub (Sep 11, 2024):

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
image
@crazywoola commented on GitHub (Sep 11, 2024): 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 <img width="415" alt="image" src="https://github.com/user-attachments/assets/53637267-b852-496b-bed4-f80bdc9ce7b5">
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#5555