Spaces:
Running
Running
File size: 1,179 Bytes
52fcaad f3d45a9 52fcaad f3d45a9 52fcaad f3d45a9 52fcaad f3d45a9 52fcaad f3d45a9 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
import os
import mesop as me
import constants as c
@me.stateclass
class State:
# App level
loading: bool = False
error: str
info: str
# Settings
api_key: str = os.getenv("GEMINI_API_KEY", "")
model: str = "gemini-1.5-flash"
runner_url: str = os.getenv("MESOP_APP_MAKER_RUNNER_URL", c.DEFAULT_URL)
runner_token: str = os.getenv("MESOP_APP_MAKER_RUNNER_TOKEN", "")
# Generate prompt panel
prompt_mode: str = "Generate"
prompt_placeholder: str
prompt: str
# Prompt history panel
prompt_history: list[dict] # Format: {"prompt", "code", "index", "mode"}
# Code editor
code_placeholder: str = c.EXAMPLE_PROGRAM
code: str = c.EXAMPLE_PROGRAM
# App preview
run_result: str
runner_url_path: str = "/"
loaded_url: str
iframe_index: int
# Sidebar
menu_open: bool = True
menu_open_type: str = "settings"
# Sub-screens
show_error_dialog: bool = False
show_generate_panel: bool = False
show_prompt_history_panel: bool = False
show_status_snackbar: bool = False
show_help_dialog: bool = bool(int(os.getenv("MESOP_APP_MAKER_SHOW_HELP", "0")))
# Async action
async_action_name: str
async_action_duration: int = 3
|