Add type hints and import necessary modules in SlackDirectoryLoaderComponent
This commit is contained in:
parent
24931545f9
commit
737b29e891
1 changed files with 7 additions and 9 deletions
|
|
@ -1,7 +1,8 @@
|
||||||
|
|
||||||
from langflow import CustomComponent
|
from langflow import CustomComponent
|
||||||
from typing import Optional, Dict
|
from typing import Optional, Dict, List
|
||||||
|
from langchain_core.documents import Document
|
||||||
|
from langchain_community.document_loaders.slack_directory import SlackDirectoryLoader
|
||||||
class SlackDirectoryLoaderComponent(CustomComponent):
|
class SlackDirectoryLoaderComponent(CustomComponent):
|
||||||
display_name = "SlackDirectoryLoader"
|
display_name = "SlackDirectoryLoader"
|
||||||
description = "Load from a `Slack` directory dump."
|
description = "Load from a `Slack` directory dump."
|
||||||
|
|
@ -9,8 +10,8 @@ class SlackDirectoryLoaderComponent(CustomComponent):
|
||||||
|
|
||||||
def build_config(self):
|
def build_config(self):
|
||||||
return {
|
return {
|
||||||
"zip_path": {"display_name": "Path to zip file"},
|
"zip_path": {"display_name": "Path to zip file","field_type": "file","file_types":[".zip"]},
|
||||||
"metadata": {"display_name": "Metadata"},
|
"metadata": {"display_name": "Metadata", "field_type": "dict"},
|
||||||
"workspace_url": {"display_name": "Workspace URL"},
|
"workspace_url": {"display_name": "Workspace URL"},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -19,8 +20,5 @@ class SlackDirectoryLoaderComponent(CustomComponent):
|
||||||
zip_path: str,
|
zip_path: str,
|
||||||
metadata: Optional[Dict] = None,
|
metadata: Optional[Dict] = None,
|
||||||
workspace_url: Optional[str] = None,
|
workspace_url: Optional[str] = None,
|
||||||
) -> 'Document':
|
) -> List[Document]:
|
||||||
# Assuming there is a SlackDirectoryLoader class that takes these parameters
|
return SlackDirectoryLoader(zip_path=zip_path, metadata=metadata, workspace_url=workspace_url).load()
|
||||||
# Since the actual implementation details are not provided, this is a placeholder
|
|
||||||
# Replace SlackDirectoryLoader with the actual class that should be instantiated
|
|
||||||
return SlackDirectoryLoader(zip_path=zip_path, metadata=metadata, workspace_url=workspace_url)
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue