Simon Strandgaard commited on
Commit
ea9b4a7
·
1 Parent(s): d7b6667

hide/show the openrouter api key textbox depending on the config

Browse files
Files changed (1) hide show
  1. src/plan/app_text2plan.py +6 -2
src/plan/app_text2plan.py CHANGED
@@ -34,18 +34,21 @@ IS_HUGGINGFACE_SPACES = is_huggingface_spaces()
34
  class Config:
35
  use_uuid_as_run_id: bool
36
  visible_open_output_dir_button: bool
 
37
  allow_only_openrouter_models: bool
38
  enable_purge_old_runs: bool
39
 
40
  CONFIG_LOCAL = Config(
41
  use_uuid_as_run_id=False,
42
  visible_open_output_dir_button=True,
 
43
  allow_only_openrouter_models=False,
44
  enable_purge_old_runs=False,
45
  )
46
  CONFIG_HUGGINGFACE_SPACES = Config(
47
  use_uuid_as_run_id=True,
48
  visible_open_output_dir_button=False,
 
49
  allow_only_openrouter_models=True,
50
  enable_purge_old_runs=True,
51
  )
@@ -426,8 +429,9 @@ with gr.Blocks(title="PlanExe") as demo_text2plan:
426
  openrouter_api_key_text = gr.Textbox(
427
  label="OpenRouter API Key",
428
  type="password",
429
- placeholder="Enter your OpenRouter API key (optional)",
430
- info="Sign up at [OpenRouter](https://openrouter.ai/) to get an API key. A small top-up (e.g. 5 USD) is needed to access paid models."
 
431
  )
432
 
433
  with gr.Tab("Join the community"):
 
34
  class Config:
35
  use_uuid_as_run_id: bool
36
  visible_open_output_dir_button: bool
37
+ visible_openrouter_api_key_textbox: bool
38
  allow_only_openrouter_models: bool
39
  enable_purge_old_runs: bool
40
 
41
  CONFIG_LOCAL = Config(
42
  use_uuid_as_run_id=False,
43
  visible_open_output_dir_button=True,
44
+ visible_openrouter_api_key_textbox=False,
45
  allow_only_openrouter_models=False,
46
  enable_purge_old_runs=False,
47
  )
48
  CONFIG_HUGGINGFACE_SPACES = Config(
49
  use_uuid_as_run_id=True,
50
  visible_open_output_dir_button=False,
51
+ visible_openrouter_api_key_textbox=True,
52
  allow_only_openrouter_models=True,
53
  enable_purge_old_runs=True,
54
  )
 
429
  openrouter_api_key_text = gr.Textbox(
430
  label="OpenRouter API Key",
431
  type="password",
432
+ placeholder="Enter your OpenRouter API key (required)",
433
+ info="Sign up at [OpenRouter](https://openrouter.ai/) to get an API key. A small top-up (e.g. 5 USD) is needed to access paid models.",
434
+ visible=CONFIG.visible_openrouter_api_key_textbox
435
  )
436
 
437
  with gr.Tab("Join the community"):