|
@@ -7,7 +7,7 @@ from pydantic import BaseModel, Field
|
|
|
|
|
|
from core.file import File, FileAttribute, file_manager
|
|
|
from core.variables import Segment, SegmentGroup, Variable
|
|
|
-from core.variables.segments import FileSegment
|
|
|
+from core.variables.segments import FileSegment, NoneSegment
|
|
|
from factories import variable_factory
|
|
|
|
|
|
from ..constants import CONVERSATION_VARIABLE_NODE_ID, ENVIRONMENT_VARIABLE_NODE_ID, SYSTEM_VARIABLE_NODE_ID
|
|
@@ -131,11 +131,13 @@ class VariablePool(BaseModel):
|
|
|
if attr not in {item.value for item in FileAttribute}:
|
|
|
return None
|
|
|
value = self.get(selector)
|
|
|
- if not isinstance(value, FileSegment):
|
|
|
+ if not isinstance(value, (FileSegment, NoneSegment)):
|
|
|
return None
|
|
|
- attr = FileAttribute(attr)
|
|
|
- attr_value = file_manager.get_attr(file=value.value, attr=attr)
|
|
|
- return variable_factory.build_segment(attr_value)
|
|
|
+ if isinstance(value, FileSegment):
|
|
|
+ attr = FileAttribute(attr)
|
|
|
+ attr_value = file_manager.get_attr(file=value.value, attr=attr)
|
|
|
+ return variable_factory.build_segment(attr_value)
|
|
|
+ return value
|
|
|
|
|
|
return value
|
|
|
|