mirror of
https://github.com/langgenius/dify-plugin-sdks.git
synced 2026-08-26 18:56:41 -04:00
8f5e27732c
- Introduced `OnlineDocumentDatasource` and `WebsiteCrawlDatasource` abstract classes for handling online document and website crawl functionalities. - Added corresponding methods for retrieving pages and content, enhancing the datasource capabilities. - Created new models for online document and website information to support the new interfaces.
29 lines
1.1 KiB
Python
29 lines
1.1 KiB
Python
from collections.abc import Mapping
|
|
from typing import Any
|
|
|
|
from werkzeug import Request
|
|
|
|
|
|
class DatasourceProvider:
|
|
"""
|
|
A provider for a datasource
|
|
"""
|
|
|
|
def validate_credentials(self, credentials: dict):
|
|
return self._validate_credentials(credentials)
|
|
|
|
def _validate_credentials(self, credentials: dict):
|
|
raise NotImplementedError("This method should be implemented by a subclass")
|
|
|
|
def oauth_get_authorization_url(self, system_credentials: Mapping[str, Any]) -> str:
|
|
return self._oauth_get_authorization_url(system_credentials)
|
|
|
|
def _oauth_get_authorization_url(self, system_credentials: Mapping[str, Any]) -> str:
|
|
raise NotImplementedError("This method should be implemented by a subclass")
|
|
|
|
def oauth_get_credentials(self, system_credentials: Mapping[str, Any], request: Request) -> Mapping[str, Any]:
|
|
return self._oauth_get_credentials(system_credentials, request)
|
|
|
|
def _oauth_get_credentials(self, system_credentials: Mapping[str, Any], request: Request) -> Mapping[str, Any]:
|
|
raise NotImplementedError("This method should be implemented by a subclass")
|