diff --git a/src/gemini_webapi/client.py b/src/gemini_webapi/client.py index 1b20a27..2f93d10 100644 --- a/src/gemini_webapi/client.py +++ b/src/gemini_webapi/client.py @@ -212,6 +212,8 @@ async def close(self, delay: float = 0) -> None: if delay: await asyncio.sleep(delay) + self.running = False + if self.close_task: self.close_task.cancel() self.close_task = None @@ -219,8 +221,6 @@ async def close(self, delay: float = 0) -> None: if self.client: await self.client.aclose() - self.running = False - async def reset_close_task(self) -> None: """ Reset the timer for closing the client when a new request is made. @@ -486,7 +486,9 @@ def __setattr__(self, name: str, value: Any) -> None: self.rcid = value.rcid async def send_message( - self, prompt: str, images: list[bytes | str | Path] | None = None, + self, + prompt: str, + images: list[bytes | str | Path] | None = None, ) -> ModelOutput: """ Generates contents with prompt.