fix: dataset and moderation. (#2042)

This commit is contained in:
Garfield Dai 2024-01-15 21:53:31 +08:00 committed by GitHub
parent 7b0818b8e5
commit 83105d0d8f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -146,7 +146,7 @@ class BasicApplicationRunner(AppRunner):
# get context from datasets
context = None
if app_orchestration_config.dataset:
if app_orchestration_config.dataset and app_orchestration_config.dataset.dataset_ids:
context = self.retrieve_dataset_context(
tenant_id=app_record.tenant_id,
app_record=app_record,

View File

@ -30,7 +30,7 @@ class KeywordsModeration(Moderation):
if query:
inputs['query__'] = query
keywords_list = self.config['keywords'].split('\n')
keywords_list = [keyword for keyword in self.config['keywords'].split('\n') if keyword]
flagged = self._is_violated(inputs, keywords_list)
return ModerationInputsResult(flagged=flagged, action=ModerationAction.DIRECT_OUTPUT, preset_response=preset_response)