diff options
author | H Lohaus <hlohaus@users.noreply.github.com> | 2024-11-19 17:26:05 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-19 17:26:05 +0100 |
commit | a0f3ea144307321740d9634513e356d039851b33 (patch) | |
tree | 26181d312eb3e8892c8e61e624dcc72cefbd42b0 | |
parent | Merge pull request #2380 from hlohaus/info (diff) | |
parent | Add aliases to gui arguments, fix logs variable (diff) | |
download | gpt4free-a0f3ea144307321740d9634513e356d039851b33.tar gpt4free-a0f3ea144307321740d9634513e356d039851b33.tar.gz gpt4free-a0f3ea144307321740d9634513e356d039851b33.tar.bz2 gpt4free-a0f3ea144307321740d9634513e356d039851b33.tar.lz gpt4free-a0f3ea144307321740d9634513e356d039851b33.tar.xz gpt4free-a0f3ea144307321740d9634513e356d039851b33.tar.zst gpt4free-a0f3ea144307321740d9634513e356d039851b33.zip |
-rw-r--r-- | g4f/debug.py | 1 | ||||
-rw-r--r-- | g4f/gui/client/static/css/style.css | 1 | ||||
-rw-r--r-- | g4f/gui/gui_parser.py | 10 | ||||
-rw-r--r-- | g4f/gui/server/api.py | 10 |
4 files changed, 13 insertions, 9 deletions
diff --git a/g4f/debug.py b/g4f/debug.py index f8085add..c107cbdf 100644 --- a/g4f/debug.py +++ b/g4f/debug.py @@ -6,6 +6,7 @@ last_provider: ProviderType = None last_model: str = None version: str = None log_handler: callable = print +logs: list = [] def log(text): if logging: diff --git a/g4f/gui/client/static/css/style.css b/g4f/gui/client/static/css/style.css index 8364216a..5dc8c9c2 100644 --- a/g4f/gui/client/static/css/style.css +++ b/g4f/gui/client/static/css/style.css @@ -1060,7 +1060,6 @@ a:-webkit-any-link { .log { white-space: pre-wrap; - font-family: Consolas, "Andale Mono WT", "Andale Mono", "Lucida Console", "Lucida Sans Typewriter", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Liberation Mono", "Nimbus Mono L", Monaco, "Courier New", Courier, monospace; } .log.hidden { diff --git a/g4f/gui/gui_parser.py b/g4f/gui/gui_parser.py index 9fd70bef..5a898203 100644 --- a/g4f/gui/gui_parser.py +++ b/g4f/gui/gui_parser.py @@ -2,8 +2,12 @@ from argparse import ArgumentParser 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=8080, help="port") - parser.add_argument("-debug", action="store_true", help="debug mode") + parser.add_argument("--host", type=str, default="0.0.0.0", help="hostname") + parser.add_argument_alias('-h', '--host') + parser.add_argument("--port", type=int, default=8080, help="port") + parser.add_argument_alias('-p', '--port') + parser.add_argument("--debug", action="store_true", help="debug mode") + parser.add_argument_alias('-d', '--debug') + parser.add_argument_alias('-debug', '--debug') 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/server/api.py b/g4f/gui/server/api.py index a6c4bef4..6be77d09 100644 --- a/g4f/gui/server/api.py +++ b/g4f/gui/server/api.py @@ -142,10 +142,10 @@ class Api: def _create_response_stream(self, kwargs: dict, conversation_id: str, provider: str) -> Iterator: if debug.logging: - logs = [] + debug.logs = [] print_callback = debug.log_handler def log_handler(text: str): - logs.append(text) + debug.logs.append(text) print_callback(text) debug.log_handler = log_handler try: @@ -176,10 +176,10 @@ class Api: yield self._format_json("content", str(ImageResponse(images, chunk.alt))) elif not isinstance(chunk, FinishReason): yield self._format_json("content", str(chunk)) - if logs: - for log in logs: + if debug.logs: + for log in debug.logs: yield self._format_json("log", str(log)) - logs = [] + debug.logs = [] except Exception as e: logger.exception(e) yield self._format_json('error', get_error_message(e)) |