You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

rag_pipeline_manage_service.py 981B

1234567891011121314151617181920212223
  1. from core.plugin.entities.plugin_daemon import PluginDatasourceProviderEntity
  2. from core.plugin.impl.datasource import PluginDatasourceManager
  3. from services.datasource_provider_service import DatasourceProviderService
  4. class RagPipelineManageService:
  5. @staticmethod
  6. def list_rag_pipeline_datasources(tenant_id: str) -> list[PluginDatasourceProviderEntity]:
  7. """
  8. list rag pipeline datasources
  9. """
  10. # get all builtin providers
  11. manager = PluginDatasourceManager()
  12. datasources = manager.fetch_datasource_providers(tenant_id)
  13. for datasource in datasources:
  14. datasource_provider_service = DatasourceProviderService()
  15. credentials = datasource_provider_service.get_datasource_credentials(
  16. tenant_id=tenant_id, provider=datasource.provider, plugin_id=datasource.plugin_id
  17. )
  18. if credentials:
  19. datasource.is_authorized = True
  20. return datasources