mirror of
https://github.com/tiennm99/serena.git
synced 2026-10-13 06:15:43 +00:00
Instead of checking for extension, check if file exists
This commit is contained in:
1 parent
870aa2cc3a
commit
201db5afcb
1 file changed
+6
-2
@@ -124,7 +124,9 @@ class SerenaAgentMode(ToolInclusionDefinition, ToStringMixin):
|
||||
|
||||
@classmethod
|
||||
def load(cls, name_or_path: str | Path) -> Self:
|
||||
if str(name_or_path).endswith(".yml"):
|
||||
# Check if it's a file path that exists
|
||||
path = Path(name_or_path)
|
||||
if path.exists() and path.is_file():
|
||||
return cls.from_yaml(name_or_path)
|
||||
return cls.from_name(str(name_or_path))
|
||||
|
||||
@@ -225,7 +227,9 @@ class SerenaAgentContext(ToolInclusionDefinition, ToStringMixin):
|
||||
|
||||
@classmethod
|
||||
def load(cls, name_or_path: str | Path) -> Self:
|
||||
if str(name_or_path).endswith(".yml"):
|
||||
# Check if it's a file path that exists
|
||||
path = Path(name_or_path)
|
||||
if path.exists() and path.is_file():
|
||||
return cls.from_yaml(name_or_path)
|
||||
return cls.from_name(str(name_or_path))
|
||||
|
||||
|
||||
Reference in new issue
Block a user