mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-06 05:39:12 +00:00
Fix process for generating embeddings for Notion entries (#648)
* Fix process for generating embeddings for Notion entries * If no title field found, just log a warning and set the title to
This commit is contained in:
@@ -112,7 +112,9 @@ class NotionToEntries(TextToEntries):
|
||||
page_entries = self.process_page(p_or_d)
|
||||
current_entries.extend(page_entries)
|
||||
|
||||
return self.update_entries_with_ids(current_entries, user)
|
||||
current_entries = TextToEntries.split_entries_by_max_tokens(current_entries, max_tokens=256)
|
||||
|
||||
return self.update_entries_with_ids(current_entries, user=user)
|
||||
|
||||
def process_page(self, page):
|
||||
page_id = page["id"]
|
||||
@@ -232,8 +234,9 @@ class NotionToEntries(TextToEntries):
|
||||
elif "Event" in properties:
|
||||
title_field = "Event"
|
||||
elif title_field not in properties:
|
||||
logger.error(f"Page {page_id} does not have a title field")
|
||||
return None, None
|
||||
logger.warning(f"Title field not found for page {page_id}. Setting title as None...")
|
||||
title = None
|
||||
return title, content
|
||||
try:
|
||||
title = page["properties"][title_field]["title"][0]["text"]["content"]
|
||||
except Exception as e:
|
||||
|
||||
Reference in New Issue
Block a user