diff options
author | Heiner Lohaus <hlohaus@users.noreply.github.com> | 2024-11-19 17:25:40 +0100 |
---|---|---|
committer | Heiner Lohaus <hlohaus@users.noreply.github.com> | 2024-11-19 17:25:40 +0100 |
commit | 6e674ca33d4e61b30bfbd0422f4f75af2b17e9e6 (patch) | |
tree | 26181d312eb3e8892c8e61e624dcc72cefbd42b0 /g4f/gui/server/api.py | |
parent | Add show log option to gui (diff) | |
download | gpt4free-6e674ca33d4e61b30bfbd0422f4f75af2b17e9e6.tar gpt4free-6e674ca33d4e61b30bfbd0422f4f75af2b17e9e6.tar.gz gpt4free-6e674ca33d4e61b30bfbd0422f4f75af2b17e9e6.tar.bz2 gpt4free-6e674ca33d4e61b30bfbd0422f4f75af2b17e9e6.tar.lz gpt4free-6e674ca33d4e61b30bfbd0422f4f75af2b17e9e6.tar.xz gpt4free-6e674ca33d4e61b30bfbd0422f4f75af2b17e9e6.tar.zst gpt4free-6e674ca33d4e61b30bfbd0422f4f75af2b17e9e6.zip |
Diffstat (limited to '')
-rw-r--r-- | g4f/gui/server/api.py | 10 |
1 files changed, 5 insertions, 5 deletions
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)) |