@@ -72,7 +72,7 @@ def get_file_type(filename: str):
7272 return filename [last_dot_idx + 1 :]
7373
7474 @staticmethod
75- def get_file_object (block : FileBlock ):
75+ def get_file_object (block : FileBlock ) -> Dict [ str , Any ] :
7676 return {
7777 "type" : ModelConversion .get_file_type (block .filename ),
7878 "data" : str (base64 .b64encode (block .contents )),
@@ -98,14 +98,16 @@ def append_to_structured_data_tool_calls(tool_calls: List[ToolCallResult], struc
9898
9999 @staticmethod
100100 def add_ai_chat_data (structured_data : List [Dict ], block : HolmesChatResultsBlock ):
101+ if not block .holmes_result :
102+ return
101103 structured_data .append (
102104 {
103105 "type" : "markdown" ,
104106 "metadata" : {"type" : "ai_investigation_result" , "createdAt" : datetime_to_db_str (datetime .now ())},
105- "data" : Transformer .to_github_markdown (block .holmes_result .analysis ),
107+ "data" : Transformer .to_github_markdown (block .holmes_result .analysis or "" ),
106108 }
107109 )
108- ModelConversion .append_to_structured_data_tool_calls (block .holmes_result .tool_calls , structured_data )
110+ ModelConversion .append_to_structured_data_tool_calls (block .holmes_result .tool_calls or [] , structured_data )
109111
110112 conversation_history_block = FileBlock (
111113 f"conversation_history-{ datetime .now ()} .txt" ,
@@ -116,6 +118,13 @@ def add_ai_chat_data(structured_data: List[Dict], block: HolmesChatResultsBlock)
116118 conversation_history_obj ["metadata" ] = {"type" : "conversation_history" }
117119 structured_data .append (conversation_history_obj )
118120
121+ if block .holmes_result and block .holmes_result .follow_up_actions and len (block .holmes_result .follow_up_actions ) > 0 :
122+ structured_data .append ({
123+ "type" : "structured_data" ,
124+ "metadata" : {"type" : "follow_up_actions" },
125+ "data" : block .holmes_result .follow_up_actions ,
126+ })
127+
119128 @staticmethod
120129 def add_ai_analysis_data (structured_data : List [Dict ], block : HolmesResultsBlock ):
121130 if not block .holmes_result :
0 commit comments