Skip to content

Commit 5e3d595

Browse files
当不输出理由时,无需解析理由
1 parent 2f5c472 commit 5e3d595

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

apps/application/flow/step_node/intent_node/impl/base_intent_node.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def execute(self, model_id, prompt_template, dialogue_number, history_chat_recor
9797
'history_message': history_message,
9898
'user_input': user_input,
9999
'branch_id': matched_branch['id'],
100-
'reason': self.parse_result_reason(r.content),
100+
'reason': self.parse_result_reason(r.content) if output_reason is True else '',
101101
'category': matched_branch.get('content', matched_branch['id'])
102102
}, {}, _write_context=write_context)
103103

@@ -154,8 +154,8 @@ def build_classification_prompt(self, prompt_template: str, user_input: str, bra
154154
classification_id += 1
155155

156156
# 构建输出JSON结构
157-
output_reason = ',\n "reason": ""' if output_reason is True else ''
158-
output_json = f'{{\n "classificationId": 0{output_reason}\n}}'
157+
output_reason = ', "reason": ""' if output_reason is True else ''
158+
output_json = f'{{"classificationId": 0{output_reason}}}'
159159

160160
return (prompt_template or DEFAULT_PROMPT_TEMPLATE).format(
161161
classification_list=json.dumps(classification_list, ensure_ascii=False),

0 commit comments

Comments
 (0)