File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 1111from django .contrib .postgres .fields import ArrayField
1212from django .db import models
1313from langchain .schema import HumanMessage , AIMessage
14-
14+ from django . utils . translation import gettext as _
1515from common .encoder .encoder import SystemEncoder
1616from common .mixins .app_model_mixin import AppModelMixin
1717from dataset .models .data_set import DataSet
@@ -167,7 +167,11 @@ def get_human_message(self):
167167 return HumanMessage (content = self .problem_text )
168168
169169 def get_ai_message (self ):
170- return AIMessage (content = self .answer_text )
170+ answer_text = self .answer_text
171+ if answer_text is None or len (str (answer_text ).strip ()) == 0 :
172+ answer_text = _ (
173+ 'Sorry, no relevant content was found. Please re-describe your problem or provide more information. ' )
174+ return AIMessage (content = answer_text )
171175
172176 def get_node_details_runtime_node_id (self , runtime_node_id ):
173177 return self .details .get (runtime_node_id , None )
You can’t perform that action at this time.
0 commit comments