mirror of
https://github.com/khoj-ai/khoj.git
synced 2024-11-27 17:35:07 +01: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:
parent
43013c4fd4
commit
138f5223bd
1 changed files with 6 additions and 3 deletions
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue