mirror of
https://github.com/langgenius/dify-plugin-sdks.git
synced 2026-07-23 02:45:37 -04:00
9 lines
380 B
Python
9 lines
380 B
Python
from collections.abc import Generator
|
|
from dify_plugin.entities.tool import ToolInvokeMessage
|
|
from dify_plugin import Tool
|
|
|
|
|
|
class UploadFileTool(Tool):
|
|
def _invoke(self, tool_parameters: dict) -> Generator[ToolInvokeMessage, None, None]:
|
|
response = self.session.file.upload("1.txt", b"", "text/plain")
|
|
yield self.create_text_message(f"file id: {response.id}") |