-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: remove unused credential validation logic in VectorizerProvider (#…
…12000) Signed-off-by: -LAN- <[email protected]>
- Loading branch information
Showing
1 changed file
with
1 addition
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,8 @@ | ||
from typing import Any | ||
|
||
from core.file import FileTransferMethod, FileType | ||
from core.tools.errors import ToolProviderCredentialValidationError | ||
from core.tools.provider.builtin.vectorizer.tools.vectorizer import VectorizerTool | ||
from core.tools.provider.builtin_tool_provider import BuiltinToolProviderController | ||
from factories import file_factory | ||
|
||
|
||
class VectorizerProvider(BuiltinToolProviderController): | ||
def _validate_credentials(self, credentials: dict[str, Any]) -> None: | ||
mapping = { | ||
"transfer_method": FileTransferMethod.TOOL_FILE, | ||
"type": FileType.IMAGE, | ||
"id": "test_id", | ||
"url": "https://cloud.dify.ai/logo/logo-site.png", | ||
} | ||
test_img = file_factory.build_from_mapping( | ||
mapping=mapping, | ||
tenant_id="__test_123", | ||
) | ||
try: | ||
VectorizerTool().fork_tool_runtime( | ||
runtime={ | ||
"credentials": credentials, | ||
} | ||
).invoke( | ||
user_id="", | ||
tool_parameters={"mode": "test", "image": test_img}, | ||
) | ||
except Exception as e: | ||
raise ToolProviderCredentialValidationError(str(e)) | ||
return |