mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-07-21 11:56:09 +00:00
refactor(ContentFilterStage): Add logic for handling empty messages (#1525)
-In the ContentFilterStage, logic for handling empty messages has been added to ensure that the pipeline continues to process even when the message is empty. - This change enhances the robustness of content filtering, preventing potential issues caused by empty messages. - This optimization was implemented to address the issue where, when someone is @ in a group chat and a message is sent without any content, the Source type messages in the message chain are lost.
This commit is contained in:
@@ -66,6 +66,8 @@ class ContentFilterStage(stage.PipelineStage):
|
|||||||
|
|
||||||
if query.pipeline_config['safety']['content-filter']['scope'] == 'output-msg':
|
if query.pipeline_config['safety']['content-filter']['scope'] == 'output-msg':
|
||||||
return entities.StageProcessResult(result_type=entities.ResultType.CONTINUE, new_query=query)
|
return entities.StageProcessResult(result_type=entities.ResultType.CONTINUE, new_query=query)
|
||||||
|
if not message.strip():
|
||||||
|
return entities.StageProcessResult(result_type=entities.ResultType.CONTINUE, new_query=query)
|
||||||
else:
|
else:
|
||||||
for filter in self.filter_chain:
|
for filter in self.filter_chain:
|
||||||
if filter_entities.EnableStage.PRE in filter.enable_stages:
|
if filter_entities.EnableStage.PRE in filter.enable_stages:
|
||||||
|
|||||||
Reference in New Issue
Block a user