By accessing the chat-message interface through an application, the knowledge base cannot be referenced~ #21564

Open
opened 2026-02-21 20:13:13 -05:00 by yindo · 7 comments
Owner

Originally created by @Jonathan-Wei on GitHub (Jan 10, 2026).

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • 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, otherwise it will be closed.
  • 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.11.2

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

After upgrading Dify to version 1.11.2, when using the API to access the /chat-message interface, the knowledge base cannot be referenced. As shown in the figure below:

Image

When making a dialog request on Dify's debugging and preview page, the knowledge base is referenced normally. As shown in the figure below:

Image

✔️ Expected Behavior

By making an API request to the /chat-message interface, the knowledge base can be referenced normally

Actual Behavior

Unable to reference the knowledge base normally through API access to the /chat-message interface request

Originally created by @Jonathan-Wei on GitHub (Jan 10, 2026). ### Self Checks - [x] I have read the [Contributing Guide](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) and [Language Policy](https://github.com/langgenius/dify/issues/1542). - [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, otherwise it will be closed. - [x] 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.11.2 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce After upgrading Dify to version 1.11.2, when using the API to access the /chat-message interface, the knowledge base cannot be referenced. As shown in the figure below: <img width="645" height="840" alt="Image" src="https://github.com/user-attachments/assets/29e75d23-d52a-403f-8143-4ee589b14649" /> When making a dialog request on Dify's debugging and preview page, the knowledge base is referenced normally. As shown in the figure below: <img width="651" height="839" alt="Image" src="https://github.com/user-attachments/assets/d5a6a541-8da3-4d6f-a838-2a8a2b3fa9f2" /> ### ✔️ Expected Behavior By making an API request to the /chat-message interface, the knowledge base can be referenced normally ### ❌ Actual Behavior Unable to reference the knowledge base normally through API access to the /chat-message interface request
yindo added the 🐞 bugstale labels 2026-02-21 20:13:13 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Jan 10, 2026):

Hi @Jonathan-Wei! I'm Dosu and I’m helping the dify team.

The knowledge base referencing logic for /chat-message is shared between the API and the web UI—both use the same backend code and should behave identically if the dataset configuration is present and correct. There is no code path in Dify v1.11.2 that disables knowledge base referencing for API requests specifically. If the API is not referencing the knowledge base while the web UI does, the most likely causes are differences in the request payload (such as missing or incorrect dataset configuration), environment variables, or how the API request is constructed upstream of the retrieval logic. Double-check that your API requests include the correct dataset IDs and configuration, and that your environment variables match those used by the web UI. If the issue persists, compare the full request payloads and headers between the web UI and your API calls to spot any discrepancies that might affect knowledge base access.
See code details

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

Chat with Dosu Open in Cursor Join Discord Share on X

@dosubot[bot] commented on GitHub (Jan 10, 2026): <!-- Greeting --> Hi @Jonathan-Wei! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the dify team. <!-- Answer --> The knowledge base referencing logic for /chat-message is shared between the API and the web UI—both use the same backend code and should behave identically if the dataset configuration is present and correct. There is no code path in Dify v1.11.2 that disables knowledge base referencing for API requests specifically. If the API is not referencing the knowledge base while the web UI does, the most likely causes are differences in the request payload (such as missing or incorrect dataset configuration), environment variables, or how the API request is constructed upstream of the retrieval logic. Double-check that your API requests include the correct dataset IDs and configuration, and that your environment variables match those used by the web UI. If the issue persists, compare the full request payloads and headers between the web UI and your API calls to spot any discrepancies that might affect knowledge base access. [See code details](https://github.com/langgenius/dify/blob/a2e03b811e581674603617a4b13d9d25760c44be/api/core/app/apps/chat/app_runner.py#L26-L231) <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/3d16775e-1c99-458b-baee-7603235f9651?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/3d16775e-1c99-458b-baee-7603235f9651?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/3d16775e-1c99-458b-baee-7603235f9651?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/3d16775e-1c99-458b-baee-7603235f9651?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/3d16775e-1c99-458b-baee-7603235f9651?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/3d16775e-1c99-458b-baee-7603235f9651?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/3d16775e-1c99-458b-baee-7603235f9651?feedback_type=other)</sup> [![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/6088a4f4-073a-43f3-b3d4-4f06fb0c05a0/ask?utm_source=github)&nbsp;[![Open in Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=The%20knowledge%20base%20referencing%20logic%20for%20/chat-message%20is%20shared%20between%20the%20API%20and%20the%20web%20UI%E2%80%94both%20use%20the%20same%20backend%20code%20and%20should%20behave%20identically%20if%20the%20dataset%20configuration%20is%20present%20and%20correct.%20There%20is%20no%20code%20path%20in%20Dify%20v1.11.2%20that%20disables%20knowledge%20base%20referencing%20for%20API%20requests%20specifically.%20If%20the%20API%20is%20not%20referencing%20the%20knowledge%20base%20while%20the%20web%20UI%20does%2C%20the%20most%20likely%20causes%20are%20differences%20in%20the%20request%20payload%20%28such%20as%20missing%20or%20incorrect%20dataset%20configuration%29%2C%20environment%20variables%2C%20or%20how%20the%20API%20request%20is%20constructed%20upstream%20of%20the%20retrieval%20logic.%20Double-check%20that%20your%20API%20requests%20include%20the%20correct%20dataset%20IDs%20and%20configuration%2C%20and%20that%20your%20environment%20variables%20match%20those%20used%20by%20the%20web%20UI.%20If%20the%20issue%20persists%2C%20compare%20the%20full%20request%20payloads%20and%20headers%20between%20the%20web%20UI%20and%20your%20API%20calls%20to%20spot%20any%20discrepancies%20that%20might%20affect%20knowledge%20base%20access.%20%20%0A%5BSee%20code%20details%5D%28https%3A//github.com/langgenius/dify/blob/a2e03b811e581674603617a4b13d9d25760c44be/api/core/app/apps/chat/app_runner.py%23L26-L231%29)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify/issues/30816)
Author
Owner

@Jonathan-Wei commented on GitHub (Jan 11, 2026):

你好@Jonathan-Wei我是Dosu,我正在协助 dify 团队。

/chat-message 的知识库引用逻辑在 API 和 Web UI 之间共享——它们使用相同的后端代码,如果数据集配置正确,则行为应该完全相同。Dify v1.11.2 中没有专门禁用 API 请求知识库引用的代码路径。如果 API 未引用知识库而 Web UI 引用了,最可能的原因是请求负载存在差异(例如缺少或数据集配置错误)、环境变量不同,或者 API 请求在检索逻辑上游的构造方式不同。请仔细检查您的 API 请求是否包含正确的数据集 ID 和配置,以及您的环境变量是否与 Web UI 使用的环境变量匹配。如果问题仍然存在,请比较 Web UI 和 API 调用之间的完整请求负载和标头,以查找可能影响知识库访问的任何差异。 请参阅代码详情。

回复时只需提及@dosu即可。

我做得怎么样?|无关|错误|冗长|幻觉|举报 🐛 |其他

与 Dosu 聊天 在光标中打开 加入 Discord 分享至 X

The parameters are definitely different. The request parameters for the debugging and preview windows are as follows:

Image

`{
"response_mode": "streaming",
"conversation_id": "",
"files": [

],
"query": "我司准备每个人每个月花30元钱来做企业的产品和服务宣传,有什么产品和套餐可以推荐呢?并给出推荐理由。",
"inputs": {

},
"model_config": {
    "pre_prompt": "# 角色\n你是专业的企业信息专家,作为企业品牌大使,负责准确传达企业信息和价值。\n\n# 核心任务\n**必须优先使用提供的知识库内容回答用户问题**,确保信息的准确性和完整性。\n\n# 知识库使用原则\n1. **强制引用**:当用户问题涉及企业相关信息时,必须首先查询并使用知识库中的内容\n2. **精准匹配**:分析用户问题的关键词和意图,精准匹配知识库中的相关内容\n3. **完整传达**:保持知识库原文的完整性和准确性,不修改、不删减核心信息\n4. **结构化呈现**:将知识库内容以清晰的结构(如分类、列表、要点)组织输出\n\n# 工作流程\n1. **问题分析**:分析用户问题,识别关键信息需求和查询意图\n2. **知识检索**:基于问题关键词,从知识库中检索最相关的信息\n3. **内容组织**:将检索到的知识库内容按照逻辑分类体系组织\n4. **准确回答**:使用知识库内容直接回答用户问题,保持原文准确性\n5. **补充引导**:如有需要,提供进一步了解的联系方式\n\n# 回答格式要求\n- 以清晰的结构化格式呈现信息(标题、分类、要点列表等)\n- 保持专业、友好的语气\n- 确保信息易于阅读和理解\n- 不包含任何XML或代码标签\n\n# 特殊情况处理\n- **知识库有相关信息**:直接使用知识库内容进行回答,并标明信息来源\n- **知识库无相关信息**:如实告知“根据现有资料,我暂时无法提供该问题的详细信息。详细业务问题请咨询电话或微信:15622111728”\n- **问题不明确**:礼貌请求用户澄清问题,以便提供更精准的信息\n- **询问联系方式**:统一回复“请咨询电话或微信:15622111728”\n\n# 重点强调\n**你必须首先尝试从知识库中找到与用户问题相关的信息**,只有在知识库确实没有相关信息时,才使用通用回复。\n\n现在,请根据用户问题,优先从知识库中查找相关信息并提供专业、准确的回答。",
    "prompt_type": "simple",
    "chat_prompt_config": {
        "prompt": [
            {
                "role": "system",
                "text": ""
            }
        ]
    },
    "completion_prompt_config": {
        "prompt": {
            "text": ""
        },
        "conversation_histories_role": {
            "user_prefix": "",
            "assistant_prefix": ""
        }
    },
    "user_input_form": [

    ],
    "dataset_query_variable": "",
    "opening_statement": "",
    "more_like_this": {
        "enabled": false
    },
    "suggested_questions": [

    ],
    "suggested_questions_after_answer": {
        "enabled": false
    },
    "text_to_speech": {
        "voice": "",
        "language": "",
        "enabled": false
    },
    "speech_to_text": {
        "enabled": false
    },
    "retriever_resource": {
        "enabled": false
    },
    "sensitive_word_avoidance": {
        "configs": [

        ],
        "type": "",
        "enabled": false
    },
    "agent_mode": {
        "enabled": false,
        "max_iteration": 10,
        "strategy": "react",
        "tools": [

        ]
    },
    "dataset_configs": {
        "retrieval_model": "multiple",
        "reranking_mode": "weighted_score",
        "top_k": 10,
        "reranking_model": {
            "reranking_model_name": "bce-reranker-base_v1",
            "reranking_provider_name": "langgenius/xinference/xinference"
        },
        "datasets": {
            "datasets": [
                {
                    "dataset": {
                        "enabled": true,
                        "id": "c37e3464-1312-4f6a-8fcb-d511464cfc97"
                    }
                }
            ]
        },
        "weights": {
            "vector_setting": {
                "vector_weight": 0.5,
                "embedding_provider_name": "langgenius/xinference/xinference",
                "embedding_model_name": "xiaobu-embedding-v2"
            },
            "keyword_setting": {
                "keyword_weight": 0.5
            }
        },
        "reranking_enable": false
    },
    "file_upload": {
        "image": {
            "detail": "high",
            "enabled": false,
            "number_limits": 3,
            "transfer_methods": [
                "remote_url",
                "local_file"
            ]
        },
        "enabled": false,
        "allowed_file_types": [

        ],
        "allowed_file_extensions": [
            ".JPG",
            ".JPEG",
            ".PNG",
            ".GIF",
            ".WEBP",
            ".SVG",
            ".MP4",
            ".MOV",
            ".MPEG",
            ".MPGA"
        ],
        "allowed_file_upload_methods": [
            "remote_url",
            "local_file"
        ],
        "number_limits": 3,
        "fileUploadConfig": {
            "file_size_limit": 15,
            "batch_count_limit": 5,
            "image_file_size_limit": 10,
            "video_file_size_limit": 100,
            "audio_file_size_limit": 50,
            "workflow_file_upload_limit": 10,
            "image_file_batch_limit": 10,
            "single_chunk_attachment_limit": 10
        }
    },
    "annotation_reply": {
        "id": "67fb9491-d600-40fe-8252-21e8a866ecf8",
        "enabled": true,
        "score_threshold": 0.9,
        "embedding_model": {
            "embedding_provider_name": "langgenius/xinference/xinference",
            "embedding_model_name": "xiaobu-embedding-v2"
        }
    },
    "supportAnnotation": true,
    "appId": "60e0d63a-670a-491d-8a42-627969ca515c",
    "supportCitationHitInfo": true,
    "model": {
        "provider": "langgenius/openai_api_compatible/openai_api_compatible",
        "name": "feixin",
        "mode": "chat",
        "completion_params": {
            "stop": [

            ],
            "max_tokens": 10000
        }
    }
},
"parent_message_id": null

}`

The parameters of an API request are initiated through the provided API method.

Image

The specific parameters are shown in the figure below
Image

I don't know if there are any other differences. I followed the provided API request method exactly, but it didn't reference the knowledge base.

@dosu , Could you please take a look? Thank you~

@Jonathan-Wei commented on GitHub (Jan 11, 2026): > 你好[@Jonathan-Wei](https://github.com/Jonathan-Wei)我是[Dosu](https://go.dosu.dev/dosubot),我正在协助 dify 团队。 > > /chat-message 的知识库引用逻辑在 API 和 Web UI 之间共享——它们使用相同的后端代码,如果数据集配置正确,则行为应该完全相同。Dify v1.11.2 中没有专门禁用 API 请求知识库引用的代码路径。如果 API 未引用知识库而 Web UI 引用了,最可能的原因是请求负载存在差异(例如缺少或数据集配置错误)、环境变量不同,或者 API 请求在检索逻辑上游的构造方式不同。请仔细检查您的 API 请求是否包含正确的数据集 ID 和配置,以及您的环境变量是否与 Web UI 使用的环境变量匹配。如果问题仍然存在,请比较 Web UI 和 API 调用之间的完整请求负载和标头,以查找可能影响知识库访问的任何差异。 [请参阅代码详情。](https://github.com/langgenius/dify/blob/a2e03b811e581674603617a4b13d9d25760c44be/api/core/app/apps/chat/app_runner.py#L26-L231) > > _回复时只需提及[@dosu](https://go.dosu.dev/dosubot)即可。_ > > 我做得怎么样?[好](https://app.dosu.dev/response-feedback/3d16775e-1c99-458b-baee-7603235f9651?feedback_type=great_response)|[无关](https://app.dosu.dev/response-feedback/3d16775e-1c99-458b-baee-7603235f9651?feedback_type=irrelevant_answer)|[错误](https://app.dosu.dev/response-feedback/3d16775e-1c99-458b-baee-7603235f9651?feedback_type=incorrect_sources)|[冗长](https://app.dosu.dev/response-feedback/3d16775e-1c99-458b-baee-7603235f9651?feedback_type=too_verbose)|[幻觉](https://app.dosu.dev/response-feedback/3d16775e-1c99-458b-baee-7603235f9651?feedback_type=hallucination)|[举报 🐛](https://app.dosu.dev/response-feedback/3d16775e-1c99-458b-baee-7603235f9651?feedback_type=bug_report) |[其他](https://app.dosu.dev/response-feedback/3d16775e-1c99-458b-baee-7603235f9651?feedback_type=other) > > [![与 Dosu 聊天](https://camo.githubusercontent.com/7c571478962a6b8a5d47cac74b6824c75e4f6731bba52377e6007f9150462923/68747470733a2f2f646f73752e6465762f646f73752d636861742d62616467652e737667)](https://app.dosu.dev/6088a4f4-073a-43f3-b3d4-4f06fb0c05a0/ask?utm_source=github) [![在光标中打开](https://camo.githubusercontent.com/bdf7dbded65ee585887f47e5fd6fa099ea0933088b4b03d02e83b4def50154d4/68747470733a2f2f646f73752e6465762f646f73752d696e2d637572736f722e737667)](https://cursor.com/link/prompt?text=The%20knowledge%20base%20referencing%20logic%20for%20/chat-message%20is%20shared%20between%20the%20API%20and%20the%20web%20UI%E2%80%94both%20use%20the%20same%20backend%20code%20and%20should%20behave%20identically%20if%20the%20dataset%20configuration%20is%20present%20and%20correct.%20There%20is%20no%20code%20path%20in%20Dify%20v1.11.2%20that%20disables%20knowledge%20base%20referencing%20for%20API%20requests%20specifically.%20If%20the%20API%20is%20not%20referencing%20the%20knowledge%20base%20while%20the%20web%20UI%20does%2C%20the%20most%20likely%20causes%20are%20differences%20in%20the%20request%20payload%20%28such%20as%20missing%20or%20incorrect%20dataset%20configuration%29%2C%20environment%20variables%2C%20or%20how%20the%20API%20request%20is%20constructed%20upstream%20of%20the%20retrieval%20logic.%20Double-check%20that%20your%20API%20requests%20include%20the%20correct%20dataset%20IDs%20and%20configuration%2C%20and%20that%20your%20environment%20variables%20match%20those%20used%20by%20the%20web%20UI.%20If%20the%20issue%20persists%2C%20compare%20the%20full%20request%20payloads%20and%20headers%20between%20the%20web%20UI%20and%20your%20API%20calls%20to%20spot%20any%20discrepancies%20that%20might%20affect%20knowledge%20base%20access.%20%20%0A%5BSee%20code%20details%5D%28https%3A//github.com/langgenius/dify/blob/a2e03b811e581674603617a4b13d9d25760c44be/api/core/app/apps/chat/app_runner.py%23L26-L231%29) [![加入 Discord](https://camo.githubusercontent.com/7d2066700925db1e370d956834f9ea0e5bc92cecbe84963fbd2a363e45091b4e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6a6f696e2d3538363546323f6c6f676f3d646973636f7264266c6f676f436f6c6f723d7768697465266c6162656c3d)](https://go.dosu.dev/discord-bot) [![分享至 X](https://camo.githubusercontent.com/a8bd7f3fcf3f5e3bd124eee9ae50ae2ac17b40971726665ac2121d48f9aee155/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f582d73686172652d626c61636b)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify/issues/30816) The parameters are definitely different. The request parameters for the debugging and preview windows are as follows: <img width="2547" height="912" alt="Image" src="https://github.com/user-attachments/assets/42660883-85a0-4dec-8d02-25c18fdafb51" /> `{ "response_mode": "streaming", "conversation_id": "", "files": [ ], "query": "我司准备每个人每个月花30元钱来做企业的产品和服务宣传,有什么产品和套餐可以推荐呢?并给出推荐理由。", "inputs": { }, "model_config": { "pre_prompt": "# 角色\n你是专业的企业信息专家,作为企业品牌大使,负责准确传达企业信息和价值。\n\n# 核心任务\n**必须优先使用提供的知识库内容回答用户问题**,确保信息的准确性和完整性。\n\n# 知识库使用原则\n1. **强制引用**:当用户问题涉及企业相关信息时,必须首先查询并使用知识库中的内容\n2. **精准匹配**:分析用户问题的关键词和意图,精准匹配知识库中的相关内容\n3. **完整传达**:保持知识库原文的完整性和准确性,不修改、不删减核心信息\n4. **结构化呈现**:将知识库内容以清晰的结构(如分类、列表、要点)组织输出\n\n# 工作流程\n1. **问题分析**:分析用户问题,识别关键信息需求和查询意图\n2. **知识检索**:基于问题关键词,从知识库中检索最相关的信息\n3. **内容组织**:将检索到的知识库内容按照逻辑分类体系组织\n4. **准确回答**:使用知识库内容直接回答用户问题,保持原文准确性\n5. **补充引导**:如有需要,提供进一步了解的联系方式\n\n# 回答格式要求\n- 以清晰的结构化格式呈现信息(标题、分类、要点列表等)\n- 保持专业、友好的语气\n- 确保信息易于阅读和理解\n- 不包含任何XML或代码标签\n\n# 特殊情况处理\n- **知识库有相关信息**:直接使用知识库内容进行回答,并标明信息来源\n- **知识库无相关信息**:如实告知“根据现有资料,我暂时无法提供该问题的详细信息。详细业务问题请咨询电话或微信:15622111728”\n- **问题不明确**:礼貌请求用户澄清问题,以便提供更精准的信息\n- **询问联系方式**:统一回复“请咨询电话或微信:15622111728”\n\n# 重点强调\n**你必须首先尝试从知识库中找到与用户问题相关的信息**,只有在知识库确实没有相关信息时,才使用通用回复。\n\n现在,请根据用户问题,优先从知识库中查找相关信息并提供专业、准确的回答。", "prompt_type": "simple", "chat_prompt_config": { "prompt": [ { "role": "system", "text": "" } ] }, "completion_prompt_config": { "prompt": { "text": "" }, "conversation_histories_role": { "user_prefix": "", "assistant_prefix": "" } }, "user_input_form": [ ], "dataset_query_variable": "", "opening_statement": "", "more_like_this": { "enabled": false }, "suggested_questions": [ ], "suggested_questions_after_answer": { "enabled": false }, "text_to_speech": { "voice": "", "language": "", "enabled": false }, "speech_to_text": { "enabled": false }, "retriever_resource": { "enabled": false }, "sensitive_word_avoidance": { "configs": [ ], "type": "", "enabled": false }, "agent_mode": { "enabled": false, "max_iteration": 10, "strategy": "react", "tools": [ ] }, "dataset_configs": { "retrieval_model": "multiple", "reranking_mode": "weighted_score", "top_k": 10, "reranking_model": { "reranking_model_name": "bce-reranker-base_v1", "reranking_provider_name": "langgenius/xinference/xinference" }, "datasets": { "datasets": [ { "dataset": { "enabled": true, "id": "c37e3464-1312-4f6a-8fcb-d511464cfc97" } } ] }, "weights": { "vector_setting": { "vector_weight": 0.5, "embedding_provider_name": "langgenius/xinference/xinference", "embedding_model_name": "xiaobu-embedding-v2" }, "keyword_setting": { "keyword_weight": 0.5 } }, "reranking_enable": false }, "file_upload": { "image": { "detail": "high", "enabled": false, "number_limits": 3, "transfer_methods": [ "remote_url", "local_file" ] }, "enabled": false, "allowed_file_types": [ ], "allowed_file_extensions": [ ".JPG", ".JPEG", ".PNG", ".GIF", ".WEBP", ".SVG", ".MP4", ".MOV", ".MPEG", ".MPGA" ], "allowed_file_upload_methods": [ "remote_url", "local_file" ], "number_limits": 3, "fileUploadConfig": { "file_size_limit": 15, "batch_count_limit": 5, "image_file_size_limit": 10, "video_file_size_limit": 100, "audio_file_size_limit": 50, "workflow_file_upload_limit": 10, "image_file_batch_limit": 10, "single_chunk_attachment_limit": 10 } }, "annotation_reply": { "id": "67fb9491-d600-40fe-8252-21e8a866ecf8", "enabled": true, "score_threshold": 0.9, "embedding_model": { "embedding_provider_name": "langgenius/xinference/xinference", "embedding_model_name": "xiaobu-embedding-v2" } }, "supportAnnotation": true, "appId": "60e0d63a-670a-491d-8a42-627969ca515c", "supportCitationHitInfo": true, "model": { "provider": "langgenius/openai_api_compatible/openai_api_compatible", "name": "feixin", "mode": "chat", "completion_params": { "stop": [ ], "max_tokens": 10000 } } }, "parent_message_id": null }` The parameters of an API request are initiated through the provided API method. <img width="1989" height="618" alt="Image" src="https://github.com/user-attachments/assets/e7f6b5e5-6900-4d33-845b-1ffc813ff587" /> The specific parameters are shown in the figure below <img width="1132" height="400" alt="Image" src="https://github.com/user-attachments/assets/a877a484-9f4e-4030-93b2-4f5da169c9c0" /> I don't know if there are any other differences. I followed the provided API request method exactly, but it didn't reference the knowledge base. @dosu , Could you please take a look? Thank you~
Author
Owner

@dosubot[bot] commented on GitHub (Jan 11, 2026):

@Jonathan-Wei

The backend logic for knowledge base referencing is shared between API and web UI, and is triggered by the app's stored configuration—not by extra fields in the API payload. If your app is configured with a knowledge base (dataset) in the Dify UI, API requests to /chat-message should automatically reference it, as long as you use the correct app_id and user context in your API call. There’s no need to manually include dataset_configs or model_config in the API payload if the app is already set up with a dataset in the UI. If the API isn’t referencing the knowledge base while the web UI does, double-check that you’re using the right app_id, that the app is linked to the dataset in the Dify UI, and that your authentication and user context match what’s used in the web UI. This behavior is confirmed in the backend code (source).

If you’re still seeing issues, compare the app configuration and user context between your API request and the web UI to spot any mismatches. Let me know if you need help with a specific API payload example or want to verify your app setup.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

Chat with Dosu Open in Cursor Join Discord Share on X

@dosubot[bot] commented on GitHub (Jan 11, 2026): <!-- Answer --> @Jonathan-Wei The backend logic for knowledge base referencing is shared between API and web UI, and is triggered by the app's stored configuration—not by extra fields in the API payload. If your app is configured with a knowledge base (dataset) in the Dify UI, API requests to `/chat-message` should automatically reference it, as long as you use the correct `app_id` and user context in your API call. There’s no need to manually include `dataset_configs` or `model_config` in the API payload if the app is already set up with a dataset in the UI. If the API isn’t referencing the knowledge base while the web UI does, double-check that you’re using the right `app_id`, that the app is linked to the dataset in the Dify UI, and that your authentication and user context match what’s used in the web UI. This behavior is confirmed in the backend code ([source](https://github.com/langgenius/dify/blob/a2e03b811e581674603617a4b13d9d25760c44be/api/core/app/apps/chat/app_runner.py#L80-L231)). If you’re still seeing issues, compare the app configuration and user context between your API request and the web UI to spot any mismatches. Let me know if you need help with a specific API payload example or want to verify your app setup. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/5b5d1c3d-53df-4a5b-81fd-f7043b01b2b1?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/5b5d1c3d-53df-4a5b-81fd-f7043b01b2b1?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/5b5d1c3d-53df-4a5b-81fd-f7043b01b2b1?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/5b5d1c3d-53df-4a5b-81fd-f7043b01b2b1?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/5b5d1c3d-53df-4a5b-81fd-f7043b01b2b1?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/5b5d1c3d-53df-4a5b-81fd-f7043b01b2b1?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/5b5d1c3d-53df-4a5b-81fd-f7043b01b2b1?feedback_type=other)</sup> [![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/6088a4f4-073a-43f3-b3d4-4f06fb0c05a0/ask?utm_source=github)&nbsp;[![Open in Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=%40Jonathan-Wei%0A%0AThe%20backend%20logic%20for%20knowledge%20base%20referencing%20is%20shared%20between%20API%20and%20web%20UI%2C%20and%20is%20triggered%20by%20the%20app%27s%20stored%20configuration%E2%80%94not%20by%20extra%20fields%20in%20the%20API%20payload.%20If%20your%20app%20is%20configured%20with%20a%20knowledge%20base%20%28dataset%29%20in%20the%20Dify%20UI%2C%20API%20requests%20to%20%60/chat-message%60%20should%20automatically%20reference%20it%2C%20as%20long%20as%20you%20use%20the%20correct%20%60app_id%60%20and%20user%20context%20in%20your%20API%20call.%20There%E2%80%99s%20no%20need%20to%20manually%20include%20%60dataset_configs%60%20or%20%60model_config%60%20in%20the%20API%20payload%20if%20the%20app%20is%20already%20set%20up%20with%20a%20dataset%20in%20the%20UI.%20If%20the%20API%20isn%E2%80%99t%20referencing%20the%20knowledge%20base%20while%20the%20web%20UI%20does%2C%20double-check%20that%20you%E2%80%99re%20using%20the%20right%20%60app_id%60%2C%20that%20the%20app%20is%20linked%20to%20the%20dataset%20in%20the%20Dify%20UI%2C%20and%20that%20your%20authentication%20and%20user%20context%20match%20what%E2%80%99s%20used%20in%20the%20web%20UI.%20This%20behavior%20is%20confirmed%20in%20the%20backend%20code%20%28%5Bsource%5D%28https%3A//github.com/langgenius/dify/blob/a2e03b811e581674603617a4b13d9d25760c44be/api/core/app/apps/chat/app_runner.py%23L80-L231%29%29.%20%0A%0AIf%20you%E2%80%99re%20still%20seeing%20issues%2C%20compare%20the%20app%20configuration%20and%20user%20context%20between%20your%20API%20request%20and%20the%20web%20UI%20to%20spot%20any%20mismatches.%20Let%20me%20know%20if%20you%20need%20help%20with%20a%20specific%20API%20payload%20example%20or%20want%20to%20verify%20your%20app%20setup.)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify/issues/30816)
Author
Owner

@Jonathan-Wei commented on GitHub (Jan 11, 2026):

@Jonathan-Wei

知识库引用的后端逻辑在 API 和 Web UI 之间共享,并由应用程序存储的配置触发,而不是由 API 有效负载中的额外字段触发。如果您的应用程序已在 Dify UI 中配置了知识库(数据集),/chat-message只要您app_id在 API 调用中使用正确的身份验证和用户上下文,API 请求就应该会自动引用它。如果应用程序已经在 UI 中设置了数据集,则无需在 API 有效负载中手动包含dataset_configsmodel_config。如果 API 没有引用知识库,而 Web UI 引用了,请仔细检查您是否使用了正确的app_id,应用程序是否已链接到 Dify UI 中的数据集,以及您的身份验证和用户上下文是否与 Web UI 中使用的一致。此行为已在后端代码中得到验证(源代码)。

如果问题仍然存在,请对比 API 请求和 Web UI 中的应用配置和用户上下文,找出任何不匹配之处。如果您需要特定 API 请求示例的帮助,或者想要验证您的应用设置,请告诉我。

回复时只需提及@dosu即可。

我做得怎么样?|无关|错误|冗长|幻觉|举报 🐛 |其他

与 Dosu 聊天 在光标中打开 加入 Discord 分享至 X

The APP has been correctly associated with the knowledge base, and the configuration is also correct. Why, after making an API request and checking the logs, does it not seem to be referencing the knowledge base?

Image Image

@dosu

@Jonathan-Wei commented on GitHub (Jan 11, 2026): > [@Jonathan-Wei](https://github.com/Jonathan-Wei) > > 知识库引用的后端逻辑在 API 和 Web UI 之间共享,并由应用程序存储的配置触发,而不是由 API 有效负载中的额外字段触发。如果您的应用程序已在 Dify UI 中配置了知识库(数据集),`/chat-message`只要您`app_id`在 API 调用中使用正确的身份验证和用户上下文,API 请求就应该会自动引用它。如果应用程序已经在 UI 中设置了数据集,则无需在 API 有效负载中手动包含`dataset_configs`或`model_config`。如果 API 没有引用知识库,而 Web UI 引用了,请仔细检查您是否使用了正确的`app_id`,应用程序是否已链接到 Dify UI 中的数据集,以及您的身份验证和用户上下文是否与 Web UI 中使用的一致。此行为已在后端代码中得到验证([源代码](https://github.com/langgenius/dify/blob/a2e03b811e581674603617a4b13d9d25760c44be/api/core/app/apps/chat/app_runner.py#L80-L231))。 > > 如果问题仍然存在,请对比 API 请求和 Web UI 中的应用配置和用户上下文,找出任何不匹配之处。如果您需要特定 API 请求示例的帮助,或者想要验证您的应用设置,请告诉我。 > > _回复时只需提及[@dosu](https://go.dosu.dev/dosubot)即可。_ > > 我做得怎么样?[好](https://app.dosu.dev/response-feedback/5b5d1c3d-53df-4a5b-81fd-f7043b01b2b1?feedback_type=great_response)|[无关](https://app.dosu.dev/response-feedback/5b5d1c3d-53df-4a5b-81fd-f7043b01b2b1?feedback_type=irrelevant_answer)|[错误](https://app.dosu.dev/response-feedback/5b5d1c3d-53df-4a5b-81fd-f7043b01b2b1?feedback_type=incorrect_sources)|[冗长](https://app.dosu.dev/response-feedback/5b5d1c3d-53df-4a5b-81fd-f7043b01b2b1?feedback_type=too_verbose)|[幻觉](https://app.dosu.dev/response-feedback/5b5d1c3d-53df-4a5b-81fd-f7043b01b2b1?feedback_type=hallucination)|[举报 🐛](https://app.dosu.dev/response-feedback/5b5d1c3d-53df-4a5b-81fd-f7043b01b2b1?feedback_type=bug_report) |[其他](https://app.dosu.dev/response-feedback/5b5d1c3d-53df-4a5b-81fd-f7043b01b2b1?feedback_type=other) > > [![与 Dosu 聊天](https://camo.githubusercontent.com/7c571478962a6b8a5d47cac74b6824c75e4f6731bba52377e6007f9150462923/68747470733a2f2f646f73752e6465762f646f73752d636861742d62616467652e737667)](https://app.dosu.dev/6088a4f4-073a-43f3-b3d4-4f06fb0c05a0/ask?utm_source=github) [![在光标中打开](https://camo.githubusercontent.com/bdf7dbded65ee585887f47e5fd6fa099ea0933088b4b03d02e83b4def50154d4/68747470733a2f2f646f73752e6465762f646f73752d696e2d637572736f722e737667)](https://cursor.com/link/prompt?text=%40Jonathan-Wei%0A%0AThe%20backend%20logic%20for%20knowledge%20base%20referencing%20is%20shared%20between%20API%20and%20web%20UI%2C%20and%20is%20triggered%20by%20the%20app%27s%20stored%20configuration%E2%80%94not%20by%20extra%20fields%20in%20the%20API%20payload.%20If%20your%20app%20is%20configured%20with%20a%20knowledge%20base%20%28dataset%29%20in%20the%20Dify%20UI%2C%20API%20requests%20to%20%60/chat-message%60%20should%20automatically%20reference%20it%2C%20as%20long%20as%20you%20use%20the%20correct%20%60app_id%60%20and%20user%20context%20in%20your%20API%20call.%20There%E2%80%99s%20no%20need%20to%20manually%20include%20%60dataset_configs%60%20or%20%60model_config%60%20in%20the%20API%20payload%20if%20the%20app%20is%20already%20set%20up%20with%20a%20dataset%20in%20the%20UI.%20If%20the%20API%20isn%E2%80%99t%20referencing%20the%20knowledge%20base%20while%20the%20web%20UI%20does%2C%20double-check%20that%20you%E2%80%99re%20using%20the%20right%20%60app_id%60%2C%20that%20the%20app%20is%20linked%20to%20the%20dataset%20in%20the%20Dify%20UI%2C%20and%20that%20your%20authentication%20and%20user%20context%20match%20what%E2%80%99s%20used%20in%20the%20web%20UI.%20This%20behavior%20is%20confirmed%20in%20the%20backend%20code%20%28%5Bsource%5D%28https%3A//github.com/langgenius/dify/blob/a2e03b811e581674603617a4b13d9d25760c44be/api/core/app/apps/chat/app_runner.py%23L80-L231%29%29.%20%0A%0AIf%20you%E2%80%99re%20still%20seeing%20issues%2C%20compare%20the%20app%20configuration%20and%20user%20context%20between%20your%20API%20request%20and%20the%20web%20UI%20to%20spot%20any%20mismatches.%20Let%20me%20know%20if%20you%20need%20help%20with%20a%20specific%20API%20payload%20example%20or%20want%20to%20verify%20your%20app%20setup.) [![加入 Discord](https://camo.githubusercontent.com/7d2066700925db1e370d956834f9ea0e5bc92cecbe84963fbd2a363e45091b4e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6a6f696e2d3538363546323f6c6f676f3d646973636f7264266c6f676f436f6c6f723d7768697465266c6162656c3d)](https://go.dosu.dev/discord-bot) [![分享至 X](https://camo.githubusercontent.com/a8bd7f3fcf3f5e3bd124eee9ae50ae2ac17b40971726665ac2121d48f9aee155/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f582d73686172652d626c61636b)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify/issues/30816) The APP has been correctly associated with the knowledge base, and the configuration is also correct. Why, after making an API request and checking the logs, does it not seem to be referencing the knowledge base? <img width="2550" height="905" alt="Image" src="https://github.com/user-attachments/assets/ee1ecfe9-b098-43f7-9fc0-2bc59006c5fa" /> <img width="2539" height="896" alt="Image" src="https://github.com/user-attachments/assets/915693b6-3b72-4cf9-8bc4-8afb269562a3" /> @dosu
Author
Owner

@dosubot[bot] commented on GitHub (Jan 11, 2026):

@Jonathan-Wei

The backend logic for knowledge base referencing is indeed shared between API and web UI, and is triggered by the app's stored configuration—not by extra fields in the API payload. If your API requests are not referencing the knowledge base while the web UI does, the most common causes are:

  1. Dataset config missing required fields: In Dify v1.11.2, if your knowledge base (dataset) was created in an older version, it may be missing required fields like weight_type in retrieval_model.weights. This can silently break knowledge base referencing for API calls, even if the UI works. The recommended fix is to create a new knowledge base and re-upload your files to ensure all required fields are present (details).

  2. Datasource parameters not passed: If your dataset requires datasource_parameters (for example, for GitHub or online document sources), these must be included in the inputs field of your API request. Recent updates require this for proper retrieval (details).

  3. User context or token mismatch: The API and web UI may use different user contexts or tokens. Make sure your API request uses the same app_id, user parameter, and Authorization token as the web UI. If the user parameter is missing, the backend may fall back to the tenant owner, which can affect dataset access (details).

  4. Vector DB or embedding provider issues: If your vector database or embedding provider is misconfigured or unavailable, knowledge base retrieval can silently fail or hang for several minutes (details).

To troubleshoot:

  • Compare the API and web UI request headers and payloads, especially user, app_id, and Authorization.
  • Check your dataset config for missing fields (especially weight_type).
  • If using datasources, ensure all required parameters are included in the API request.
  • Enable debug logging and check for retrieval errors or timeouts in the logs.

If you want to share a specific API payload and anonymized debug log, I can help you review them for mismatches.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

Chat with Dosu Open in Cursor Join Discord Share on X

@dosubot[bot] commented on GitHub (Jan 11, 2026): <!-- Answer --> @Jonathan-Wei The backend logic for knowledge base referencing is indeed shared between API and web UI, and is triggered by the app's stored configuration—not by extra fields in the API payload. If your API requests are not referencing the knowledge base while the web UI does, the most common causes are: 1. **Dataset config missing required fields**: In Dify v1.11.2, if your knowledge base (dataset) was created in an older version, it may be missing required fields like `weight_type` in `retrieval_model.weights`. This can silently break knowledge base referencing for API calls, even if the UI works. The recommended fix is to create a new knowledge base and re-upload your files to ensure all required fields are present [(details)](https://github.com/langgenius/dify/issues/16411#issuecomment-2749996546). 2. **Datasource parameters not passed**: If your dataset requires `datasource_parameters` (for example, for GitHub or online document sources), these must be included in the `inputs` field of your API request. Recent updates require this for proper retrieval [(details)](https://github.com/langgenius/dify/pull/29757). 3. **User context or token mismatch**: The API and web UI may use different user contexts or tokens. Make sure your API request uses the same `app_id`, `user` parameter, and Authorization token as the web UI. If the `user` parameter is missing, the backend may fall back to the tenant owner, which can affect dataset access [(details)](https://github.com/langgenius/dify/blob/a2e03b811e581674603617a4b13d9d25760c44be/api/core/app/apps/chat/app_runner.py#L26-L231). 4. **Vector DB or embedding provider issues**: If your vector database or embedding provider is misconfigured or unavailable, knowledge base retrieval can silently fail or hang for several minutes [(details)](https://github.com/langgenius/dify/issues/30225). To troubleshoot: - Compare the API and web UI request headers and payloads, especially `user`, `app_id`, and Authorization. - Check your dataset config for missing fields (especially `weight_type`). - If using datasources, ensure all required parameters are included in the API request. - Enable debug logging and check for retrieval errors or timeouts in the logs. If you want to share a specific API payload and anonymized debug log, I can help you review them for mismatches. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/186a33ef-ff13-48da-925d-0c70074fae9e?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/186a33ef-ff13-48da-925d-0c70074fae9e?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/186a33ef-ff13-48da-925d-0c70074fae9e?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/186a33ef-ff13-48da-925d-0c70074fae9e?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/186a33ef-ff13-48da-925d-0c70074fae9e?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/186a33ef-ff13-48da-925d-0c70074fae9e?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/186a33ef-ff13-48da-925d-0c70074fae9e?feedback_type=other)</sup> [![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/6088a4f4-073a-43f3-b3d4-4f06fb0c05a0/ask?utm_source=github)&nbsp;[![Open in Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=%40Jonathan-Wei%0A%0AThe%20backend%20logic%20for%20knowledge%20base%20referencing%20is%20indeed%20shared%20between%20API%20and%20web%20UI%2C%20and%20is%20triggered%20by%20the%20app%27s%20stored%20configuration%E2%80%94not%20by%20extra%20fields%20in%20the%20API%20payload.%20If%20your%20API%20requests%20are%20not%20referencing%20the%20knowledge%20base%20while%20the%20web%20UI%20does%2C%20the%20most%20common%20causes%20are%3A%0A%0A1.%20%2A%2ADataset%20config%20missing%20required%20fields%2A%2A%3A%20In%20Dify%20v1.11.2%2C%20if%20your%20knowledge%20base%20%28dataset%29%20was%20created%20in%20an%20older%20version%2C%20it%20may%20be%20missing%20required%20fields%20like%20%60weight_type%60%20in%20%60retrieval_model.weights%60.%20This%20can%20silently%20break%20knowledge%20base%20referencing%20for%20API%20calls%2C%20even%20if%20the%20UI%20works.%20The%20recommended%20fix%20is%20to%20create%20a%20new%20knowledge%20base%20and%20re-upload%20your%20files%20to%20ensure%20all%20required%20fields%20are%20present%20%5B%28details%29%5D%28https%3A//github.com/langgenius/dify/issues/16411%23issuecomment-2749996546%29.%0A%0A2.%20%2A%2ADatasource%20parameters%20not%20passed%2A%2A%3A%20If%20your%20dataset%20requires%20%60datasource_parameters%60%20%28for%20example%2C%20for%20GitHub%20or%20online%20document%20sources%29%2C%20these%20must%20be%20included%20in%20the%20%60inputs%60%20field%20of%20your%20API%20request.%20Recent%20updates%20require%20this%20for%20proper%20retrieval%20%5B%28details%29%5D%28https%3A//github.com/langgenius/dify/pull/29757%29.%0A%0A3.%20%2A%2AUser%20context%20or%20token%20mismatch%2A%2A%3A%20The%20API%20and%20web%20UI%20may%20use%20different%20user%20contexts%20or%20tokens.%20Make%20sure%20your%20API%20request%20uses%20the%20same%20%60app_id%60%2C%20%60user%60%20parameter%2C%20and%20Authorization%20token%20as%20the%20web%20UI.%20If%20the%20%60user%60%20parameter%20is%20missing%2C%20the%20backend%20may%20fall%20back%20to%20the%20tenant%20owner%2C%20which%20can%20affect%20dataset%20access%20%5B%28details%29%5D%28https%3A//github.com/langgenius/dify/blob/a2e03b811e581674603617a4b13d9d25760c44be/api/core/app/apps/chat/app_runner.py%23L26-L231%29.%0A%0A4.%20%2A%2AVector%20DB%20or%20embedding%20provider%20issues%2A%2A%3A%20If%20your%20vector%20database%20or%20embedding%20provider%20is%20misconfigured%20or%20unavailable%2C%20knowledge%20base%20retrieval%20can%20silently%20fail%20or%20hang%20for%20several%20minutes%20%5B%28details%29%5D%28https%3A//github.com/langgenius/dify/issues/30225%29.%0A%0ATo%20troubleshoot%3A%0A-%20Compare%20the%20API%20and%20web%20UI%20request%20headers%20and%20payloads%2C%20especially%20%60user%60%2C%20%60app_id%60%2C%20and%20Authorization.%0A-%20Check%20your%20dataset%20config%20for%20missing%20fields%20%28especially%20%60weight_type%60%29.%0A-%20If%20using%20datasources%2C%20ensure%20all%20required%20parameters%20are%20included%20in%20the%20API%20request.%0A-%20Enable%20debug%20logging%20and%20check%20for%20retrieval%20errors%20or%20timeouts%20in%20the%20logs.%0A%0AIf%20you%20want%20to%20share%20a%20specific%20API%20payload%20and%20anonymized%20debug%20log%2C%20I%20can%20help%20you%20review%20them%20for%20mismatches.)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify/issues/30816)
Author
Owner

@Jonathan-Wei commented on GitHub (Jan 16, 2026):

It seems that the link was not intended to convey my meaning. What I meant to say is that the application has been configured with a knowledge base, but when accessing the application through the API, the application does not reference the content of the knowledge base for result return.

@Jonathan-Wei

The backend logic for knowledge base referencing is indeed shared between API and web UI, and is triggered by the app's stored configuration—not by extra fields in the API payload. If your API requests are not referencing the knowledge base while the web UI does, the most common causes are:

  1. Dataset config missing required fields: In Dify v1.11.2, if your knowledge base (dataset) was created in an older version, it may be missing required fields like weight_type in retrieval_model.weights. This can silently break knowledge base referencing for API calls, even if the UI works. The recommended fix is to create a new knowledge base and re-upload your files to ensure all required fields are present (details).
  2. Datasource parameters not passed: If your dataset requires datasource_parameters (for example, for GitHub or online document sources), these must be included in the inputs field of your API request. Recent updates require this for proper retrieval (details).
  3. User context or token mismatch: The API and web UI may use different user contexts or tokens. Make sure your API request uses the same app_id, user parameter, and Authorization token as the web UI. If the user parameter is missing, the backend may fall back to the tenant owner, which can affect dataset access (details).
  4. Vector DB or embedding provider issues: If your vector database or embedding provider is misconfigured or unavailable, knowledge base retrieval can silently fail or hang for several minutes (details).

To troubleshoot:

  • Compare the API and web UI request headers and payloads, especially user, app_id, and Authorization.
  • Check your dataset config for missing fields (especially weight_type).
  • If using datasources, ensure all required parameters are included in the API request.
  • Enable debug logging and check for retrieval errors or timeouts in the logs.

If you want to share a specific API payload and anonymized debug log, I can help you review them for mismatches.

To reply, just mention @dosu.

How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

Chat with Dosu Open in Cursor Join Discord Share on X

@Jonathan-Wei commented on GitHub (Jan 16, 2026): It seems that the link was not intended to convey my meaning. What I meant to say is that the application has been configured with a knowledge base, but when accessing the application through the API, the application does not reference the content of the knowledge base for result return. > [@Jonathan-Wei](https://github.com/Jonathan-Wei) > > The backend logic for knowledge base referencing is indeed shared between API and web UI, and is triggered by the app's stored configuration—not by extra fields in the API payload. If your API requests are not referencing the knowledge base while the web UI does, the most common causes are: > > 1. **Dataset config missing required fields**: In Dify v1.11.2, if your knowledge base (dataset) was created in an older version, it may be missing required fields like `weight_type` in `retrieval_model.weights`. This can silently break knowledge base referencing for API calls, even if the UI works. The recommended fix is to create a new knowledge base and re-upload your files to ensure all required fields are present [(details)](https://github.com/langgenius/dify/issues/16411#issuecomment-2749996546). > 2. **Datasource parameters not passed**: If your dataset requires `datasource_parameters` (for example, for GitHub or online document sources), these must be included in the `inputs` field of your API request. Recent updates require this for proper retrieval [(details)](https://github.com/langgenius/dify/pull/29757). > 3. **User context or token mismatch**: The API and web UI may use different user contexts or tokens. Make sure your API request uses the same `app_id`, `user` parameter, and Authorization token as the web UI. If the `user` parameter is missing, the backend may fall back to the tenant owner, which can affect dataset access [(details)](https://github.com/langgenius/dify/blob/a2e03b811e581674603617a4b13d9d25760c44be/api/core/app/apps/chat/app_runner.py#L26-L231). > 4. **Vector DB or embedding provider issues**: If your vector database or embedding provider is misconfigured or unavailable, knowledge base retrieval can silently fail or hang for several minutes [(details)](https://github.com/langgenius/dify/issues/30225). > > To troubleshoot: > > * Compare the API and web UI request headers and payloads, especially `user`, `app_id`, and Authorization. > * Check your dataset config for missing fields (especially `weight_type`). > * If using datasources, ensure all required parameters are included in the API request. > * Enable debug logging and check for retrieval errors or timeouts in the logs. > > If you want to share a specific API payload and anonymized debug log, I can help you review them for mismatches. > > _To reply, just mention [@dosu](https://go.dosu.dev/dosubot)._ > > How did I do? [Good](https://app.dosu.dev/response-feedback/186a33ef-ff13-48da-925d-0c70074fae9e?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/186a33ef-ff13-48da-925d-0c70074fae9e?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/186a33ef-ff13-48da-925d-0c70074fae9e?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/186a33ef-ff13-48da-925d-0c70074fae9e?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/186a33ef-ff13-48da-925d-0c70074fae9e?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/186a33ef-ff13-48da-925d-0c70074fae9e?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/186a33ef-ff13-48da-925d-0c70074fae9e?feedback_type=other) > > [![Chat with Dosu](https://camo.githubusercontent.com/7c571478962a6b8a5d47cac74b6824c75e4f6731bba52377e6007f9150462923/68747470733a2f2f646f73752e6465762f646f73752d636861742d62616467652e737667)](https://app.dosu.dev/6088a4f4-073a-43f3-b3d4-4f06fb0c05a0/ask?utm_source=github) [![Open in Cursor](https://camo.githubusercontent.com/bdf7dbded65ee585887f47e5fd6fa099ea0933088b4b03d02e83b4def50154d4/68747470733a2f2f646f73752e6465762f646f73752d696e2d637572736f722e737667)](https://cursor.com/link/prompt?text=%40Jonathan-Wei%0A%0AThe%20backend%20logic%20for%20knowledge%20base%20referencing%20is%20indeed%20shared%20between%20API%20and%20web%20UI%2C%20and%20is%20triggered%20by%20the%20app%27s%20stored%20configuration%E2%80%94not%20by%20extra%20fields%20in%20the%20API%20payload.%20If%20your%20API%20requests%20are%20not%20referencing%20the%20knowledge%20base%20while%20the%20web%20UI%20does%2C%20the%20most%20common%20causes%20are%3A%0A%0A1.%20%2A%2ADataset%20config%20missing%20required%20fields%2A%2A%3A%20In%20Dify%20v1.11.2%2C%20if%20your%20knowledge%20base%20%28dataset%29%20was%20created%20in%20an%20older%20version%2C%20it%20may%20be%20missing%20required%20fields%20like%20%60weight_type%60%20in%20%60retrieval_model.weights%60.%20This%20can%20silently%20break%20knowledge%20base%20referencing%20for%20API%20calls%2C%20even%20if%20the%20UI%20works.%20The%20recommended%20fix%20is%20to%20create%20a%20new%20knowledge%20base%20and%20re-upload%20your%20files%20to%20ensure%20all%20required%20fields%20are%20present%20%5B%28details%29%5D%28https%3A//github.com/langgenius/dify/issues/16411%23issuecomment-2749996546%29.%0A%0A2.%20%2A%2ADatasource%20parameters%20not%20passed%2A%2A%3A%20If%20your%20dataset%20requires%20%60datasource_parameters%60%20%28for%20example%2C%20for%20GitHub%20or%20online%20document%20sources%29%2C%20these%20must%20be%20included%20in%20the%20%60inputs%60%20field%20of%20your%20API%20request.%20Recent%20updates%20require%20this%20for%20proper%20retrieval%20%5B%28details%29%5D%28https%3A//github.com/langgenius/dify/pull/29757%29.%0A%0A3.%20%2A%2AUser%20context%20or%20token%20mismatch%2A%2A%3A%20The%20API%20and%20web%20UI%20may%20use%20different%20user%20contexts%20or%20tokens.%20Make%20sure%20your%20API%20request%20uses%20the%20same%20%60app_id%60%2C%20%60user%60%20parameter%2C%20and%20Authorization%20token%20as%20the%20web%20UI.%20If%20the%20%60user%60%20parameter%20is%20missing%2C%20the%20backend%20may%20fall%20back%20to%20the%20tenant%20owner%2C%20which%20can%20affect%20dataset%20access%20%5B%28details%29%5D%28https%3A//github.com/langgenius/dify/blob/a2e03b811e581674603617a4b13d9d25760c44be/api/core/app/apps/chat/app_runner.py%23L26-L231%29.%0A%0A4.%20%2A%2AVector%20DB%20or%20embedding%20provider%20issues%2A%2A%3A%20If%20your%20vector%20database%20or%20embedding%20provider%20is%20misconfigured%20or%20unavailable%2C%20knowledge%20base%20retrieval%20can%20silently%20fail%20or%20hang%20for%20several%20minutes%20%5B%28details%29%5D%28https%3A//github.com/langgenius/dify/issues/30225%29.%0A%0ATo%20troubleshoot%3A%0A-%20Compare%20the%20API%20and%20web%20UI%20request%20headers%20and%20payloads%2C%20especially%20%60user%60%2C%20%60app_id%60%2C%20and%20Authorization.%0A-%20Check%20your%20dataset%20config%20for%20missing%20fields%20%28especially%20%60weight_type%60%29.%0A-%20If%20using%20datasources%2C%20ensure%20all%20required%20parameters%20are%20included%20in%20the%20API%20request.%0A-%20Enable%20debug%20logging%20and%20check%20for%20retrieval%20errors%20or%20timeouts%20in%20the%20logs.%0A%0AIf%20you%20want%20to%20share%20a%20specific%20API%20payload%20and%20anonymized%20debug%20log%2C%20I%20can%20help%20you%20review%20them%20for%20mismatches.) [![Join Discord](https://camo.githubusercontent.com/7d2066700925db1e370d956834f9ea0e5bc92cecbe84963fbd2a363e45091b4e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6a6f696e2d3538363546323f6c6f676f3d646973636f7264266c6f676f436f6c6f723d7768697465266c6162656c3d)](https://go.dosu.dev/discord-bot) [![Share on X](https://camo.githubusercontent.com/a8bd7f3fcf3f5e3bd124eee9ae50ae2ac17b40971726665ac2121d48f9aee155/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f582d73686172652d626c61636b)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify/issues/30816)
Author
Owner

@dosubot[bot] commented on GitHub (Feb 16, 2026):

Hi, @Jonathan-Wei. I'm Dosu, and I'm helping the Dify team manage their backlog and am marking this issue as stale.

Issue Summary:

  • After upgrading to Dify v1.11.2, you noticed that the /chat-message API no longer references the knowledge base, while the web UI still does.
  • The knowledge base referencing logic depends on the app's stored configuration, not directly on API payload fields.
  • Potential causes include missing dataset config fields (e.g., weight_type), missing datasource parameters in API requests, user context or token mismatches, or issues with vector DB/embedding providers.
  • Suggested troubleshooting steps include verifying app_id, user context, dataset config completeness, and comparing API vs UI requests.

Next Steps:

  • Please confirm if this issue is still relevant with the latest version of Dify, and if so, feel free to keep the discussion open by commenting here.
  • Otherwise, I will automatically close this issue in 15 days.

Thank you for your understanding and contribution!

@dosubot[bot] commented on GitHub (Feb 16, 2026): Hi, @Jonathan-Wei. I'm [Dosu](https://dosu.dev), and I'm helping the Dify team manage their backlog and am marking this issue as stale. **Issue Summary:** - After upgrading to Dify v1.11.2, you noticed that the /chat-message API no longer references the knowledge base, while the web UI still does. - The knowledge base referencing logic depends on the app's stored configuration, not directly on API payload fields. - Potential causes include missing dataset config fields (e.g., weight_type), missing datasource parameters in API requests, user context or token mismatches, or issues with vector DB/embedding providers. - Suggested troubleshooting steps include verifying app_id, user context, dataset config completeness, and comparing API vs UI requests. **Next Steps:** - Please confirm if this issue is still relevant with the latest version of Dify, and if so, feel free to keep the discussion open by commenting here. - Otherwise, I will automatically close this issue in 15 days. Thank you for your understanding and contribution!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#21564