langgenius / dify

Dify is an open-source LLM app development platform. Dify's intuitive interface combines AI workflow, RAG pipeline, agent capabilities, model management, observability features and more, letting you quickly go from prototype to production.
https://dify.ai
Other
38.85k stars 5.33k forks source link

When using the Chat Assistant, the model uses openai, which works properly, and the conversation message is empty #5949

Open shutter-cp opened 3 weeks ago

shutter-cp commented 3 weeks ago

Self Checks

Dify version

0.6.12-fix1

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Starting mode docker compose up -d There is no other operation

image
/api/apps/74667fdb-6d82-48aa-8ec0-86cfa4c2cc75/chat-messages
data: {"event": "message", "conversation_id": "0abe9a6d-5066-42f6-918c-ed2bf3fd4439", "message_id": "23bed9f7-e9d9-4296-bd14-e4a1e58032cc", "created_at": 1720061592, "task_id": "f3c50e89-1533-4e82-a8a3-46d99108a5a2", "id": "23bed9f7-e9d9-4296-bd14-e4a1e58032cc", "answer": ""}

data: {"event": "message_end", "conversation_id": "0abe9a6d-5066-42f6-918c-ed2bf3fd4439", "message_id": "23bed9f7-e9d9-4296-bd14-e4a1e58032cc", "created_at": 1720061592, "task_id": "f3c50e89-1533-4e82-a8a3-46d99108a5a2", "id": "23bed9f7-e9d9-4296-bd14-e4a1e58032cc", "metadata": {"usage": {"prompt_tokens": 8, "prompt_unit_price": "5.00", "prompt_price_unit": "0.000001", "prompt_price": "0.0000400", "completion_tokens": 18, "completion_unit_price": "15.00", "completion_price_unit": "0.000001", "completion_price": "0.0002700", "total_tokens": 26, "total_price": "0.0003100", "currency": "USD", "latency": 3.0238079169939738}}}
/console/api/apps/74667fdb-6d82-48aa-8ec0-86cfa4c2cc75/chat-messages?conversation_id=0abe9a6d-5066-42f6-918c-ed2bf3fd4439

{
    "limit": 20,
    "has_more": false,
    "data": [
        {
            "id": "23bed9f7-e9d9-4296-bd14-e4a1e58032cc",
            "conversation_id": "0abe9a6d-5066-42f6-918c-ed2bf3fd4439",
            "inputs": {},
            "query": "\u4f60\u597d",
            "message": [
                {
                    "role": "user",
                    "text": "\u4f60\u597d",
                    "files": []
                }
            ],
            "message_tokens": 8,
            "answer": "",
            "answer_tokens": 18,
            "provider_response_latency": 3.0075898240029346,
            "from_source": "console",
            "from_end_user_id": null,
            "from_account_id": "c8fa35b7-1e95-4177-bd24-fff4240a6388",
            "feedbacks": [],
            "workflow_run_id": null,
            "annotation": null,
            "annotation_hit_history": null,
            "created_at": 1720061592,
            "agent_thoughts": [],
            "message_files": [],
            "metadata": {},
            "status": "normal",
            "error": null
        }
    ]
}

日志

image

✔️ Expected Behavior

No response

❌ Actual Behavior

No response

dosubot[bot] commented 3 weeks ago

@shutter-cp Hello there! I'm here to assist you with bugs, questions, and becoming a contributor. Let's squash those bugs together! 🤖

The conversation message might be empty when using the Chat Assistant with the OpenAI model in version 0.6.12-fix1 of the self-hosted Dify application due to several potential reasons:

  1. Rate Limit Reached: If the rate limit for the OpenAI API has been reached, it could result in empty responses. Check if the rate limit has been exceeded:

    Rate limit reached for default-gpt-3.5-turbo in organization org-wDrZCxxxxxxxxxissoZb on requests per min. Limit: 3 / min. Please try again in 20s. Contact us through our help center at help.openai.com if you continue to have issues. Please add a payment method to your account to increase your rate limit. Visit https://platform.openai.com/account/billing to add a payment method.
  2. Model Version Compatibility: Ensure that the model version being used is compatible with the function calling capabilities required by the application. For example, the gpt-3.5-turbo model version must be 0613 or later:

    Unrecognized request argument supplied: functions
  3. Quota Exceeded: If the OpenAI key account balance has been used up, it could result in empty responses. Ensure that the account has sufficient balance:

    Validation failed: You exceeded your current quota, please check your plan and billing details
  4. Parameter Configuration: Incorrect parameter configuration, such as setting max_tokens too high, could also lead to issues. Ensure that the parameters are set within the valid range for the model being used:

    Query or prefix prompt is too long, you can reduce the prefix prompt, or shrink the max token, or switch to a llm with a larger token limit size
  5. Server Errors: Internal server errors or overloads could also result in empty responses:

    The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application
  6. Proxy Settings: If you are using a proxy server to access OpenAI, ensure that the proxy settings are correctly configured. Incorrect proxy settings can lead to communication issues with the OpenAI API:

    Error communicating with OpenAl: HTTPSConnectionPool(host='api.openai.com', port=443): Max retries exceeded with url: /v1/chat/completions (Caused by NewConnectionError( <urllib3.connection.HTTPSConnection object at 0x7f0462ed7af0>; Failed to establish a new connection: [Errno -3] Temporary failure in name resolution'))

To resolve the issue, check the above potential causes and ensure that the API key, model version, rate limits, parameter configurations, and proxy settings are correctly set [1][2].

To continue talking to Dosu, mention @dosu.

shutter-cp commented 3 weeks ago

There are no error messages,But the dialog is empty

dosubot[bot] commented 3 weeks ago

To resolve the issue of the conversation message being empty when using the Chat Assistant with the OpenAI model in version 0.6.12-fix1 of the self-hosted Dify application, ensure that the frontend and backend versions are up-to-date and consistent with each other. Additionally, verify that the Azure OpenAI resource has a deployed model, specifically the gpt-3.5-turbo model version must be 0613 or later, as earlier versions do not support the function calling capabilities required by Explore-Chat [1].

To continue talking to Dosu, mention @dosu.

LiuHaodongdong commented 1 day ago

I got the same result as yours. The dialog is empty. But when I use ApiFox to test the OpenAI service, I can get a correct response. Have you solved this problem?

shutter-cp commented 1 day ago

我得到了和你的一样的结果。对话框是空的。但当我使用ApiFox测试OpenAI服务时,我可以得到正确的响应。你解决这个问题了吗?

使用OpenAI-API-compatible 手动配置openai服务能用 感觉是流式接口的问题

LiuHaodongdong commented 1 day ago

我通过设置流模式返回结果的分隔符为* /n, 去掉一个/n解决了这个问题