diff options
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)) |