Skip to content
This repository has been archived by the owner on Jul 31, 2024. It is now read-only.

Fix reset conversation #6

Merged
merged 2 commits into from
Nov 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion bard/bard.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ async def _get_session(self, force_close: bool = False) -> ClientSession:
"__Secure-1PSIDTS": self.secure_1psidts,
}

if self.session and force_close:
if self.session and not self.session.closed and force_close:
await self.session.close()
self.session = None

if not self.session:
self.session = ClientSession(
Expand Down Expand Up @@ -144,6 +145,7 @@ async def close_conversation(self) -> None:
"""
if self.session and not self.session.closed:
await self.session.close()
self.session = None

self.conversation_id = None
self.response_id = None
Expand Down