dify icon indicating copy to clipboard operation
dify copied to clipboard

Get empty retriever_resources parameter in API with /messages method

Open lyc280705 opened this issue 9 months ago • 9 comments

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

v1.0.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

In webpage there are retrieved resources:

Image In API and only with /messages method the list is empty, it works well with /chat-message method:

{
    "limit": 20,
    "has_more": false,
    "data": [
        {
            "id": "a87431be-ab19-4bb2-bc14-8e4d07bb489c",
            "conversation_id": "65e69008-a4d2-48f8-8d37-ee02c7cf46ec",
            "parent_message_id": "00000000-0000-0000-0000-000000000000",
            "inputs": {},
            "query": "什么是勾股定理",
            "answer": "勾股定理是一个基本的几何定理,它描述了直角三角形中三边之间的关系。具体来说,勾股定理指出:**在直角三角形中,两条直角边的平方和等于斜边的平方**。\n\n用数学公式表示就是:  \n$$\na^2 + b^2 = c^2\n$$\n其中,$a$ 和 $b$ 是直角三角形的两条直角边,$c$ 是斜边(即直角三角形中与直角相对的最长边)。\n\n---\n\n### **勾股定理的来源**\n在中国古代,直角三角形被称为“勾股形”,其中较短的直角边称为“勾”,较长的直角边称为“股”,斜边称为“弦”。因此,这个定理在中国也被称为“勾股定理”或“商高定理”。\n\n---\n\n### **勾股定理的几何意义**\n勾股定理揭示了直角三角形中三边之间的数量关系。它不仅是一个数学公式",
            "message_files": [],
            "feedback": null,
            "retriever_resources": [],         //null
            "created_at": 1740830044,
            "agent_thoughts": [],
            "status": "normal",
            "error": null
        }
    ]
}

✔️ Expected Behavior

Get a list of retrievered resources.

❌ Actual Behavior

Get empty list.

lyc280705 avatar Mar 02 '25 04:03 lyc280705

I found a similar unsolved discussion regarding the issue of the API returning an empty retriever_resources parameter when using the /messages method [1]. Additionally, there is an open issue suggesting a solution:

  1. Configuration Check: Ensure that the show_retrieve_source feature is enabled in your application's configuration. This feature controls whether retriever_resources are included in the response. If it's not enabled, the retriever_resources will not be included. This configuration is found in the app_config.additional_features of the application_generate_entity and is managed by the RetrievalResourceConfigManager class. You may need to check the configuration files or the backend code to ensure that the retriever_resource is enabled [2].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

dosubot[bot] avatar Mar 02 '25 04:03 dosubot[bot]

I can't find a solution in similar issues. Please don't close it with duplicated.

lyc280705 avatar Mar 02 '25 04:03 lyc280705

The same problem occurs in web app @crazywoola : New chat: Image Switch to other tab and switch back:

Image

lyc280705 avatar Mar 02 '25 06:03 lyc280705

The same problem occurs in web app @crazywoola : New chat: Image Switch to other tab and switch back:

Image

The bug also occurs on dify cloud

lyc280705 avatar Mar 02 '25 07:03 lyc280705

Will take a look at it later.

crazywoola avatar Mar 02 '25 13:03 crazywoola

Any updates?@crazywoola

lyc280705 avatar Mar 04 '25 03:03 lyc280705

The same bug I meet, which version will be resolved ? Thanks. @crazywoola

kolagood avatar Mar 08 '25 01:03 kolagood

Haven't got time to fix this yet.

crazywoola avatar Mar 12 '25 10:03 crazywoola

It's a fatal question.

cgk100 avatar Mar 28 '25 12:03 cgk100

I submitted a PR #17304

liguochuan00 avatar Apr 02 '25 02:04 liguochuan00

I have the same problem

2842902295 avatar Apr 08 '25 07:04 2842902295

I also met the same question that the 'retriever_resources' is null. And the feature control is enable

Image

{ 'event': 'message', 'task_id': '15a26101-dae6-47d2-b8ac-d839070a1b79', 'id': '71fa8f8b-7246-47bc-bc34-17d484539ff8', 'message_id': '71fa8f8b-7246-47bc-bc34-17d484539ff8', 'conversation_id': '2a720c0c-ce66-48a7-8c8c-83ce17d69d6e', 'mode': 'advanced-chat', 'answer': "\n", 'metadata': { 'annotation_reply': None, 'retriever_resources': [], //null 'usage': {...} }, 'created_at': 1756712258 }

LimitedLi avatar Sep 01 '25 08:09 LimitedLi