Skip to content

Commit 8a065c3

Browse files
groksrcclaude[bot]
andauthored
fix: handle None from_entity in Context API RelationSummary (#166)
Signed-off-by: Drew Cain <groksrc@gmail.com> Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
1 parent 2a3adc1 commit 8a065c3

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

src/basic_memory/api/routers/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ async def to_summary(item: SearchIndexRow | ContextResultRow):
5252
file_path=item.file_path,
5353
permalink=item.permalink, # pyright: ignore
5454
relation_type=item.relation_type, # pyright: ignore
55-
from_entity=from_entity.title, # pyright: ignore
55+
from_entity=from_entity.title if from_entity else None,
5656
to_entity=to_entity.title if to_entity else None,
5757
created_at=item.created_at,
5858
)

src/basic_memory/schemas/memory.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ class RelationSummary(BaseModel):
134134
file_path: str
135135
permalink: str
136136
relation_type: str
137-
from_entity: str
137+
from_entity: Optional[str] = None
138138
to_entity: Optional[str] = None
139139
created_at: datetime
140140

0 commit comments

Comments
 (0)