refactor: update cookie browsers var and LMArenaBeta availability logic

- In `g4f/Provider/needs_auth/LMArenaBeta.py`, import `has_nodriver` from `...requests` in the same line as other imports
- Change `working` attribute to be set based on `has_nodriver` instead of `True`
- Add new class attribute `active_by_default = True` to `LMArenaBeta`
- In `g4f/cli/__init__.py`, change `--cookie-browsers` argument choices to use `g4f.cookies.BROWSERS` instead of `g4f.cookies.browsers`
- In `g4f/cli/__init__.py`, update `run_api_args` to assign to `g4f.cookies.BROWSERS` instead of `g4f.cookies.browsers`
- In `g4f/gui/gui_parser.py`, change import from `browsers` to `BROWSERS`
- In `g4f/gui/gui_parser.py`, update `--cookie-browsers` argument choices to use `BROWSERS` instead of `browsers`
- In `g4f/gui/run.py`, update `run_gui_args` to assign to `g4f.cookies.BROWSERS` instead of `g4f.cookies.browsers
This commit is contained in:
hlohaus
2025-08-09 03:30:37 +02:00
parent b6f51f00d8
commit 6fad9c5d58
4 changed files with 8 additions and 8 deletions

View File

@@ -26,7 +26,7 @@ def get_api_parser():
api_parser.add_argument("--g4f-api-key", type=str, default=None, help="Sets an authentication key for your API. (incompatible with --reload and --workers)")
api_parser.add_argument("--ignored-providers", nargs="+", choices=[provider.__name__ for provider in Provider.__providers__ if provider.working],
default=[], help="List of providers to ignore when processing request. (incompatible with --reload and --workers)")
api_parser.add_argument("--cookie-browsers", nargs="+", choices=[browser.__name__ for browser in g4f.cookies.browsers],
api_parser.add_argument("--cookie-browsers", nargs="+", choices=[browser.__name__ for browser in g4f.cookies.BROWSERS],
default=[], help="List of browsers to access or retrieve cookies from. (incompatible with --reload and --workers)")
api_parser.add_argument("--reload", action="store_true", help="Enable reloading.")
api_parser.add_argument("--demo", action="store_true", help="Enable demo mode.")
@@ -53,7 +53,7 @@ def run_api_args(args):
timeout=args.timeout,
)
if args.cookie_browsers:
g4f.cookies.browsers = [g4f.cookies[browser] for browser in args.cookie_browsers]
g4f.cookies.BROWSERS = [g4f.cookies[browser] for browser in args.cookie_browsers]
run_api(
bind=args.bind,
port=args.port,