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
51.39k stars 7.41k forks source link

When there are multiple pages in the knowledge base, an error is returned after entering the segment list #8742

Closed deific closed 1 day ago

deific commented 1 month ago

Self Checks

Dify version

0.8.3

Cloud or Self Hosted

Cloud, Self Hosted (Docker)

Steps to reproduce

When there are multiple pages in the knowledge base, an error is returned after entering the segment list 1、There are multiple pages and the third page has been redirected image 2、entering the segment list of one document image 3、When returning, it did not return to the third page before entering, but directly returned to the first page image

✔️ Expected Behavior

Return to the page where you enter the segmented list of the document

❌ Actual Behavior

Fixed return to page 1

dosubot[bot] commented 1 month ago

I found a similar open issue titled correct back button on documents, which is closed and was last updated on September 12, 2024. The issue has no comments or solution [1].

The 'back' button functionality in the segment list view is implemented using the backToPrev function, which navigates the user back to the document list view. This function is triggered by clicking on a div containing the ArrowLeftIcon [2].

Here is the relevant code:

const backToPrev = () => {
  router.push(`/datasets/${datasetId}/documents`)
}

// ...

<div onClick={backToPrev} className={'shrink-0 rounded-full w-8 h-8 flex justify-center items-center border-gray-100 cursor-pointer border hover:border-gray-300 shadow-[0px_12px_16px_-4px_rgba(16,24,40,0.08),0px_4px_6px_-2px_rgba(16,24,40,0.03)]'}>
  <ArrowLeftIcon className='text-primary-600 fill-current stroke-current h-4 w-4' />
</div>

It seems that the current implementation does not store the page number before navigating to the segment list, causing it to return to the first page by default. There is no state or context management in place to store the current page number when navigating between different views in the knowledge base [2].

To address this issue, you might consider implementing a state management solution (e.g., using React's Context API or a global state management library like Redux) to persist the current page state across different components. This way, you can ensure that the user returns to the correct page after navigating back from the segment list.

To continue talking to Dosu, mention @dosu.

crazywoola commented 1 month ago

Thanks for the feedback, however we do not have much time on refining this part, we will take a look at this later.