diff --git a/api/services/dataset_service.py b/api/services/dataset_service.py index 2cca7ebf10405d..e2c2de31181fce 100644 --- a/api/services/dataset_service.py +++ b/api/services/dataset_service.py @@ -741,10 +741,10 @@ def save_document_with_dataset_id( elif knowledge_config.data_source.info_list.data_source_type == "notion_import": notion_info_list = knowledge_config.data_source.info_list.notion_info_list for notion_info in notion_info_list: - count = count + len(notion_info["pages"]) + count = count + len(notion_info.pages) elif knowledge_config.data_source.info_list.data_source_type == "website_crawl": website_info = knowledge_config.data_source.info_list.website_info_list - count = len(website_info["urls"]) + count = len(website_info.urls) batch_upload_limit = int(dify_config.BATCH_UPLOAD_LIMIT) if count > batch_upload_limit: raise ValueError(f"You have reached the batch upload limit of {batch_upload_limit}.") @@ -902,7 +902,7 @@ def save_document_with_dataset_id( data_source_info = { "notion_workspace_id": workspace_id, "notion_page_id": page.page_id, - "notion_page_icon": page.page_icon, + "notion_page_icon": page.page_icon.model_dump(), "type": page.type, } document = DocumentService.build_document( @@ -1145,7 +1145,7 @@ def save_document_without_dataset_id(tenant_id: str, knowledge_config: Knowledge elif knowledge_config.data_source.info_list.data_source_type == "notion_import": notion_info_list = knowledge_config.data_source.info_list.notion_info_list for notion_info in notion_info_list: - count = count + len(notion_info["pages"]) + count = count + len(notion_info.pages) elif knowledge_config.data_source.info_list.data_source_type == "website_crawl": website_info = knowledge_config.data_source.info_list.website_info_list count = len(website_info.urls) diff --git a/api/services/entities/knowledge_entities/knowledge_entities.py b/api/services/entities/knowledge_entities/knowledge_entities.py index c3bf7c0a7ee796..8d6a246b6428d0 100644 --- a/api/services/entities/knowledge_entities/knowledge_entities.py +++ b/api/services/entities/knowledge_entities/knowledge_entities.py @@ -16,10 +16,16 @@ class ParentMode(str, Enum): PARAGRAPH = "paragraph" +class NotionIcon(BaseModel): + type: str + url: Optional[str] = None + emoji: Optional[str] = None + + class NotionPage(BaseModel): page_id: str page_name: str - page_icon: Optional[str] + page_icon: Optional[NotionIcon] = None type: str