diff --git a/daras_ai_v2/base.py b/daras_ai_v2/base.py index e07a1bd9f..6a30b8735 100644 --- a/daras_ai_v2/base.py +++ b/daras_ai_v2/base.py @@ -1795,7 +1795,9 @@ def render_variables(self): if not self.functions_in_settings: functions_input(self.request.user) variables_input( - template_keys=self.template_keys, allow_add=is_functions_enabled() + template_keys=self.template_keys, + allow_add=is_functions_enabled(), + exclude=self.fields_to_save(), ) @classmethod diff --git a/daras_ai_v2/variables_widget.py b/daras_ai_v2/variables_widget.py index 5e2ec87cf..1de70e31e 100644 --- a/daras_ai_v2/variables_widget.py +++ b/daras_ai_v2/variables_widget.py @@ -23,6 +23,7 @@ def variables_input( description: str = "Variables let you pass custom parameters to your workflow. Access a variable in your instruction prompt with Jinja, e.g. `{{ my_variable }}`\n ", key: str = "variables", allow_add: bool = False, + exclude: typing.Iterable[str] = (), ): from recipes.BulkRunner import list_view_editor @@ -45,7 +46,7 @@ def variables_input( var_names = ( (template_var_names | set(variables.keys())) - set(context_globals().keys()) # dont show global context variables - - set(gui.session_state.keys()) # dont show other session state variables + - set(exclude) # used for hiding request/response fields ) pressed_add = False if var_names or allow_add: diff --git a/recipes/Functions.py b/recipes/Functions.py index 2f10dba02..3256ece91 100644 --- a/recipes/Functions.py +++ b/recipes/Functions.py @@ -136,6 +136,7 @@ def render_variables(self): allow_add=True, description="Pass custom parameters to your function and access the parent workflow data. " "Variables will be passed down as the first argument to your anonymous JS function.", + exclude=self.fields_to_save(), ) options = set(gui.session_state.get("secrets") or [])