mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-10-09 12:47:13 +02:00
Notion Fix Nested Properties (#2877)
This commit is contained in:
@@ -241,6 +241,11 @@ class NotionConnector(LoadConnector, PollConnector):
|
|||||||
)
|
)
|
||||||
|
|
||||||
# TODO there may be more types to handle here
|
# TODO there may be more types to handle here
|
||||||
|
if isinstance(inner_dict, str):
|
||||||
|
# For some objects the innermost value could just be a string, not sure what causes this
|
||||||
|
return inner_dict
|
||||||
|
|
||||||
|
elif isinstance(inner_dict, dict):
|
||||||
if "name" in inner_dict:
|
if "name" in inner_dict:
|
||||||
return inner_dict["name"]
|
return inner_dict["name"]
|
||||||
if "content" in inner_dict:
|
if "content" in inner_dict:
|
||||||
@@ -268,7 +273,13 @@ class NotionConnector(LoadConnector, PollConnector):
|
|||||||
if not prop:
|
if not prop:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
try:
|
||||||
inner_value = _recurse_properties(prop)
|
inner_value = _recurse_properties(prop)
|
||||||
|
except Exception as e:
|
||||||
|
# This is not a critical failure, these properties are not the actual contents of the page
|
||||||
|
# more similar to metadata
|
||||||
|
logger.warning(f"Error recursing properties for {prop_name}: {e}")
|
||||||
|
continue
|
||||||
# Not a perfect way to format Notion database tables but there's no perfect representation
|
# Not a perfect way to format Notion database tables but there's no perfect representation
|
||||||
# since this must be represented as plaintext
|
# since this must be represented as plaintext
|
||||||
if inner_value:
|
if inner_value:
|
||||||
|
@@ -1,4 +1,3 @@
|
|||||||
import argparse
|
|
||||||
import subprocess
|
import subprocess
|
||||||
import threading
|
import threading
|
||||||
|
|
||||||
@@ -135,7 +134,4 @@ def run_jobs() -> None:
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
parser = argparse.ArgumentParser(description="Run background jobs.")
|
|
||||||
args = parser.parse_args()
|
|
||||||
|
|
||||||
run_jobs()
|
run_jobs()
|
||||||
|
Reference in New Issue
Block a user