77package modelengine .fit .jober .aipp .fitable ;
88
99import static modelengine .fit .jade .aipp .prompt .constant .Constant .PROMPT_METADATA_KEY ;
10+ import static modelengine .fit .jober .aipp .constants .AippConst .INST_STATUS_KEY ;
1011import static modelengine .fitframework .inspection .Validation .notNull ;
1112
1213import modelengine .fel .core .chat .ChatMessage ;
2324import modelengine .fel .tool .mcp .client .McpClientFactory ;
2425import modelengine .fel .tool .mcp .entity .Tool ;
2526import modelengine .fel .tool .model .transfer .ToolData ;
27+ import modelengine .fit .jober .aipp .enums .MetaInstStatusEnum ;
2628import modelengine .fit .jober .aipp .util .McpUtils ;
2729import modelengine .fitframework .inspection .Validation ;
2830import modelengine .jade .store .service .ToolService ;
@@ -279,7 +281,9 @@ private void addAnswer(AippLlmMeta llmMeta, String answer, Map<String, Object> p
279281
280282 // 如果节点配置为输出到聊天,模型回复内容需要持久化
281283 boolean enableLog = checkEnableLog (businessData );
282- if (enableLog ) {
284+ AppTaskInstance instance =
285+ this .appTaskInstanceService .getInstance (llmMeta .getVersionId (), llmMeta .getInstId (), null ).orElse (null );
286+ if (enableLog && ! this .isTerminated (instance )) {
283287 Map <String , Object > llmOutput = new HashMap <>();
284288 llmOutput .put ("output" , output );
285289 Optional <ResponsibilityResult > formatOutput = this .formatterChain .handle (llmOutput );
@@ -299,6 +303,15 @@ private void addAnswer(AippLlmMeta llmMeta, String answer, Map<String, Object> p
299303 doOnAgentComplete (llmMeta );
300304 }
301305
306+ private boolean isTerminated (AppTaskInstance instance ) {
307+ if (instance == null ) {
308+ return false ;
309+ }
310+ Map <String , Object > infos = instance .getEntity ().getInfos ();
311+ return infos != null && StringUtils .equals (ObjectUtils .cast (infos .get (INST_STATUS_KEY )),
312+ MetaInstStatusEnum .TERMINATED .name ());
313+ }
314+
302315 /**
303316 * llm节点处理结束回调函数。
304317 * <ul>
0 commit comments