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
45.3k stars 6.36k forks source link

When I try to retrieve the conversation history via the API, it always returns an empty result. #6216

Closed nb75km closed 1 month ago

nb75km commented 2 months ago

Self Checks

Dify version

0.6.13

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

I am trying to retrieve the conversation history through the HTTP request block on Dify.

Steps to Reproduce

  1. Use the HTTP request block on Dify to send the following request:

GET http://locallhost/v1/conversations HTTP/1.1 Authorization: ***

  1. The following response is returned as a result of the request:

{ "status_code": 200, "body": "{"limit": 20, "has_more": false, "data": []}\n", "headers": { "server": "nginx/1.27.0", "date": "Fri, 12 Jul 2024 01:48:52 GMT", "content-type": "application/json", "content-length": "45", "access-control-allow-origin": "*", "set-cookie": "remember_token=; Expires=Thu, 01 Jan 1970 00:00:00 GMT; Path=/", "x-version": "0.6.13", "x-env": "PRODUCTION", "cache-status": "863e0002c72b;detail=mismatch", "via": "1.1 863e0002c72b (squid/6.6)", "connection": "keep-alive" }, "files": [] }

  1. Although there is conversation data in PostgreSQL, the data field is always empty in the response.

These steps reproduce the issue where the conversation history is always returned empty.

✔️ Expected Behavior

No response

❌ Actual Behavior

No response

crazywoola commented 2 months ago

Can you paste the payload as well? According to the code, you need to provide a user_id as well.

https://github.com/langgenius/dify/blob/f599f41336e5f72e88cc9cf4ae50e365e8076672/api/controllers/service_api/app/conversation.py#L31

nb75km commented 2 months ago

I tried sending the user_id, but it did not improve the situation. Is this payload correct?

payload

ZhouhaoJiang commented 1 month ago

I tried sending the user_id, but it did not improve the situation.我试着发送user_id,但并没有改善情况。 Is this payload correct? 这个负载正确吗?

payload

The service api /v1/conversations can only get the conversations where invoke_form is service-api or null

nb75km commented 1 month ago

I see. I hadn't checked that. Thank you.