fix tests

This commit is contained in:
phernandez
2025-01-07 20:29:59 -06:00
parent 6686c331a5
commit 1c6836d83f
37 changed files with 596 additions and 780 deletions
+2 -1
View File
@@ -18,7 +18,8 @@ def entity_model(entity: EntitySchema):
entity_metadata=entity.entity_metadata,
path_id=entity.path_id,
file_path=entity.file_path,
description=entity.description,
summary=entity.summary,
content_type=entity.content_type,
observations=[Observation(content=observation) for observation in entity.observations],
)
return model
@@ -10,7 +10,6 @@ from basic_memory.schemas import Entity as EntitySchema
from basic_memory.services.entity_service import EntityService
from basic_memory.services.exceptions import EntityNotFoundError
from .file_operations import FileOperations
from ...models.knowledge import EntityType
class EntityOperations:
@@ -41,9 +40,6 @@ class EntityOperations:
"""
logger.debug(f"Reading entity with path_id: {entity.path_id}")
if entity.entity_type != EntityType.NOTE:
raise ValueError(f"Entity type {entity.entity_type} not supported")
# For notes, read the actual file content
file_path = self.file_operations.get_entity_path(entity)
@@ -8,7 +8,6 @@ from loguru import logger
from basic_memory.markdown.knowledge_writer import KnowledgeWriter
from basic_memory.markdown.note_writer import NoteWriter
from basic_memory.models import Entity as EntityModel
from basic_memory.models.knowledge import EntityType
from basic_memory.services.entity_service import EntityService
from basic_memory.services.exceptions import FileOperationError
from basic_memory.services.file_service import FileService
@@ -54,7 +53,7 @@ class FileOperations:
entity = await self.entity_service.get_by_path_id(entity.path_id)
# Select writer based on entity type
writer = self.note_writer if entity.entity_type == EntityType.NOTE else self.knowledge_writer
writer = self.note_writer if entity.entity_type == "note" else self.knowledge_writer
# Get frontmatter and content
frontmatter = await writer.format_frontmatter(entity)