3737from reflex import constants , model
3838from reflex .compiler import templates
3939from reflex .config import Config , environment , get_config
40- from reflex .utils import console , net , path_ops , processes , redir
40+ from reflex .utils import console , net , path_ops , processes
4141from reflex .utils .exceptions import (
4242 GeneratedCodeHasNoFunctionDefsError ,
4343 SystemPackageMissingError ,
@@ -1695,31 +1695,6 @@ def validate_and_create_app_using_remote_template(
16951695 )
16961696
16971697
1698- def generate_template_using_ai (template : str | None = None ) -> str :
1699- """Generate a template using AI(Flexgen).
1700-
1701- Args:
1702- template: The name of the template.
1703-
1704- Returns:
1705- The generation hash.
1706-
1707- Raises:
1708- Exit: If the template and ai flags are used.
1709- """
1710- if template is None :
1711- # If AI is requested and no template specified, redirect the user to reflex.build.
1712- return redir .reflex_build_redirect ()
1713- elif is_generation_hash (template ):
1714- # Otherwise treat the template as a generation hash.
1715- return template
1716- else :
1717- console .error (
1718- "Cannot use `--template` option with `--ai` option. Please remove `--template` option."
1719- )
1720- raise typer .Exit (2 )
1721-
1722-
17231698def fetch_remote_templates (
17241699 template : str ,
17251700) -> tuple [str , dict [str , Template ]]:
@@ -1744,15 +1719,12 @@ def fetch_remote_templates(
17441719 return template , available_templates
17451720
17461721
1747- def initialize_app (
1748- app_name : str , template : str | None = None , ai : bool = False
1749- ) -> str | None :
1722+ def initialize_app (app_name : str , template : str | None = None ) -> str | None :
17501723 """Initialize the app either from a remote template or a blank app. If the config file exists, it is considered as reinit.
17511724
17521725 Args:
17531726 app_name: The name of the app.
17541727 template: The name of the template to use.
1755- ai: Whether to use AI to generate the template.
17561728
17571729 Returns:
17581730 The name of the template.
@@ -1768,11 +1740,6 @@ def initialize_app(
17681740 telemetry .send ("reinit" )
17691741 return
17701742
1771- generation_hash = None
1772- if ai :
1773- generation_hash = generate_template_using_ai (template )
1774- template = constants .Templates .DEFAULT
1775-
17761743 templates : dict [str , Template ] = {}
17771744
17781745 # Don't fetch app templates if the user directly asked for DEFAULT.
@@ -1781,11 +1748,7 @@ def initialize_app(
17811748
17821749 if template is None :
17831750 template = prompt_for_template_options (get_init_cli_prompt_options ())
1784- if template == constants .Templates .AI :
1785- generation_hash = generate_template_using_ai ()
1786- # change to the default to allow creation of default app
1787- template = constants .Templates .DEFAULT
1788- elif template == constants .Templates .CHOOSE_TEMPLATES :
1751+ if template == constants .Templates .CHOOSE_TEMPLATES :
17891752 console .print (
17901753 f"Go to the templates page ({ constants .Templates .REFLEX_TEMPLATES_URL } ) and copy the command to init with a template."
17911754 )
@@ -1800,11 +1763,6 @@ def initialize_app(
18001763 app_name = app_name , template = template , templates = templates
18011764 )
18021765
1803- # If a reflex.build generation hash is available, download the code and apply it to the main module.
1804- if generation_hash :
1805- initialize_main_module_index_from_generation (
1806- app_name , generation_hash = generation_hash
1807- )
18081766 telemetry .send ("init" , template = template )
18091767
18101768 return template
0 commit comments