Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

Fix/dataset init (#409)

Jyongce2996e7d419
diff --git a/api/.env.example b/api/.env.example
index b9c819535c2..51a74b0ddd6 100644
--- a/api/.env.example
+++ b/api/.env.example
@@ -85,3 +85,9 @@ SENTRY_DSN=
# DEBUG
DEBUG=false
SQLALCHEMY_ECHO=false
+
+# Notion import configuration, support public and internal
+NOTION_INTEGRATION_TYPE=public
+NOTION_CLIENT_SECRET=you-client-secret
+NOTION_CLIENT_ID=you-client-id
+NOTION_INTERNAL_SECRET=you-internal-secret
\ No newline at end of file
diff --git a/api/services/dataset_service.py b/api/services/dataset_service.py
index 2619cdcbe17..10f1fc2f35c 100644
--- a/api/services/dataset_service.py
+++ b/api/services/dataset_service.py
@@ -78,7 +78,7 @@ class DatasetService:
raise DatasetNameDuplicateError(
f'Dataset with name {name} already exists.')
- dataset = Dataset(name=name, indexing_technique=indexing_technique, data_source_type='upload_file')
+ dataset = Dataset(name=name, indexing_technique=indexing_technique)
# dataset = Dataset(name=name, provider=provider, config=config)
dataset.created_by = account.id
dataset.updated_by = account.id
@@ -374,6 +374,11 @@ class DocumentService:
def save_document_with_dataset_id(dataset: Dataset, document_data: dict,
account: Account, dataset_process_rule: Optional[DatasetProcessRule] = None,
created_from: str = 'web'):
+ # if dataset is empty, update dataset data_source_type
+ if not dataset.data_source_type:
+ dataset.data_source_type = document_data["data_source"]["type"]
+ db.session.commit()
+
if not dataset.indexing_technique:
if 'indexing_technique' not in document_data \
or document_data['indexing_technique'] not in Dataset.INDEXING_TECHNIQUE_LIST: