mirror of
https://gitee.com/dify_ai/dify.git
synced 2024-11-30 02:08:37 +08:00
fix: dataset and moderation. (#2042)
This commit is contained in:
parent
7b0818b8e5
commit
83105d0d8f
@ -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,
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user