fix: dataset retrieve npe when dataset desc is null (#669)

This commit is contained in:
John Wang 2023-07-28 17:40:36 +08:00 committed by GitHub
parent 23e52f14e3
commit aae2fb8a30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -32,10 +32,11 @@ class DatasetRetrieverTool(BaseTool):
@classmethod
def from_dataset(cls, dataset: Dataset, **kwargs):
description = dataset.description.replace('\n', '').replace('\r', '')
description = dataset.description
if not description:
description = 'useful for when you want to answer queries about the ' + dataset.name
description = description.replace('\n', '').replace('\r', '')
description += '\nID of dataset MUST be ' + dataset.id
return cls(
tenant_id=dataset.tenant_id,