feat: add LANGFLOW_AUTO_SAVING_INTERVAL .env variable for flow auto-saving debounce (#3478)
* 📝 (langflow): Add support for configuring auto saving interval for Langflow 📝 (langflow): Update ConfigResponse and Settings to include auto_saving_interval 📝 (frontend): Update useGetConfigQuery and useSaveConfig to handle auto_saving_interval 📝 (frontend): Update useAutoSaveFlow and flowsManagerStore to handle auto saving interval * 📝 (util.py): add support for setting auto_saving_interval in update_settings function to allow customization of auto-saving interval
This commit is contained in:
parent
8dd85d98b6
commit
1db1e3af3d
9 changed files with 28 additions and 2 deletions
|
|
@ -125,6 +125,11 @@ def run(
|
|||
help="Defines if the auto save is enabled.",
|
||||
envvar="LANGFLOW_AUTO_SAVING",
|
||||
),
|
||||
auto_saving_interval: bool = typer.Option(
|
||||
True,
|
||||
help="Defines the debounce time for the auto save.",
|
||||
envvar="LANGFLOW_AUTO_SAVING_INTERVAL",
|
||||
),
|
||||
):
|
||||
"""
|
||||
Run Langflow.
|
||||
|
|
@ -143,6 +148,7 @@ def run(
|
|||
components_path=components_path,
|
||||
store=store,
|
||||
auto_saving=auto_saving,
|
||||
auto_saving_interval=auto_saving_interval,
|
||||
)
|
||||
# create path object if path is provided
|
||||
static_files_dir: Optional[Path] = Path(path) if path else None
|
||||
|
|
|
|||
|
|
@ -331,3 +331,4 @@ class FlowDataRequest(BaseModel):
|
|||
class ConfigResponse(BaseModel):
|
||||
frontend_timeout: int
|
||||
auto_saving: bool
|
||||
auto_saving_interval: int
|
||||
|
|
|
|||
|
|
@ -157,6 +157,8 @@ class Settings(BaseSettings):
|
|||
# Config
|
||||
auto_saving: bool = True
|
||||
"""If set to True, Langflow will auto save flows."""
|
||||
auto_saving_interval: int = 300
|
||||
"""The interval in ms at which Langflow will auto save flows."""
|
||||
|
||||
@field_validator("dev")
|
||||
@classmethod
|
||||
|
|
|
|||
|
|
@ -429,6 +429,7 @@ def update_settings(
|
|||
components_path: Optional[Path] = None,
|
||||
store: bool = True,
|
||||
auto_saving: bool = True,
|
||||
auto_saving_interval: int = 300,
|
||||
):
|
||||
"""Update the settings from a config file."""
|
||||
from langflow.services.utils import initialize_settings_service
|
||||
|
|
@ -455,6 +456,9 @@ def update_settings(
|
|||
if not auto_saving:
|
||||
logger.debug("Setting auto_saving to False")
|
||||
settings_service.settings.update_settings(auto_saving=False)
|
||||
if auto_saving_interval:
|
||||
logger.debug(f"Setting auto_saving_interval to {auto_saving_interval}")
|
||||
settings_service.settings.update_settings(auto_saving_interval=auto_saving_interval)
|
||||
|
||||
|
||||
def is_class_method(func, cls):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue