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
52.08k stars 7.57k forks source link

Apis bug. The 'pinned' parameter is not working. #9855

Open glacierck opened 3 weeks ago

glacierck commented 3 weeks ago

Self Checks

Dify version

0.10.1

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

1.test pinned=true: curl -X GET 'http://192.168.1.210/v1/conversations?user=abc-123&pinned=true'\ --header 'Authorization: Bearer {api_key}' 2.test pinned=fasle: curl -X GET 'http://192.168.1.210/v1/conversations?user=abc-123&pinned=fasle'\ --header 'Authorization: Bearer {api_key}'

✔️ Expected Behavior

Obtain the top and non top conversations lists separately

❌ Actual Behavior

Obtain two identical lists of non top conversations. The 'pinned' parameter is not working.

glacierck commented 3 weeks ago

image Flipping through the source code, I did not find any processing parameter 'pinned'

dosubot[bot] commented 3 weeks ago

The issue with the 'pinned' parameter not working in the ConversationApi class is likely due to the logic for handling pinned conversations being implemented in the WebConversationService class, specifically in the pagination_by_last_id method. This method checks the pinned parameter and retrieves pinned conversations based on certain criteria. If the pinned parameter is not affecting the output as expected, it could be due to:

  1. The pinned parameter not being passed correctly to the pagination_by_last_id method.
  2. The PinnedConversation entries not being correctly retrieved or filtered in the database query.
  3. The pagination_by_last_id method not handling include_ids and exclude_ids correctly [1].

Ensure that the pinned parameter is correctly passed and that the database queries and subsequent logic are functioning as intended. The pinned parameter is passed from the ConversationListApi class to the pagination_by_last_id method by parsing the request arguments and converting the "pinned" parameter to a boolean value before passing it [2].

To continue talking to Dosu, mention @dosu.