fix web import url is too long (#6402)

This commit is contained in:
Jyong 2024-07-18 01:14:36 +08:00 committed by GitHub
parent 8a80af39c9
commit f55876bcc5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -845,13 +845,17 @@ class DocumentService:
'only_main_content': website_info.get('only_main_content', False),
'mode': 'crawl',
}
if url.length > 255:
document_name = url[:200] + '...'
else:
document_name = url
document = DocumentService.build_document(
dataset, dataset_process_rule.id,
document_data["data_source"]["type"],
document_data["doc_form"],
document_data["doc_language"],
data_source_info, created_from, position,
account, url, batch
account, document_name, batch
)
db.session.add(document)
db.session.flush()