fix: Show path of saved file in Save File Component (#8403)
* Show path of saved file in Save File Component * Update src/backend/base/langflow/components/processing/save_file.py Co-authored-by: Edwin Jose <edwin.jose@datastax.com> * [autofix.ci] apply automated fixes * Update src/backend/base/langflow/components/processing/save_file.py Co-authored-by: Edwin Jose <edwin.jose@datastax.com> * [autofix.ci] apply automated fixes * Switch to message output --------- Co-authored-by: Edwin Jose <edwin.jose@datastax.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
423caf91f1
commit
a23c566269
2 changed files with 25 additions and 4 deletions
|
|
@ -14,6 +14,7 @@ from langflow.schema import Data, DataFrame, Message
|
|||
from langflow.services.auth.utils import create_user_longterm_token
|
||||
from langflow.services.database.models.user.crud import get_user_by_id
|
||||
from langflow.services.deps import get_session, get_settings_service, get_storage_service
|
||||
from langflow.template.field.base import Output
|
||||
|
||||
|
||||
class SaveToFileComponent(Component):
|
||||
|
|
@ -51,7 +52,9 @@ class SaveToFileComponent(Component):
|
|||
),
|
||||
]
|
||||
|
||||
async def save_to_file(self) -> str:
|
||||
outputs = [Output(display_name="File Path", name="result", method="save_to_file")]
|
||||
|
||||
async def save_to_file(self) -> Message:
|
||||
"""Save the input to a file and upload it, returning a confirmation message."""
|
||||
# Validate inputs
|
||||
if not self.file_name:
|
||||
|
|
@ -90,7 +93,10 @@ class SaveToFileComponent(Component):
|
|||
# Upload the saved file
|
||||
await self._upload_file(file_path)
|
||||
|
||||
return confirmation
|
||||
# Return the final file path and confirmation message
|
||||
final_path = Path.cwd() / file_path if not file_path.is_absolute() else file_path
|
||||
|
||||
return Message(text=f"{confirmation} at {final_path}")
|
||||
|
||||
def _get_input_type(self) -> str:
|
||||
"""Determine the input type based on the provided input."""
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue