From 3a23e81de93c4c9a83aa22b70ea13066f06541e3 Mon Sep 17 00:00:00 2001 From: Heiner Lohaus Date: Sun, 21 Apr 2024 22:39:00 +0200 Subject: Add Replicate Provider Fix Bug in OpenaiChat and MetaAI Add read cookie and .har files Use factory for api app --- g4f/gui/__init__.py | 3 --- g4f/gui/gui_parser.py | 1 + g4f/gui/run.py | 6 ++++++ 3 files changed, 7 insertions(+), 3 deletions(-) (limited to 'g4f/gui') diff --git a/g4f/gui/__init__.py b/g4f/gui/__init__.py index f5e448ad..930a2aa0 100644 --- a/g4f/gui/__init__.py +++ b/g4f/gui/__init__.py @@ -12,9 +12,6 @@ def run_gui(host: str = '0.0.0.0', port: int = 8080, debug: bool = False) -> Non if import_error is not None: raise MissingRequirementsError(f'Install "gui" requirements | pip install -U g4f[gui]\n{import_error}') - if debug: - from g4f import debug - debug.logging = True config = { 'host' : host, 'port' : port, diff --git a/g4f/gui/gui_parser.py b/g4f/gui/gui_parser.py index ad458f5c..9fd70bef 100644 --- a/g4f/gui/gui_parser.py +++ b/g4f/gui/gui_parser.py @@ -5,4 +5,5 @@ def gui_parser(): parser.add_argument("-host", type=str, default="0.0.0.0", help="hostname") parser.add_argument("-port", type=int, default=8080, help="port") parser.add_argument("-debug", action="store_true", help="debug mode") + parser.add_argument("--ignore-cookie-files", action="store_true", help="Don't read .har and cookie files.") return parser \ No newline at end of file diff --git a/g4f/gui/run.py b/g4f/gui/run.py index 91314d2d..9b1c527c 100644 --- a/g4f/gui/run.py +++ b/g4f/gui/run.py @@ -1,6 +1,12 @@ from .gui_parser import gui_parser +from ..cookies import read_cookie_files +import g4f.debug def run_gui_args(args): + if args.debug: + g4f.debug.logging = True + if not args.ignore_cookie_files: + read_cookie_files() from g4f.gui import run_gui host = args.host port = args.port -- cgit v1.2.3