mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-13 05:19:00 +08:00
Fix/dataset init (#409)
This commit is contained in:
parent
82d07ed2a8
commit
ce2996e7d4
@ -85,3 +85,9 @@ SENTRY_DSN=
|
|||||||
# DEBUG
|
# DEBUG
|
||||||
DEBUG=false
|
DEBUG=false
|
||||||
SQLALCHEMY_ECHO=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
|
@ -78,7 +78,7 @@ class DatasetService:
|
|||||||
raise DatasetNameDuplicateError(
|
raise DatasetNameDuplicateError(
|
||||||
f'Dataset with name {name} already exists.')
|
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 = Dataset(name=name, provider=provider, config=config)
|
||||||
dataset.created_by = account.id
|
dataset.created_by = account.id
|
||||||
dataset.updated_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,
|
def save_document_with_dataset_id(dataset: Dataset, document_data: dict,
|
||||||
account: Account, dataset_process_rule: Optional[DatasetProcessRule] = None,
|
account: Account, dataset_process_rule: Optional[DatasetProcessRule] = None,
|
||||||
created_from: str = 'web'):
|
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 not dataset.indexing_technique:
|
||||||
if 'indexing_technique' not in document_data \
|
if 'indexing_technique' not in document_data \
|
||||||
or document_data['indexing_technique'] not in Dataset.INDEXING_TECHNIQUE_LIST:
|
or document_data['indexing_technique'] not in Dataset.INDEXING_TECHNIQUE_LIST:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user