Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add data field to returned object on flowheader if flow is a component #5373

Merged
merged 4 commits into from
Dec 23, 2024

Conversation

lucaseduoli
Copy link
Collaborator

This pull request includes several changes to improve the code readability and functionality in the langflow backend. The most important changes include reformatting imports, updating the read_flows function to use FlowHeader.model_validate, adding model_validator to FlowHeader, and reformatting the FlowBase and Flow classes for better readability.

Code readability improvements:

Functionality improvements:

Import enhancements:

@lucaseduoli lucaseduoli self-assigned this Dec 19, 2024
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Dec 19, 2024
@github-actions github-actions bot added the bug Something isn't working label Dec 19, 2024
Comment on lines 229 to 234
@model_validator(mode="before")
@classmethod
def validate_flow_header(cls, data: dict):
def validate_flow_header(cls, data: Flow):
if not data.is_component:
data.data = None
return data
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a field_validator for data. I don't think this should should work because data is a dict.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked and data was returned as a Flow object. I considered it as a dict before and it didnt work

@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Dec 19, 2024
@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Dec 19, 2024
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Dec 19, 2024
Copy link

codspeed-hq bot commented Dec 19, 2024

CodSpeed Performance Report

Merging #5373 will degrade performances by 14.82%

Comparing fix/saved_components_disappearing (de3f2c6) with main (b2e7476)

Summary

❌ 1 regressions
✅ 14 untouched benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark main fix/saved_components_disappearing Change
test_get_and_cache_all_types_dict 1 ms 1.2 ms -14.82%

@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:XS This PR changes 0-9 lines, ignoring generated files. labels Dec 20, 2024
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Dec 20, 2024
@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Dec 20, 2024
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Dec 20, 2024
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Dec 23, 2024
@ogabrielluiz ogabrielluiz force-pushed the fix/saved_components_disappearing branch from 040096f to de3f2c6 Compare December 23, 2024 18:50
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Dec 23, 2024
@lucaseduoli lucaseduoli added this pull request to the merge queue Dec 23, 2024
Merged via the queue into main with commit 1daf915 Dec 23, 2024
25 checks passed
@lucaseduoli lucaseduoli deleted the fix/saved_components_disappearing branch December 23, 2024 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working lgtm This PR has been approved by a maintainer size:S This PR changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants