When invoking the agent through the API, the "OUTPUT" is empty. #11966

Closed
opened 2026-02-21 19:05:01 -05:00 by yindo · 5 comments
Owner

Originally created by @supperzl on GitHub (Mar 22, 2025).

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

1.1.2

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

1.Initiate a conversation via the /chat - messages interface (the model needs to be the in - depth thinking model) and conduct more than two rounds of conversations.
2.Request the /messages interface to retrieve the conversation history messages. The "answer" field in the output is empty.
3.Check the logs in the background. The historical messages can be seen normally. However, after clicking on the log details, it is found that the "OUTPUT" is also empty. But all nodes are shown to be correct in the "Tracking".

Image
Image

✔️ Expected Behavior

The content should be correctly recorded and returned.

Actual Behavior

The content is not returned correctly.

Originally created by @supperzl on GitHub (Mar 22, 2025). ### 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 1.1.2 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce 1.Initiate a conversation via the /chat - messages interface (the model needs to be the in - depth thinking model) and conduct more than two rounds of conversations. 2.Request the /messages interface to retrieve the conversation history messages. The "answer" field in the output is empty. 3.Check the logs in the background. The historical messages can be seen normally. However, after clicking on the log details, it is found that the "OUTPUT" is also empty. But all nodes are shown to be correct in the "Tracking". ![Image](https://github.com/user-attachments/assets/f81a642f-4ce5-473a-a41b-e2a3ddddda9f) ![Image](https://github.com/user-attachments/assets/747ddfb7-4520-4035-b8c1-c78b35320c18) ### ✔️ Expected Behavior The content should be correctly recorded and returned. ### ❌ Actual Behavior The content is not returned correctly.
yindo added the 🐞 bug label 2026-02-21 19:05:01 -05:00
yindo closed this issue 2026-02-21 19:05:01 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Mar 22, 2025):

Hello @supperzl! I'm here to help you with any bugs, questions, or contributions you may have. Let's work together to resolve this issue.

There are two similar unsolved discussions that might be relevant to your issue:

  1. Calling the API of the agent cannot return data.Help [1].
  2. Why is my output empty [2].

For the issue of the "OUTPUT" being empty when invoking the agent through the API in a self-hosted Dify version 1.1.2 setup, it is likely because the output of the self.session.tool.invoke() function is a Generator, which requires stream parsing. To resolve this, ensure that you are properly parsing the generator output using a function like parse_invoke_response to handle different message types and extract the desired output. Additionally, make sure that the LLM node is properly configured with the required input parameters and output settings before making API calls [3].

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] commented on GitHub (Mar 22, 2025): <!-- Greeting --> Hello @supperzl! I'm here to help you with any bugs, questions, or contributions you may have. Let's work together to resolve this issue. <!-- Answer --> There are two similar unsolved discussions that might be relevant to your issue: 1. [Calling the API of the agent cannot return data.Help](https://github.com/langgenius/dify/discussions/14896) <sup>[[1]](https://github.com/langgenius/dify/discussions/14896)</sup>. 2. [Why is my output empty](https://github.com/langgenius/dify/discussions/14030) <sup>[[2]](https://github.com/langgenius/dify/discussions/14030)</sup>. For the issue of the "OUTPUT" being empty when invoking the agent through the API in a self-hosted Dify version 1.1.2 setup, it is likely because the output of the `self.session.tool.invoke()` function is a Generator, which requires stream parsing. To resolve this, ensure that you are properly parsing the generator output using a function like `parse_invoke_response` to handle different message types and extract the desired output. Additionally, make sure that the LLM node is properly configured with the required input parameters and output settings before making API calls <sup>[[3]](https://github.com/langgenius/dify/issues/12529)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/202c0311-59a3-40fc-9aab-c0bf77003586?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/202c0311-59a3-40fc-9aab-c0bf77003586?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/202c0311-59a3-40fc-9aab-c0bf77003586?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/202c0311-59a3-40fc-9aab-c0bf77003586?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/202c0311-59a3-40fc-9aab-c0bf77003586?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/202c0311-59a3-40fc-9aab-c0bf77003586?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/202c0311-59a3-40fc-9aab-c0bf77003586?feedback_type=other)</sup>
Author
Owner

@crazywoola commented on GitHub (Mar 22, 2025):

Can you provide a minimal DSL for us to reproduce this?

@crazywoola commented on GitHub (Mar 22, 2025): Can you provide a minimal DSL for us to reproduce this?
Author
Owner

@supperzl commented on GitHub (Mar 22, 2025):

Sure, I'll provide a DSL file to help you reproduce the bug.

download: bug test.yml.zip

Steps:

1.Import the DSL file.
2.Execute the curl request in the terminal:

curl -X POST '{base_url}/chat-messages' \
--header 'Authorization: Bearer {api_key}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "inputs": {},
    "query": "你好",
    "response_mode": "streaming",
    "conversation_id": "",
    "user": "abc-123",
    "files": []
}'

3.Replace the conversation_id and continue to ask questions.
4.Request the /messages interface to retrieve the conversation history:

{
    "limit": 20,
    "has_more": false,
    "data": [
        {
            "id": "f75501f0-d3a7-4aca-bb33-7f3365b60a8f",
            "conversation_id": "e7b13ea0-9f76-4044-ba6f-1beebc6c3ba0",
            "parent_message_id": "00000000-0000-0000-0000-000000000000",
            "inputs": {},
            "query": "你好",
            "answer": "你好!有什么可以帮助你的吗?",
            "message_files": [],
            "feedback": null,
            "retriever_resources": [],
            "created_at": 1742645419,
            "agent_thoughts": [
                {
                    "id": "69a67623-f7b1-48d2-9b59-a8111d5e1367",
                    "chain_id": null,
                    "message_id": "f75501f0-d3a7-4aca-bb33-7f3365b60a8f",
                    "position": 1,
                    "thought": "你好!有什么可以帮助你的吗?",
                    "tool": "",
                    "tool_labels": {},
                    "tool_input": "{\"Final Answer\": \"你好!有什么可以帮助你的吗?\"}",
                    "created_at": 1742645419,
                    "observation": "",
                    "files": []
                }
            ],
            "status": "normal",
            "error": null
        },
        {
            "id": "01858338-72df-4669-9e62-a6447d700850",
            "conversation_id": "e7b13ea0-9f76-4044-ba6f-1beebc6c3ba0",
            "parent_message_id": "00000000-0000-0000-0000-000000000000",
            "inputs": {},
            "query": "我想生成一份医学学术报告,要求1万字",
            "answer": "好的,我可以为您提供撰写医学学术报告的结构指导和内容建议。\\n\\n1. 首先需要明确:\\n- 报告主题(如:某疾病的治疗进展/某药物的临床研究)\\n- 目标期刊/机构的具体格式要求\\n- 现有研究数据或参考文献\\n\\n2. 建议标准结构:\\nⅠ 标题页(中英文标题/作者/单位)\\nⅡ 摘要(300-500字,含目的/方法/结果/结论)\\nⅢ 引言(1500字,研究背景与意义)\\nⅣ 材料与方法(2000字,实验设计/样本/统计方法)\\nⅤ 结果(2500字,图表需配合文字分析)\\nⅥ 讨论(3000字,结果解读/局限性/创新性)\\nⅦ 结论(500字)\\nⅧ 参考文献(30-50篇权威文献)\\n\\n请提供具体研究方向或初步资料,我会继续协助您完善各章节内容和学术规范要点。",
            "message_files": [],
            "feedback": null,
            "retriever_resources": [],
            "created_at": 1742645563,
            "agent_thoughts": [
                {
                    "id": "41dd1b12-ea35-405f-bb2c-f5232e4768c1",
                    "chain_id": null,
                    "message_id": "01858338-72df-4669-9e62-a6447d700850",
                    "position": 1,
                    "thought": "好的,我可以为您提供撰写医学学术报告的结构指导和内容建议。\\n\\n1. 首先需要明确:\\n- 报告主题(如:某疾病的治疗进展/某药物的临床研究)\\n- 目标期刊/机构的具体格式要求\\n- 现有研究数据或参考文献\\n\\n2. 建议标准结构:\\nⅠ 标题页(中英文标题/作者/单位)\\nⅡ 摘要(300-500字,含目的/方法/结果/结论)\\nⅢ 引言(1500字,研究背景与意义)\\nⅣ 材料与方法(2000字,实验设计/样本/统计方法)\\nⅤ 结果(2500字,图表需配合文字分析)\\nⅥ 讨论(3000字,结果解读/局限性/创新性)\\nⅦ 结论(500字)\\nⅧ 参考文献(30-50篇权威文献)\\n\\n请提供具体研究方向或初步资料,我会继续协助您完善各章节内容和学术规范要点。",
                    "tool": "",
                    "tool_labels": {},
                    "tool_input": "{\"Final Answer\": \"好的,我可以为您提供撰写医学学术报告的结构指导和内容建议。\\\\n\\\\n1. 首先需要明确:\\\\n- 报告主题(如:某疾病的治疗进展/某药物的临床研究)\\\\n- 目标期刊/机构的具体格式要求\\\\n- 现有研究数据或参考文献\\\\n\\\\n2. 建议标准结构:\\\\nⅠ 标题页(中英文标题/作者/单位)\\\\nⅡ 摘要(300-500字,含目的/方法/结果/结论)\\\\nⅢ 引言(1500字,研究背景与意义)\\\\nⅣ 材料与方法(2000字,实验设计/样本/统计方法)\\\\nⅤ 结果(2500字,图表需配合文字分析)\\\\nⅥ 讨论(3000字,结果解读/局限性/创新性)\\\\nⅦ 结论(500字)\\\\nⅧ 参考文献(30-50篇权威文献)\\\\n\\\\n请提供具体研究方向或初步资料,我会继续协助您完善各章节内容和学术规范要点。\"}",
                    "created_at": 1742645562,
                    "observation": "",
                    "files": []
                }
            ],
            "status": "normal",
            "error": null
        },
        {
            "id": "653b2bf4-669e-4b11-bc6f-65ee46691012",
            "conversation_id": "e7b13ea0-9f76-4044-ba6f-1beebc6c3ba0",
            "parent_message_id": "00000000-0000-0000-0000-000000000000",
            "inputs": {},
            "query": "糖尿病的临床研究",
            "answer": "以下是糖尿病临床研究报告的详细框架与内容规划(可根据实际研究调整):\n\n---\n\n# **2型糖尿病新型口服药XXXX的Ⅲ期临床试验研究**\n\n## **摘要**  \n- 研究背景:全球糖尿病患病率11.3%(IDF 2023),二甲双胍耐受性问题突出  \n- 研究方法:多中心RCT(n=1200),52周双盲对照  \n- 核心发现:HbA1c降低幅度达1.8%(vs对照组1.2%)  \n- 临床意义:首次证实XXXX对胰岛β细胞功能的改善效应\n\n## **材料与方法**  \n### 1. 受试者筛选  \n- 纳入标准:年龄40-70岁、BMI≥23、HbA1c 7.5-10%  \n- 排除标准:肝肾功能异常、1型糖尿病  \n### 2. 试验设计  \n- 随机双盲三臂设计(剂量A组/剂量B组/安慰剂组)  \n- 主要终点:52周HbA1c变化  \n- 次要终点:空腹C肽、低血糖事件\n\n## **结果(示例图表)**  \n| 组别   | ΔHbA1c(%) | 体重变化(kg) | 低血糖发生率 |\n|--------|-----------|--------------|--------------|\n| 剂量A组| -1.8±0.3* | -2.1±1.2     | 3.8%         |\n| 剂量B组| -1.5±0.4* | -1.7±1.1     | 5.2%         |\n| 对照组| -1.2±0.5  | +0.3±0.8     | 12.6%        |\n\n## **讨论**  \n1. 药理机制创新:首次发现XXXX通过AMPK-SIRT1通路改善胰岛素抵抗(附信号通路图)  \n2. 安全性优势:较传统磺脲类药物低血糖风险降低67%(p<0.01)  \n3. 研究局限:未纳入严重肾病并发症患者\n\n需要补充具体实验数据或文献支撑时请随时告知,我可提供:\n- 最新ADA/EASD指南引用规范\n- CONSORT流程图模板\n- STATA/R语言统计分析脚本示例",
            "message_files": [],
            "feedback": null,
            "retriever_resources": [],
            "created_at": 1742645721,
            "agent_thoughts": [
                {
                    "id": "6f85e42d-062a-4f67-8b2f-9114ad3aed98",
                    "chain_id": null,
                    "message_id": "653b2bf4-669e-4b11-bc6f-65ee46691012",
                    "position": 1,
                    "thought": "以下是糖尿病临床研究报告的详细框架与内容规划(可根据实际研究调整):\n\n---\n\n# **2型糖尿病新型口服药XXXX的Ⅲ期临床试验研究**\n\n## **摘要**  \n- 研究背景:全球糖尿病患病率11.3%(IDF 2023),二甲双胍耐受性问题突出  \n- 研究方法:多中心RCT(n=1200),52周双盲对照  \n- 核心发现:HbA1c降低幅度达1.8%(vs对照组1.2%)  \n- 临床意义:首次证实XXXX对胰岛β细胞功能的改善效应\n\n## **材料与方法**  \n### 1. 受试者筛选  \n- 纳入标准:年龄40-70岁、BMI≥23、HbA1c 7.5-10%  \n- 排除标准:肝肾功能异常、1型糖尿病  \n### 2. 试验设计  \n- 随机双盲三臂设计(剂量A组/剂量B组/安慰剂组)  \n- 主要终点:52周HbA1c变化  \n- 次要终点:空腹C肽、低血糖事件\n\n## **结果(示例图表)**  \n| 组别   | ΔHbA1c(%) | 体重变化(kg) | 低血糖发生率 |\n|--------|-----------|--------------|--------------|\n| 剂量A组| -1.8±0.3* | -2.1±1.2     | 3.8%         |\n| 剂量B组| -1.5±0.4* | -1.7±1.1     | 5.2%         |\n| 对照组| -1.2±0.5  | +0.3±0.8     | 12.6%        |\n\n## **讨论**  \n1. 药理机制创新:首次发现XXXX通过AMPK-SIRT1通路改善胰岛素抵抗(附信号通路图)  \n2. 安全性优势:较传统磺脲类药物低血糖风险降低67%(p<0.01)  \n3. 研究局限:未纳入严重肾病并发症患者\n\n需要补充具体实验数据或文献支撑时请随时告知,我可提供:\n- 最新ADA/EASD指南引用规范\n- CONSORT流程图模板\n- STATA/R语言统计分析脚本示例",
                    "tool": "",
                    "tool_labels": {},
                    "tool_input": "{\"Final Answer\": \"以下是糖尿病临床研究报告的详细框架与内容规划(可根据实际研究调整):\\n\\n---\\n\\n# **2型糖尿病新型口服药XXXX的Ⅲ期临床试验研究**\\n\\n## **摘要**  \\n- 研究背景:全球糖尿病患病率11.3%(IDF 2023),二甲双胍耐受性问题突出  \\n- 研究方法:多中心RCT(n=1200),52周双盲对照  \\n- 核心发现:HbA1c降低幅度达1.8%(vs对照组1.2%)  \\n- 临床意义:首次证实XXXX对胰岛β细胞功能的改善效应\\n\\n## **材料与方法**  \\n### 1. 受试者筛选  \\n- 纳入标准:年龄40-70岁、BMI≥23、HbA1c 7.5-10%  \\n- 排除标准:肝肾功能异常、1型糖尿病  \\n### 2. 试验设计  \\n- 随机双盲三臂设计(剂量A组/剂量B组/安慰剂组)  \\n- 主要终点:52周HbA1c变化  \\n- 次要终点:空腹C肽、低血糖事件\\n\\n## **结果(示例图表)**  \\n| 组别   | ΔHbA1c(%) | 体重变化(kg) | 低血糖发生率 |\\n|--------|-----------|--------------|--------------|\\n| 剂量A组| -1.8±0.3* | -2.1±1.2     | 3.8%         |\\n| 剂量B组| -1.5±0.4* | -1.7±1.1     | 5.2%         |\\n| 对照组| -1.2±0.5  | +0.3±0.8     | 12.6%        |\\n\\n## **讨论**  \\n1. 药理机制创新:首次发现XXXX通过AMPK-SIRT1通路改善胰岛素抵抗(附信号通路图)  \\n2. 安全性优势:较传统磺脲类药物低血糖风险降低67%(p<0.01)  \\n3. 研究局限:未纳入严重肾病并发症患者\\n\\n需要补充具体实验数据或文献支撑时请随时告知,我可提供:\\n- 最新ADA/EASD指南引用规范\\n- CONSORT流程图模板\\n- STATA/R语言统计分析脚本示例\"}",
                    "created_at": 1742645721,
                    "observation": "",
                    "files": []
                }
            ],
            "status": "normal",
            "error": null
        },
        {
            "id": "d5f67801-b8b1-404a-9cef-59955c54fd10",
            "conversation_id": "e7b13ea0-9f76-4044-ba6f-1beebc6c3ba0",
            "parent_message_id": "00000000-0000-0000-0000-000000000000",
            "inputs": {},
            "query": "字数有点少了,再写点吧",
            "answer": "",
            "message_files": [],
            "feedback": null,
            "retriever_resources": [],
            "created_at": 1742645827,
            "agent_thoughts": [
                {
                    "id": "6da28cbf-341f-4f91-933b-9623681d1ae9",
                    "chain_id": null,
                    "message_id": "d5f67801-b8b1-404a-9cef-59955c54fd10",
                    "position": 1,
                    "thought": "<think>\n好的,现在需要处理用户的要求:用户之前要求生成一份关于糖尿病临床研究的学术报告,之前已经给出了框架和部分内容,但用户反馈“字数有点少了,再写点吧”。用户想要更多的内容来扩展报告的篇幅,达到1万字的要求。首先,我需要回顾之前提供的结构,看看哪些部分可以进一步细化或增加细节。\n\n之前的回复分为摘要、材料与方法、结果、讨论几个部分,但可能每个部分的细节还不够充分,比如材料与方法部分可以更详细地描述试验设计、入选排除标准的具体数值依据,或者增加统计分析方法的更多细节。结果部分可以添加更多的图表描述和分析,比如更多子组分析或长期随访数据。讨论部分可能需要更深入的文献对比,机制探讨,以及研究限制的详细说明。\n\n此外,可能之前没有涵盖的部分,比如引言部分,应该详细撰写研究背景、现状、研究目的的合理性。此外,参考文献部分需要列举更多相关研究,特别是近年的高质量论文,比如引用2023年的最新指南或重大临床试验结果。\n\n另外,用户可能需要更多的实际数据或示例内容来填充各部分。例如,在材料与方法中,可以详细说明随机分组的方法,盲法实施的具体步骤,随访的时间点和评估指标。在结果部分,除了HbA1c的变化,还可以补充血糖波动性指标、患者生活质量评分、药物依从性数据等。\n\n讨论部分可以增加对研究结果的临床意义,如何改变现有治疗指南,对患者管理的实际影响,以及未来研究方向,比如长期疗效研究或特殊人群中的应用。还可能提到药物经济学分析,尽管这部分可能不在原计划中,但为了增加字数,合理的扩展也是必要的。\n\n需要考虑用户是否是医学研究人员,可能需要更专业的术语和更详细的方法描述,但同时要确保内容准确,符合学术规范。可能还需要指导用户如何根据不同期刊的要求调整格式,比如字数分配、图表数量限制等,但用户当前主要需求是扩展内容,而非格式调整。\n\n总之,需要在现有框架内,对每个部分进行深入拓展,增加数据细节、方法描述、结果分析和讨论深度,引用更多文献,同时可能补充一些新的小节,如研究伦理、数据管理、亚组分析结果等,以达到用户要求的1万字。需要确保所有添加内容科学合理,符合实际研究情况,不会引入错误信息。\n\n</think>\n\n\n{\n  \"action\": \"Final Answer\",\n  \"action_input\": \"以下为补充内容架构(文字可继续扩展):\\n\\n---\\n### **引言扩展(新增800字)**\\n- **流行病学纵深**:\\n  - 对比WHO 2000-2023年全球糖尿病患病率变化趋势(附地理热力图)\\n  - 中国糖尿病防控现状:2023年《柳叶刀》研究指出治疗达标率仅38.6%\\n- **机制研究空白**:\\n  - 当前GLP-1受体激动剂对β细胞再生作用尚无定论(引用Cell Metab. 2022)\\n\\n### **方法学细化(新增1200字)**\\n1. **盲法实施细节**:\\n   - 第三方统计学生成随机序列(SAS v9.4 PROC PLAN)\\n   - 药物采用双模拟技术确保外观一致\\n2. **终点指标扩展**:\\n   - 连续血糖监测(CGM)指标:TIR(70-180mg/dL)提升幅度\\n   - 肠道菌群宏基因组测序(Illumina NovaSeq 6000)\\n\\n### **深度讨论(新增1500字)**\\n- **跨研究对比**:\\n  | 药物      | 本研究HbA1c降幅 | LEADER试验 | SURPASS-3 |\\n  |-----------|-----------------|------------|-----------|\\n  | XXXXXX    | 1.8%            | 0.9%       | 1.4%      |\\n  | 司美格鲁肽 | -               | 1.5%       | 2.0%      |\\n- **临床应用建议**:\\n  - 基于KDIGO指南提出eGFR<30患者剂量调整方案\\n  - 经济学模型:QALY提升0.43/患者(ICER \\$18,200)\\n\\n### **补充图表示例**\\n- 图1. β细胞功能指数(HOMA-β)动态变化(基线/26周/52周)\\n- 表2. 不良事件详细分类(胃肠反应/心血管事件/肝肾毒性)\\n\\n可继续补充以下内容:\\n1. 研究局限性深入分析(500字)\\n2. 创新技术应用(如AI辅助终点判定,新增300字)\\n3. 临床转化路径(产学研合作模式,新增400字)\\n\\n需要具体段落扩写或数据模拟请告知方向,我可提供符合JAMA/NEJM标准的段落模板与统计学描述范例。\"\n}",
                    "tool": "",
                    "tool_labels": {},
                    "tool_input": "",
                    "created_at": 1742645827,
                    "observation": "",
                    "files": []
                }
            ],
            "status": "normal",
            "error": null
        }
    ]
}

Here are the results of my multi - round conversations.
I've tested two models, namely Tongyi Qianwen's official QWQ - 32B and DeepSeek - R1 provided by siliconflow. This problem occurs with both of them.

Image Image
@supperzl commented on GitHub (Mar 22, 2025): Sure, I'll provide a DSL file to help you reproduce the bug. download: [bug test.yml.zip](https://github.com/user-attachments/files/19403070/bug.test.yml.zip) ### Steps: 1.Import the DSL file. 2.Execute the curl request in the terminal: ```bash curl -X POST '{base_url}/chat-messages' \ --header 'Authorization: Bearer {api_key}' \ --header 'Content-Type: application/json' \ --data-raw '{ "inputs": {}, "query": "你好", "response_mode": "streaming", "conversation_id": "", "user": "abc-123", "files": [] }' ``` 3.Replace the conversation_id and continue to ask questions. 4.Request the /messages interface to retrieve the conversation history: ```json { "limit": 20, "has_more": false, "data": [ { "id": "f75501f0-d3a7-4aca-bb33-7f3365b60a8f", "conversation_id": "e7b13ea0-9f76-4044-ba6f-1beebc6c3ba0", "parent_message_id": "00000000-0000-0000-0000-000000000000", "inputs": {}, "query": "你好", "answer": "你好!有什么可以帮助你的吗?", "message_files": [], "feedback": null, "retriever_resources": [], "created_at": 1742645419, "agent_thoughts": [ { "id": "69a67623-f7b1-48d2-9b59-a8111d5e1367", "chain_id": null, "message_id": "f75501f0-d3a7-4aca-bb33-7f3365b60a8f", "position": 1, "thought": "你好!有什么可以帮助你的吗?", "tool": "", "tool_labels": {}, "tool_input": "{\"Final Answer\": \"你好!有什么可以帮助你的吗?\"}", "created_at": 1742645419, "observation": "", "files": [] } ], "status": "normal", "error": null }, { "id": "01858338-72df-4669-9e62-a6447d700850", "conversation_id": "e7b13ea0-9f76-4044-ba6f-1beebc6c3ba0", "parent_message_id": "00000000-0000-0000-0000-000000000000", "inputs": {}, "query": "我想生成一份医学学术报告,要求1万字", "answer": "好的,我可以为您提供撰写医学学术报告的结构指导和内容建议。\\n\\n1. 首先需要明确:\\n- 报告主题(如:某疾病的治疗进展/某药物的临床研究)\\n- 目标期刊/机构的具体格式要求\\n- 现有研究数据或参考文献\\n\\n2. 建议标准结构:\\nⅠ 标题页(中英文标题/作者/单位)\\nⅡ 摘要(300-500字,含目的/方法/结果/结论)\\nⅢ 引言(1500字,研究背景与意义)\\nⅣ 材料与方法(2000字,实验设计/样本/统计方法)\\nⅤ 结果(2500字,图表需配合文字分析)\\nⅥ 讨论(3000字,结果解读/局限性/创新性)\\nⅦ 结论(500字)\\nⅧ 参考文献(30-50篇权威文献)\\n\\n请提供具体研究方向或初步资料,我会继续协助您完善各章节内容和学术规范要点。", "message_files": [], "feedback": null, "retriever_resources": [], "created_at": 1742645563, "agent_thoughts": [ { "id": "41dd1b12-ea35-405f-bb2c-f5232e4768c1", "chain_id": null, "message_id": "01858338-72df-4669-9e62-a6447d700850", "position": 1, "thought": "好的,我可以为您提供撰写医学学术报告的结构指导和内容建议。\\n\\n1. 首先需要明确:\\n- 报告主题(如:某疾病的治疗进展/某药物的临床研究)\\n- 目标期刊/机构的具体格式要求\\n- 现有研究数据或参考文献\\n\\n2. 建议标准结构:\\nⅠ 标题页(中英文标题/作者/单位)\\nⅡ 摘要(300-500字,含目的/方法/结果/结论)\\nⅢ 引言(1500字,研究背景与意义)\\nⅣ 材料与方法(2000字,实验设计/样本/统计方法)\\nⅤ 结果(2500字,图表需配合文字分析)\\nⅥ 讨论(3000字,结果解读/局限性/创新性)\\nⅦ 结论(500字)\\nⅧ 参考文献(30-50篇权威文献)\\n\\n请提供具体研究方向或初步资料,我会继续协助您完善各章节内容和学术规范要点。", "tool": "", "tool_labels": {}, "tool_input": "{\"Final Answer\": \"好的,我可以为您提供撰写医学学术报告的结构指导和内容建议。\\\\n\\\\n1. 首先需要明确:\\\\n- 报告主题(如:某疾病的治疗进展/某药物的临床研究)\\\\n- 目标期刊/机构的具体格式要求\\\\n- 现有研究数据或参考文献\\\\n\\\\n2. 建议标准结构:\\\\nⅠ 标题页(中英文标题/作者/单位)\\\\nⅡ 摘要(300-500字,含目的/方法/结果/结论)\\\\nⅢ 引言(1500字,研究背景与意义)\\\\nⅣ 材料与方法(2000字,实验设计/样本/统计方法)\\\\nⅤ 结果(2500字,图表需配合文字分析)\\\\nⅥ 讨论(3000字,结果解读/局限性/创新性)\\\\nⅦ 结论(500字)\\\\nⅧ 参考文献(30-50篇权威文献)\\\\n\\\\n请提供具体研究方向或初步资料,我会继续协助您完善各章节内容和学术规范要点。\"}", "created_at": 1742645562, "observation": "", "files": [] } ], "status": "normal", "error": null }, { "id": "653b2bf4-669e-4b11-bc6f-65ee46691012", "conversation_id": "e7b13ea0-9f76-4044-ba6f-1beebc6c3ba0", "parent_message_id": "00000000-0000-0000-0000-000000000000", "inputs": {}, "query": "糖尿病的临床研究", "answer": "以下是糖尿病临床研究报告的详细框架与内容规划(可根据实际研究调整):\n\n---\n\n# **2型糖尿病新型口服药XXXX的Ⅲ期临床试验研究**\n\n## **摘要** \n- 研究背景:全球糖尿病患病率11.3%(IDF 2023),二甲双胍耐受性问题突出 \n- 研究方法:多中心RCT(n=1200),52周双盲对照 \n- 核心发现:HbA1c降低幅度达1.8%(vs对照组1.2%) \n- 临床意义:首次证实XXXX对胰岛β细胞功能的改善效应\n\n## **材料与方法** \n### 1. 受试者筛选 \n- 纳入标准:年龄40-70岁、BMI≥23、HbA1c 7.5-10% \n- 排除标准:肝肾功能异常、1型糖尿病 \n### 2. 试验设计 \n- 随机双盲三臂设计(剂量A组/剂量B组/安慰剂组) \n- 主要终点:52周HbA1c变化 \n- 次要终点:空腹C肽、低血糖事件\n\n## **结果(示例图表)** \n| 组别 | ΔHbA1c(%) | 体重变化(kg) | 低血糖发生率 |\n|--------|-----------|--------------|--------------|\n| 剂量A组| -1.8±0.3* | -2.1±1.2 | 3.8% |\n| 剂量B组| -1.5±0.4* | -1.7±1.1 | 5.2% |\n| 对照组| -1.2±0.5 | +0.3±0.8 | 12.6% |\n\n## **讨论** \n1. 药理机制创新:首次发现XXXX通过AMPK-SIRT1通路改善胰岛素抵抗(附信号通路图) \n2. 安全性优势:较传统磺脲类药物低血糖风险降低67%(p<0.01) \n3. 研究局限:未纳入严重肾病并发症患者\n\n需要补充具体实验数据或文献支撑时请随时告知,我可提供:\n- 最新ADA/EASD指南引用规范\n- CONSORT流程图模板\n- STATA/R语言统计分析脚本示例", "message_files": [], "feedback": null, "retriever_resources": [], "created_at": 1742645721, "agent_thoughts": [ { "id": "6f85e42d-062a-4f67-8b2f-9114ad3aed98", "chain_id": null, "message_id": "653b2bf4-669e-4b11-bc6f-65ee46691012", "position": 1, "thought": "以下是糖尿病临床研究报告的详细框架与内容规划(可根据实际研究调整):\n\n---\n\n# **2型糖尿病新型口服药XXXX的Ⅲ期临床试验研究**\n\n## **摘要** \n- 研究背景:全球糖尿病患病率11.3%(IDF 2023),二甲双胍耐受性问题突出 \n- 研究方法:多中心RCT(n=1200),52周双盲对照 \n- 核心发现:HbA1c降低幅度达1.8%(vs对照组1.2%) \n- 临床意义:首次证实XXXX对胰岛β细胞功能的改善效应\n\n## **材料与方法** \n### 1. 受试者筛选 \n- 纳入标准:年龄40-70岁、BMI≥23、HbA1c 7.5-10% \n- 排除标准:肝肾功能异常、1型糖尿病 \n### 2. 试验设计 \n- 随机双盲三臂设计(剂量A组/剂量B组/安慰剂组) \n- 主要终点:52周HbA1c变化 \n- 次要终点:空腹C肽、低血糖事件\n\n## **结果(示例图表)** \n| 组别 | ΔHbA1c(%) | 体重变化(kg) | 低血糖发生率 |\n|--------|-----------|--------------|--------------|\n| 剂量A组| -1.8±0.3* | -2.1±1.2 | 3.8% |\n| 剂量B组| -1.5±0.4* | -1.7±1.1 | 5.2% |\n| 对照组| -1.2±0.5 | +0.3±0.8 | 12.6% |\n\n## **讨论** \n1. 药理机制创新:首次发现XXXX通过AMPK-SIRT1通路改善胰岛素抵抗(附信号通路图) \n2. 安全性优势:较传统磺脲类药物低血糖风险降低67%(p<0.01) \n3. 研究局限:未纳入严重肾病并发症患者\n\n需要补充具体实验数据或文献支撑时请随时告知,我可提供:\n- 最新ADA/EASD指南引用规范\n- CONSORT流程图模板\n- STATA/R语言统计分析脚本示例", "tool": "", "tool_labels": {}, "tool_input": "{\"Final Answer\": \"以下是糖尿病临床研究报告的详细框架与内容规划(可根据实际研究调整):\\n\\n---\\n\\n# **2型糖尿病新型口服药XXXX的Ⅲ期临床试验研究**\\n\\n## **摘要** \\n- 研究背景:全球糖尿病患病率11.3%(IDF 2023),二甲双胍耐受性问题突出 \\n- 研究方法:多中心RCT(n=1200),52周双盲对照 \\n- 核心发现:HbA1c降低幅度达1.8%(vs对照组1.2%) \\n- 临床意义:首次证实XXXX对胰岛β细胞功能的改善效应\\n\\n## **材料与方法** \\n### 1. 受试者筛选 \\n- 纳入标准:年龄40-70岁、BMI≥23、HbA1c 7.5-10% \\n- 排除标准:肝肾功能异常、1型糖尿病 \\n### 2. 试验设计 \\n- 随机双盲三臂设计(剂量A组/剂量B组/安慰剂组) \\n- 主要终点:52周HbA1c变化 \\n- 次要终点:空腹C肽、低血糖事件\\n\\n## **结果(示例图表)** \\n| 组别 | ΔHbA1c(%) | 体重变化(kg) | 低血糖发生率 |\\n|--------|-----------|--------------|--------------|\\n| 剂量A组| -1.8±0.3* | -2.1±1.2 | 3.8% |\\n| 剂量B组| -1.5±0.4* | -1.7±1.1 | 5.2% |\\n| 对照组| -1.2±0.5 | +0.3±0.8 | 12.6% |\\n\\n## **讨论** \\n1. 药理机制创新:首次发现XXXX通过AMPK-SIRT1通路改善胰岛素抵抗(附信号通路图) \\n2. 安全性优势:较传统磺脲类药物低血糖风险降低67%(p<0.01) \\n3. 研究局限:未纳入严重肾病并发症患者\\n\\n需要补充具体实验数据或文献支撑时请随时告知,我可提供:\\n- 最新ADA/EASD指南引用规范\\n- CONSORT流程图模板\\n- STATA/R语言统计分析脚本示例\"}", "created_at": 1742645721, "observation": "", "files": [] } ], "status": "normal", "error": null }, { "id": "d5f67801-b8b1-404a-9cef-59955c54fd10", "conversation_id": "e7b13ea0-9f76-4044-ba6f-1beebc6c3ba0", "parent_message_id": "00000000-0000-0000-0000-000000000000", "inputs": {}, "query": "字数有点少了,再写点吧", "answer": "", "message_files": [], "feedback": null, "retriever_resources": [], "created_at": 1742645827, "agent_thoughts": [ { "id": "6da28cbf-341f-4f91-933b-9623681d1ae9", "chain_id": null, "message_id": "d5f67801-b8b1-404a-9cef-59955c54fd10", "position": 1, "thought": "<think>\n好的,现在需要处理用户的要求:用户之前要求生成一份关于糖尿病临床研究的学术报告,之前已经给出了框架和部分内容,但用户反馈“字数有点少了,再写点吧”。用户想要更多的内容来扩展报告的篇幅,达到1万字的要求。首先,我需要回顾之前提供的结构,看看哪些部分可以进一步细化或增加细节。\n\n之前的回复分为摘要、材料与方法、结果、讨论几个部分,但可能每个部分的细节还不够充分,比如材料与方法部分可以更详细地描述试验设计、入选排除标准的具体数值依据,或者增加统计分析方法的更多细节。结果部分可以添加更多的图表描述和分析,比如更多子组分析或长期随访数据。讨论部分可能需要更深入的文献对比,机制探讨,以及研究限制的详细说明。\n\n此外,可能之前没有涵盖的部分,比如引言部分,应该详细撰写研究背景、现状、研究目的的合理性。此外,参考文献部分需要列举更多相关研究,特别是近年的高质量论文,比如引用2023年的最新指南或重大临床试验结果。\n\n另外,用户可能需要更多的实际数据或示例内容来填充各部分。例如,在材料与方法中,可以详细说明随机分组的方法,盲法实施的具体步骤,随访的时间点和评估指标。在结果部分,除了HbA1c的变化,还可以补充血糖波动性指标、患者生活质量评分、药物依从性数据等。\n\n讨论部分可以增加对研究结果的临床意义,如何改变现有治疗指南,对患者管理的实际影响,以及未来研究方向,比如长期疗效研究或特殊人群中的应用。还可能提到药物经济学分析,尽管这部分可能不在原计划中,但为了增加字数,合理的扩展也是必要的。\n\n需要考虑用户是否是医学研究人员,可能需要更专业的术语和更详细的方法描述,但同时要确保内容准确,符合学术规范。可能还需要指导用户如何根据不同期刊的要求调整格式,比如字数分配、图表数量限制等,但用户当前主要需求是扩展内容,而非格式调整。\n\n总之,需要在现有框架内,对每个部分进行深入拓展,增加数据细节、方法描述、结果分析和讨论深度,引用更多文献,同时可能补充一些新的小节,如研究伦理、数据管理、亚组分析结果等,以达到用户要求的1万字。需要确保所有添加内容科学合理,符合实际研究情况,不会引入错误信息。\n\n</think>\n\n\n{\n \"action\": \"Final Answer\",\n \"action_input\": \"以下为补充内容架构(文字可继续扩展):\\n\\n---\\n### **引言扩展(新增800字)**\\n- **流行病学纵深**:\\n - 对比WHO 2000-2023年全球糖尿病患病率变化趋势(附地理热力图)\\n - 中国糖尿病防控现状:2023年《柳叶刀》研究指出治疗达标率仅38.6%\\n- **机制研究空白**:\\n - 当前GLP-1受体激动剂对β细胞再生作用尚无定论(引用Cell Metab. 2022)\\n\\n### **方法学细化(新增1200字)**\\n1. **盲法实施细节**:\\n - 第三方统计学生成随机序列(SAS v9.4 PROC PLAN)\\n - 药物采用双模拟技术确保外观一致\\n2. **终点指标扩展**:\\n - 连续血糖监测(CGM)指标:TIR(70-180mg/dL)提升幅度\\n - 肠道菌群宏基因组测序(Illumina NovaSeq 6000)\\n\\n### **深度讨论(新增1500字)**\\n- **跨研究对比**:\\n | 药物 | 本研究HbA1c降幅 | LEADER试验 | SURPASS-3 |\\n |-----------|-----------------|------------|-----------|\\n | XXXXXX | 1.8% | 0.9% | 1.4% |\\n | 司美格鲁肽 | - | 1.5% | 2.0% |\\n- **临床应用建议**:\\n - 基于KDIGO指南提出eGFR<30患者剂量调整方案\\n - 经济学模型:QALY提升0.43/患者(ICER \\$18,200)\\n\\n### **补充图表示例**\\n- 图1. β细胞功能指数(HOMA-β)动态变化(基线/26周/52周)\\n- 表2. 不良事件详细分类(胃肠反应/心血管事件/肝肾毒性)\\n\\n可继续补充以下内容:\\n1. 研究局限性深入分析(500字)\\n2. 创新技术应用(如AI辅助终点判定,新增300字)\\n3. 临床转化路径(产学研合作模式,新增400字)\\n\\n需要具体段落扩写或数据模拟请告知方向,我可提供符合JAMA/NEJM标准的段落模板与统计学描述范例。\"\n}", "tool": "", "tool_labels": {}, "tool_input": "", "created_at": 1742645827, "observation": "", "files": [] } ], "status": "normal", "error": null } ] } ``` Here are the results of my multi - round conversations. I've tested two models, namely Tongyi Qianwen's official QWQ - 32B and DeepSeek - R1 provided by siliconflow. This problem occurs with both of them. <img width="613" alt="Image" src="https://github.com/user-attachments/assets/883adc25-f341-4784-9794-3eb4afe08f06" /> <img width="1069" alt="Image" src="https://github.com/user-attachments/assets/48f6a337-8123-4e0e-b5f5-f4530910b2b1" />
Author
Owner

@yj11 commented on GitHub (Mar 31, 2025):

I have a same question. I hope it's resolved soon.
Thanks.

@yj11 commented on GitHub (Mar 31, 2025): I have a same question. I hope it's resolved soon. Thanks.
Author
Owner

@dosubot[bot] commented on GitHub (May 1, 2025):

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

Issue Summary

  • You reported an issue with the "OUTPUT" field being empty when using the Dify API in a self-hosted environment.
  • Logs show historical messages correctly, but the output may require stream parsing.
  • I suggested ensuring proper parsing and configuration.
  • You provided a minimal DSL for reproduction along with detailed steps and test results.
  • Another user, "yj11," also reported experiencing the same issue.

Next Steps

  • Please confirm if this issue is still relevant to the latest version of the Dify repository by commenting here.
  • If no updates are provided, this issue will be automatically closed in 15 days.

Thank you for your understanding and contribution!

@dosubot[bot] commented on GitHub (May 1, 2025): Hi, @supperzl. I'm [Dosu](https://dosu.dev), and I'm helping the Dify team manage their backlog. I'm marking this issue as stale. **Issue Summary** - You reported an issue with the "OUTPUT" field being empty when using the Dify API in a self-hosted environment. - Logs show historical messages correctly, but the output may require stream parsing. - I suggested ensuring proper parsing and configuration. - You provided a minimal DSL for reproduction along with detailed steps and test results. - Another user, "yj11," also reported experiencing the same issue. **Next Steps** - Please confirm if this issue is still relevant to the latest version of the Dify repository by commenting here. - If no updates are provided, this issue will be automatically closed 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#11966