返回提交历史
Modified
g4f/api/__init__.py
+18
-9
XFEstudio/gpt4free
Update __init__.py
f2d176cc
代码差异
1 个文件
+18
-9
@@ -629,27 +629,36 @@ def run_api(
629
629
debug: bool = False,
630
630
workers: int = None,
631
631
use_colors: bool = None,
632
reload: bool = False
632
reload: bool = False,
633
ssl_keyfile: str = None,
634
ssl_certfile: str = None
633
635
) -> None:
634
636
print(f'Starting server... [g4f v-{g4f.version.utils.current_version}]' + (" (debug)" if debug else ""))
637
635
638
if use_colors is None:
636
639
use_colors = debug
640
637
641
if bind is not None:
638
642
host, port = bind.split(":")
643
639
644
if port is None:
640
645
port = DEFAULT_PORT
646
641
647
if AppConfig.demo and debug:
642
648
method = "create_app_with_demo_and_debug"
643
649
elif AppConfig.gui and debug:
644
650
method = "create_app_with_gui_and_debug"
645
651
else:
646
652
method = "create_app_debug" if debug else "create_app"
653
647
654
uvicorn.run(
648
f"g4f.api:{method}",
649
host=host,
650
port=int(port),
651
workers=workers,
652
use_colors=use_colors,
653
factory=True,
654
reload=reload
655
)
655
f"g4f.api:{method}",
656
host=host,
657
port=int(port),
658
workers=workers,
659
use_colors=use_colors,
660
factory=True,
661
reload=reload,
662
ssl_keyfile=ssl_keyfile,
663
ssl_certfile=ssl_certfile
664
)