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
47.39k stars 6.75k forks source link

Could we add a setting feature that allows administrators to configure download capabilities based on actual needs? #2340

Closed andylzming closed 8 months ago

andylzming commented 8 months ago

Self Checks

Dify version

0.5.2

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Can a download feature be added to the knowledge source? Could we add a setting feature that allows administrators to configure download capabilities based on actual needs?

12

✔️ Expected Behavior

No response

❌ Actual Behavior

No response

dosubot[bot] commented 8 months ago

🤖

Hey @andylzming, great to see you back! Hope you're doing well 😊

Thank you for your suggestion, andylzming. It is indeed possible to add a feature to the dify repository that allows administrators to configure download capabilities from the knowledge source based on their actual needs.

Currently, the dify repository uses the react-papaparse library to download CSV files. To add the feature you're suggesting, you would need to modify the CSVDownload component to accept props that define the download capabilities. These props could be passed down from a parent component where the administrator's preferences are stored.

Here is a simplified example of how you could modify the CSVDownload component to accept a canDownload prop:

const CSVDownload: FC<{ canDownload: boolean }> = ({ canDownload }) => {
  // ...existing code...

  return (
    <div className='mt-6'>
      {/* ...existing code... */}
      {canDownload && (
        <CSVDownloader
          className="block mt-2 cursor-pointer"
          type={Type.Link}
          filename={`template-${language}`}
          bom={true}
          data={getTemplate()}
        >
          <div className='flex items-center h-[18px] space-x-1 text-[#155EEF] text-xs font-medium'>
            <DownloadIcon className='w-3 h-3 mr-1' />
            {t('appAnnotation.batchModal.template')}
          </div>
        </CSVDownloader>
      )}
    </div>
  )
}

In this example, the CSVDownloader component is only rendered if canDownload is true. This prop would be controlled by the administrator's preferences.

The administrator settings in the dify codebase are handled through a configuration object named config. This object contains several properties that define the settings for the Hugging Face model provider.

In the dify codebase, administrator permissions are managed through role assignments. The roles are defined as 'owner', 'admin', and 'normal'. The role of a member can be updated using the handleUpdateMemberRole function, which makes a request to the /workspaces/current/members/${member.id}/update-role endpoint with the new role as the body of the request.

I hope this information is helpful. If you have any further questions or need more clarification, please let me know.

Sources


This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.

crazywoola commented 8 months ago

For feature request please use the right template to fire an issue.

2287 As I said, we do not have a plan to this feature due to the data security for now.