mirror of
https://github.com/langgenius/dify.git
synced 2026-05-13 08:57:28 +08:00
add credential id
This commit is contained in:
parent
71d8a0c0b6
commit
fcdbfbda4f
@ -309,53 +309,54 @@ class DatasourceMessage(ToolInvokeMessage):
|
|||||||
|
|
||||||
|
|
||||||
#########################
|
#########################
|
||||||
# Online driver file
|
# Online drive file
|
||||||
#########################
|
#########################
|
||||||
|
|
||||||
|
|
||||||
class OnlineDriveFile(BaseModel):
|
class OnlineDriveFile(BaseModel):
|
||||||
"""
|
"""
|
||||||
Online driver file
|
Online drive file
|
||||||
"""
|
"""
|
||||||
|
|
||||||
key: str = Field(..., description="The key of the file")
|
id: str = Field(..., description="The file ID")
|
||||||
size: int = Field(..., description="The size of the file")
|
name: str = Field(..., description="The file name")
|
||||||
|
size: int = Field(..., description="The file size")
|
||||||
|
type: str = Field(..., description="The file type: folder or file")
|
||||||
|
|
||||||
|
|
||||||
class OnlineDriveFileBucket(BaseModel):
|
class OnlineDriveFileBucket(BaseModel):
|
||||||
"""
|
"""
|
||||||
Online driver file bucket
|
Online drive file bucket
|
||||||
"""
|
"""
|
||||||
|
|
||||||
bucket: Optional[str] = Field(None, description="The bucket of the file")
|
bucket: Optional[str] = Field(None, description="The file bucket")
|
||||||
files: list[OnlineDriveFile] = Field(..., description="The files of the bucket")
|
files: list[OnlineDriveFile] = Field(..., description="The file list")
|
||||||
is_truncated: bool = Field(False, description="Whether the bucket has more files")
|
is_truncated: bool = Field(False, description="Whether the result is truncated")
|
||||||
|
next_page_parameters: Optional[dict] = Field(None, description="Parameters for fetching the next page")
|
||||||
|
|
||||||
|
|
||||||
class OnlineDriveBrowseFilesRequest(BaseModel):
|
class OnlineDriveBrowseFilesRequest(BaseModel):
|
||||||
"""
|
"""
|
||||||
Get online driver file list request
|
Get online drive file list request
|
||||||
"""
|
"""
|
||||||
|
|
||||||
prefix: Optional[str] = Field(None, description="File path prefix for filtering eg: 'docs/dify/'")
|
bucket: Optional[str] = Field(None, description="The file bucket")
|
||||||
bucket: Optional[str] = Field(None, description="Storage bucket name")
|
prefix: str = Field(..., description="The parent folder ID")
|
||||||
max_keys: int = Field(20, description="Maximum number of files to return")
|
max_keys: int = Field(20, description="Page size for pagination")
|
||||||
start_after: Optional[str] = Field(
|
next_page_parameters: Optional[dict] = Field(None, description="Parameters for fetching the next page")
|
||||||
None, description="Pagination token for continuing from a specific file eg: 'docs/dify/1.txt'"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class OnlineDriveBrowseFilesResponse(BaseModel):
|
class OnlineDriveBrowseFilesResponse(BaseModel):
|
||||||
"""
|
"""
|
||||||
Get online driver file list response
|
Get online drive file list response
|
||||||
"""
|
"""
|
||||||
|
|
||||||
result: list[OnlineDriveFileBucket] = Field(..., description="The bucket of the files")
|
result: list[OnlineDriveFileBucket] = Field(..., description="The list of file buckets")
|
||||||
|
|
||||||
|
|
||||||
class OnlineDriveDownloadFileRequest(BaseModel):
|
class OnlineDriveDownloadFileRequest(BaseModel):
|
||||||
"""
|
"""
|
||||||
Get online driver file
|
Get online drive file
|
||||||
"""
|
"""
|
||||||
|
|
||||||
id: str = Field(..., description="The id of the file")
|
id: str = Field(..., description="The id of the file")
|
||||||
|
|||||||
@ -165,7 +165,6 @@ class DatasourceProviderService:
|
|||||||
# refresh the credentials
|
# refresh the credentials
|
||||||
real_credentials_list = []
|
real_credentials_list = []
|
||||||
for datasource_provider in datasource_providers:
|
for datasource_provider in datasource_providers:
|
||||||
if datasource_provider.expires_at != -1 and (datasource_provider.expires_at - 60) < int(time.time()):
|
|
||||||
decrypted_credentials = self.decrypt_datasource_provider_credentials(
|
decrypted_credentials = self.decrypt_datasource_provider_credentials(
|
||||||
tenant_id=tenant_id,
|
tenant_id=tenant_id,
|
||||||
datasource_provider=datasource_provider,
|
datasource_provider=datasource_provider,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user