-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
feat: read flows from local directory at startup #1989
feat: read flows from local directory at startup #1989
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks awesome @nicoloboschi ! Thank you.
continue | ||
|
||
logger.info(f"Creating new flow: {flow_id}") | ||
flow["user_id"] = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the user_id is None no User will be able to use the Flows.
What do you think would be a alternative to this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ogabrielluiz good point. I've only tested it with AUTO_LOGIN=true and calling the flow with the superuser token (and that works)
For users, I think this can't be supported yet because I believe there's no concept of shared flows (which might be cool to add in the future) and binding the user_id is hard if you export/import from/to different langflow environments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think what we can do is have a flag for adding all of them to all users or to superusers only. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LANGFLOW_LOAD_FLOWS_TO_ALL_USERS
should be ok.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem of creating the same flow for all the users is that you are forced to change the uuid (because it's the PK of the table) and you lose the ability to compute API endpoints automatically.
I think we can let this option work with AUTO_LOGIN=true only.
I'll add a check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added the flows for the superuser, please review again
b987bda
to
0a04a3e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This PR adds the ability to load JSON flows from a local directory configured under LANGFLOW_LOAD_FLOWS_PATH (unset by default)
The UUID used is inferred from the filename if .json or from the json itself. if neither are set, a new uuid is set.