wuhp commited on
Commit
5437232
·
verified ·
1 Parent(s): b0ecca0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -228,7 +228,8 @@ def greet():
228
 
229
  # Helper function to update send button interactivity based on prereqs
230
  # MODIFIED to return gr.update
231
- def check_send_button_ready(profile: gr.OAuthProfile | None, token: gr.OAuthToken | None, api_key: str | None, model_name: str | None) -> gr.update:
 
232
  """Checks if HF login and Gemini configuration are complete and returns update for button interactivity."""
233
  is_logged_in = profile is not None and token is not None
234
  is_gemini_ready = api_key is not None and model_name is not None
@@ -361,9 +362,8 @@ def ai_workflow_chat(
361
  # User requested simple space creation with a name
362
  new_repo_name = create_match.group(1).strip()
363
  history = add_bot_message(history, f"Acknowledged: '{message}'. Starting workflow to create Space `{hf_profile.username}/{new_repo_name}`.")
364
- # Update state variables for the next step (creation)
365
- state = STATE_CREATING_SPACE
366
- repo_name = new_repo_name
367
  # Yield updated history and state variables (pass UI outputs through)
368
  yield (history, repo_id, state, updated_preview, updated_run, updated_build,
369
  attempts, app_desc, repo_name, generated_code, use_grounding)
 
228
 
229
  # Helper function to update send button interactivity based on prereqs
230
  # MODIFIED to return gr.update
231
+ # FIX: Added *args, **kwargs to accept any extra arguments passed by Gradio chaining
232
+ def check_send_button_ready(profile: gr.OAuthProfile | None, token: gr.OAuthToken | None, api_key: str | None, model_name: str | None, *args, **kwargs) -> gr.update:
233
  """Checks if HF login and Gemini configuration are complete and returns update for button interactivity."""
234
  is_logged_in = profile is not None and token is not None
235
  is_gemini_ready = api_key is not None and model_name is not None
 
362
  # User requested simple space creation with a name
363
  new_repo_name = create_match.group(1).strip()
364
  history = add_bot_message(history, f"Acknowledged: '{message}'. Starting workflow to create Space `{hf_profile.username}/{new_repo_name}`.")
365
+ state = STATE_CREATING_SPACE # Transition state to creation
366
+ repo_name = new_repo_name # Store the validated repo name
 
367
  # Yield updated history and state variables (pass UI outputs through)
368
  yield (history, repo_id, state, updated_preview, updated_run, updated_build,
369
  attempts, app_desc, repo_name, generated_code, use_grounding)