mirror of
https://github.com/basicmachines-co/basic-memory
synced 2026-06-21 13:47:35 +00:00
rename entity.name to entity.title
This commit is contained in:
@@ -60,7 +60,7 @@ class KnowledgeWriter:
|
||||
# This prevents duplicate titles when raw content already has a title
|
||||
if not (entity.observations or entity.outgoing_relations):
|
||||
sections.extend([
|
||||
f"# {entity.name}",
|
||||
f"# {entity.title}",
|
||||
"", # Empty line after title
|
||||
])
|
||||
|
||||
@@ -88,7 +88,7 @@ class KnowledgeWriter:
|
||||
])
|
||||
|
||||
for rel in entity.outgoing_relations:
|
||||
line = f"- {rel.relation_type} [[{rel.to_entity.name}]]"
|
||||
line = f"- {rel.relation_type} [[{rel.to_entity.title}]]"
|
||||
if rel.context:
|
||||
line += f" ({rel.context})"
|
||||
sections.append(line)
|
||||
@@ -96,4 +96,4 @@ class KnowledgeWriter:
|
||||
|
||||
# Return joined sections, ensure content isn't empty
|
||||
content = "\n".join(sections).strip()
|
||||
return content if content else f"# {entity.name}"
|
||||
return content if content else f"# {entity.title}"
|
||||
|
||||
@@ -42,7 +42,7 @@ class Entity(Base):
|
||||
|
||||
# Core identity
|
||||
id: Mapped[int] = mapped_column(Integer, primary_key=True)
|
||||
name: Mapped[str] = mapped_column(String)
|
||||
title: Mapped[str] = mapped_column(String)
|
||||
entity_type: Mapped[str] = mapped_column(String)
|
||||
entity_metadata: Mapped[Optional[dict]] = mapped_column(JSON, nullable=True)
|
||||
content_type: Mapped[str] = mapped_column(String)
|
||||
@@ -85,7 +85,7 @@ class Entity(Base):
|
||||
return self.incoming_relations + self.outgoing_relations
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return f"Entity(id={self.id}, name='{self.name}', type='{self.entity_type}', summary='{self.summary}')"
|
||||
return f"Entity(id={self.id}, name='{self.title}', type='{self.entity_type}', summary='{self.summary}')"
|
||||
|
||||
|
||||
class ObservationCategory(str, Enum):
|
||||
|
||||
@@ -81,7 +81,7 @@ class EntityRepository(Repository[Entity]):
|
||||
self.select()
|
||||
.where(
|
||||
or_(
|
||||
Entity.name.ilike(search_term),
|
||||
Entity.title.ilike(search_term),
|
||||
Entity.entity_type.ilike(search_term),
|
||||
Entity.summary.ilike(search_term),
|
||||
Entity.observations.any(Observation.content.ilike(search_term)),
|
||||
|
||||
@@ -96,7 +96,7 @@ class ActivityService:
|
||||
change_type=change_type,
|
||||
timestamp=updated_at,
|
||||
path_id=entity.path_id,
|
||||
summary=f"{change_type.value.title()} entity: {entity.name}",
|
||||
summary=f"{change_type.value.title()} entity: {entity.title}",
|
||||
content=entity.summary
|
||||
)
|
||||
)
|
||||
|
||||
@@ -54,7 +54,7 @@ class SearchService:
|
||||
# Build searchable content
|
||||
content = "\n".join(
|
||||
[
|
||||
entity.name,
|
||||
entity.title,
|
||||
entity.summary or "",
|
||||
# Add observations
|
||||
*[f"{obs.category}: {obs.content}" for obs in entity.observations],
|
||||
|
||||
@@ -23,7 +23,7 @@ def entity_model_from_markdown(file_path: str, markdown: EntityMarkdown) -> Enti
|
||||
return obs.category
|
||||
|
||||
model = EntityModel(
|
||||
name=markdown.frontmatter.title,
|
||||
title=markdown.frontmatter.title,
|
||||
entity_type=markdown.frontmatter.type,
|
||||
path_id=markdown.frontmatter.id,
|
||||
file_path=file_path,
|
||||
@@ -82,7 +82,7 @@ class EntitySyncService:
|
||||
raise EntityNotFoundError(f"Entity not found: {path_id}")
|
||||
|
||||
# Update fields from markdown
|
||||
db_entity.name = markdown.frontmatter.title
|
||||
db_entity.title = markdown.frontmatter.title
|
||||
db_entity.entity_type = markdown.frontmatter.type
|
||||
db_entity.summary = markdown.content.content
|
||||
|
||||
@@ -106,7 +106,7 @@ class EntitySyncService:
|
||||
return await self.entity_repository.update(
|
||||
db_entity.id,
|
||||
{
|
||||
"name": db_entity.name,
|
||||
"name": db_entity.title,
|
||||
"entity_type": db_entity.entity_type,
|
||||
"summary": db_entity.summary,
|
||||
# Mark as incomplete
|
||||
|
||||
Reference in New Issue
Block a user