bug fix
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
from dataclasses import dataclass, field, is_dataclass
|
||||
import os
|
||||
from dataclasses import dataclass
|
||||
from typing import Any
|
||||
import tyro
|
||||
import os.path as osp
|
||||
from abc import ABC, abstractmethod
|
||||
from loguru import logger
|
||||
|
||||
from lang_agent.config import InstantiateConfig
|
||||
|
||||
|
||||
class BaseFilesystemBackend(ABC):
|
||||
@@ -25,4 +27,25 @@ class BaseFilesystemBackend(ABC):
|
||||
if hasattr(self.config, "rt_skills_dir"):
|
||||
return {"skills" : [self.config.rt_skills_dir]}
|
||||
else:
|
||||
return {}
|
||||
return {}
|
||||
|
||||
|
||||
@dataclass
|
||||
class FilesystemBackendConfig(InstantiateConfig):
|
||||
"""
|
||||
Shared filesystem backend config behavior.
|
||||
If subclasses define these fields, this hook ensures they exist:
|
||||
- skills_dir
|
||||
- workspace_dir
|
||||
"""
|
||||
|
||||
def _ensure_dir_if_present(self, attr_name: str) -> None:
|
||||
path = getattr(self, attr_name, None)
|
||||
if not isinstance(path, str) or not path.strip():
|
||||
return
|
||||
os.makedirs(path, exist_ok=True)
|
||||
logger.info(f"Ensured {attr_name} exists: {path}")
|
||||
|
||||
def __post_init__(self) -> None:
|
||||
self._ensure_dir_if_present("skills_dir")
|
||||
self._ensure_dir_if_present("workspace_dir")
|
||||
Reference in New Issue
Block a user