37
37
from reflex import constants , model
38
38
from reflex .compiler import templates
39
39
from 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
41
41
from reflex .utils .exceptions import (
42
42
GeneratedCodeHasNoFunctionDefsError ,
43
43
SystemPackageMissingError ,
@@ -1695,31 +1695,6 @@ def validate_and_create_app_using_remote_template(
1695
1695
)
1696
1696
1697
1697
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
-
1723
1698
def fetch_remote_templates (
1724
1699
template : str ,
1725
1700
) -> tuple [str , dict [str , Template ]]:
@@ -1744,15 +1719,12 @@ def fetch_remote_templates(
1744
1719
return template , available_templates
1745
1720
1746
1721
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 :
1750
1723
"""Initialize the app either from a remote template or a blank app. If the config file exists, it is considered as reinit.
1751
1724
1752
1725
Args:
1753
1726
app_name: The name of the app.
1754
1727
template: The name of the template to use.
1755
- ai: Whether to use AI to generate the template.
1756
1728
1757
1729
Returns:
1758
1730
The name of the template.
@@ -1768,11 +1740,6 @@ def initialize_app(
1768
1740
telemetry .send ("reinit" )
1769
1741
return
1770
1742
1771
- generation_hash = None
1772
- if ai :
1773
- generation_hash = generate_template_using_ai (template )
1774
- template = constants .Templates .DEFAULT
1775
-
1776
1743
templates : dict [str , Template ] = {}
1777
1744
1778
1745
# Don't fetch app templates if the user directly asked for DEFAULT.
@@ -1781,11 +1748,7 @@ def initialize_app(
1781
1748
1782
1749
if template is None :
1783
1750
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 :
1789
1752
console .print (
1790
1753
f"Go to the templates page ({ constants .Templates .REFLEX_TEMPLATES_URL } ) and copy the command to init with a template."
1791
1754
)
@@ -1800,11 +1763,6 @@ def initialize_app(
1800
1763
app_name = app_name , template = template , templates = templates
1801
1764
)
1802
1765
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
- )
1808
1766
telemetry .send ("init" , template = template )
1809
1767
1810
1768
return template
0 commit comments