@@ -105,7 +105,7 @@ def execute(self, model_id, prompt_template, dialogue_number, history_chat_recor
105105 'history_message' : history_message ,
106106 'user_input' : user_input ,
107107 'branch_id' : matched_branch ['id' ],
108- 'reason' : self .parse_result_reason (r .content ) if output_reason is True else '' ,
108+ 'reason' : self .parse_result_reason (r .content ) if output_reason is not False else '' ,
109109 'category' : matched_branch .get ('content' , matched_branch ['id' ])
110110 }, {}, _write_context = write_context )
111111
@@ -135,7 +135,7 @@ def get_history_message(history_chat_record, dialogue_number):
135135 message .content = re .sub ('<form_rander>[\d\D]*?<\/form_rander>' , '' , message .content )
136136 return history_message
137137
138- def build_classification_prompt (self , prompt_template : str , user_input : str , branch : List [Dict ], reason_field : bool ) -> str :
138+ def build_classification_prompt (self , prompt_template : str , user_input : str , branch : List [Dict ], output_reason : bool ) -> str :
139139 """构建分类提示词"""
140140
141141 classification_list = []
@@ -158,7 +158,7 @@ def build_classification_prompt(self, prompt_template: str, user_input: str, bra
158158 classification_id += 1
159159
160160 # 构建输出JSON结构
161- reason_field = ',\n "reason": ""' if reason_field is True else ''
161+ reason_field = ',\n "reason": ""' if output_reason is not False else ''
162162 output_json = f'{{\n "classificationId": 0{ reason_field } \n }}'
163163
164164 return (prompt_template or DEFAULT_PROMPT_TEMPLATE ).format (
0 commit comments