dify icon indicating copy to clipboard operation
dify copied to clipboard

Text generation output error

Open kelinkong opened this issue 3 months ago • 4 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

https://cloud.dify.ai/

Cloud or Self Hosted

Cloud

Steps to reproduce

I am using text generation AI to create a test question generation assistant. Here is my prompt:

<instruction>
请根据{{{context}}}}生成试题。确保输出包含必要的信息,如题目内容、选项、正确答案等。输出格式应为JSON,不得包含任何XML标签。

步骤:
1. 从知识库中查询与用户输入的试题难度、试题类型相关的内容。
2. 根据查询结果生成指定数量的试题。
3. 每个试题应包含题目内容、选项和正确答案。
4. 将所有生成的试题以JSON格式输出。

输入变量:
- 难度等级:{{difficulty_level}}(例如:简单、中等、困难)
- 试题类型:{{question_type}}(例如:选择题、填空题、判断题)
- 试题数量:{{question_count}}(例如:5)

输出格式:
{
  "questions": [
    {
      "question_content": "题目内容",
      "options": [
        "选项A",
        "选项B",
        "选项C",
        "选项D"
      ],
      "correct_answer": "正确答案"
    },
    ...
  ]
}
</instruction>
<input>
<difficulty_level>简单</difficulty_level>
<question_type>选择题</question_type>
<question_count>5</question_count>
</input>
<output>
{
  "questions": [
    {
      "question_content": "1 + 1 等于多少?",
      "options": [
        "1",
        "2",
        "3",
        "4"
      ],
      "correct_answer": "2"
    },
    {
      "question_content": "地球是哪个行星?",
      "options": [
        "火星",
        "地球",
        "金星",
        "木星"
      ],
      "correct_answer": "地球"
    },
    ...
  ]
}
</output>
<example>
输入:难度等级为“简单”,试题类型为“选择题”,试题数量为“5”。
输出:包含5道简单选择题的JSON格式数据。
</example>

When I input the corresponding variable, I don't get any output.

✔️ Expected Behavior

Using text generation AI, expect to return the generated text

❌ Actual Behavior

data: {"event": "error", "message_id": "a04e042e-4b5f-4b18-afc0-f37bb7e1d4d1", "created_at": 1731374336, "code": "internal_server_error", "message": "Internal Server Error, please contact support.", "status": 500}

kelinkong avatar Nov 12 '24 01:11 kelinkong