Skip to content

Commit

Permalink
Fix cleanup bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Bobholamovic committed Dec 22, 2023
1 parent d54a93b commit 7df8462
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions erniebot-agent/src/erniebot_agent/file/global_file_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,25 +23,25 @@
_global_file_manager: Optional[FileManager] = None


def get_global_file_manager() -> FileManager:
async def get_global_file_manager() -> FileManager:
global _global_file_manager
if _global_file_manager is None:
_global_file_manager = _create_default_file_manager(access_token=None, save_dir=None)
_global_file_manager = await _create_default_file_manager(access_token=None, save_dir=None)
return _global_file_manager


def configure_global_file_manager(
async def configure_global_file_manager(
access_token: Optional[str] = None, save_dir: Optional[str] = None, **opts: Any
) -> None:
global _global_file_manager
if _global_file_manager is not None:
raise RuntimeError(
"The global file manager can only be configured once before calling `get_global_file_manager`."
)
_global_file_manager = _create_default_file_manager(access_token=access_token, save_dir=save_dir, **opts)
_global_file_manager = await _create_default_file_manager(access_token=access_token, save_dir=save_dir, **opts)


def _create_default_file_manager(
async def _create_default_file_manager(
access_token: Optional[str], save_dir: Optional[str], **opts: Any
) -> FileManager:
async def _close_file_manager():
Expand Down

0 comments on commit 7df8462

Please sign in to comment.