mirror of
https://github.com/basicmachines-co/basic-memory
synced 2026-06-21 13:47:35 +00:00
add title/folder to EntitySchema
This commit is contained in:
@@ -182,15 +182,21 @@ class Entity(BaseModel):
|
||||
- Optional description for high-level overview
|
||||
"""
|
||||
|
||||
file_path: str
|
||||
entity_type: EntityType = "note"
|
||||
title: str
|
||||
content: Optional[str] = None
|
||||
folder: str
|
||||
entity_type: EntityType = "note"
|
||||
entity_metadata: Optional[Dict] = Field(default=None, description="Optional metadata")
|
||||
content_type: ContentType = Field(
|
||||
description="MIME type of the content (e.g. text/markdown, image/jpeg)",
|
||||
examples=["text/markdown", "image/jpeg"], default="text/markdown"
|
||||
)
|
||||
|
||||
@property
|
||||
def file_path(self):
|
||||
"""Get the file path for this entity based on its permalink."""
|
||||
return f"{self.folder}/{self.title}.md" if self.folder else f"{self.title}.md"
|
||||
|
||||
@property
|
||||
def permalink(self) -> PathId:
|
||||
"""Get the path ID in format {snake_case_title}."""
|
||||
|
||||
@@ -117,6 +117,7 @@ class EntityResponse(SQLAlchemyModel):
|
||||
"""
|
||||
|
||||
permalink: PathId
|
||||
title: str
|
||||
file_path: str
|
||||
entity_type: EntityType
|
||||
entity_metadata: Optional[Dict] = None
|
||||
|
||||
Reference in New Issue
Block a user