From b2d02ed624f9354214228c3f4d5dcb1a74d792b3 Mon Sep 17 00:00:00 2001 From: Heiner Lohaus Date: Mon, 11 Dec 2023 02:50:33 +0100 Subject: Change default port for gui Change default host for api Disable gui in build Add custom docker user --- g4f/cli.py | 2 +- g4f/debug.py | 10 +++++----- g4f/gui/run.py | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'g4f') diff --git a/g4f/cli.py b/g4f/cli.py index 20131e5d..40ddd3d7 100644 --- a/g4f/cli.py +++ b/g4f/cli.py @@ -15,7 +15,7 @@ def main(): parser = argparse.ArgumentParser(description="Run gpt4free") subparsers = parser.add_subparsers(dest="mode", help="Mode to run the g4f in.") api_parser=subparsers.add_parser("api") - api_parser.add_argument("--bind", default="127.0.0.1:1337", help="The bind string.") + api_parser.add_argument("--bind", default="0.0.0.0:1337", help="The bind string.") api_parser.add_argument("--debug", type=bool, default=False, help="Enable verbose logging") api_parser.add_argument("--ignored-providers", nargs="+", choices=[provider.name for provider in IgnoredProviders], default=[], help="List of providers to ignore when processing request.") diff --git a/g4f/debug.py b/g4f/debug.py index 85009277..1ee1506f 100644 --- a/g4f/debug.py +++ b/g4f/debug.py @@ -1,6 +1,6 @@ from os import environ from requests import get -from importlib.metadata import version, PackageNotFoundError +from importlib.metadata import version as get_package_version, PackageNotFoundError from subprocess import check_output, CalledProcessError, PIPE from .errors import VersionNotFoundError @@ -10,7 +10,7 @@ version_check = True def get_version() -> str: # Read from package manager try: - return version("g4f") + return get_package_version("g4f") except PackageNotFoundError: pass # Read from docker environment @@ -33,7 +33,7 @@ def check_pypi_version() -> None: try: version = get_version() latest_version = get_lastet_version() + if version != latest_version: + print(f'New pypi version: {latest_version} (current: {version}) | pip install -U g4f') except Exception as e: - print(f'Failed to check g4f pypi version: {e}') - if version != latest_version: - print(f'New pypi version: {latest_version} (current: {version}) | pip install -U g4f') \ No newline at end of file + print(f'Failed to check g4f pypi version: {e}') \ No newline at end of file diff --git a/g4f/gui/run.py b/g4f/gui/run.py index 0f94814c..7ff769fd 100644 --- a/g4f/gui/run.py +++ b/g4f/gui/run.py @@ -6,7 +6,7 @@ from g4f.gui import run_gui def gui_parser(): parser = ArgumentParser(description="Run the GUI") parser.add_argument("-host", type=str, default="0.0.0.0", help="hostname") - parser.add_argument("-port", type=int, default=80, help="port") + parser.add_argument("-port", type=int, default=8080, help="port") parser.add_argument("-debug", action="store_true", help="debug mode") return parser -- cgit v1.2.3