| 149 | |
| 150 | |
| 151 | class ToolWorkflowPostHandler(WorkFlowPostHandler): |
| 152 | def __init__(self, chat_info, tool_id): |
| 153 | super().__init__(chat_info) |
| 154 | self.tool_id = tool_id |
| 155 | |
| 156 | def handler(self, workflow): |
| 157 | state = get_tool_workflow_state(workflow) |
| 158 | record = ToolRecord(id=self.chat_info.tool_record_id, tool_id=self.tool_id, |
| 159 | workspace_id=self.chat_info.workspace_id, |
| 160 | source_type=self.chat_info.source_type, |
| 161 | source_id=self.chat_info.source_id, |
| 162 | state=state, |
| 163 | run_time=time.time() - workflow.context.get('start_time') if workflow.context.get( |
| 164 | 'start_time') is not None else 0, |
| 165 | meta={ |
| 166 | 'input_field_list': workflow.get_input_field_list(), |
| 167 | 'output_field_list': workflow.get_output_field_list(), |
| 168 | 'input': workflow.get_input(), |
| 169 | 'output': workflow.out_context, |
| 170 | 'details': workflow.get_runtime_details(), |
| 171 | 'answer_text_list': workflow.get_answer_text_list() |
| 172 | }) |
| 173 | self.chat_info.set_record(record) |
| 174 | self.chat_info = None |
| 175 | self.tool_id = None |
| 176 | |
| 177 | |
| 178 | def get_loop_workflow_node(node_list): |
no outgoing calls
no test coverage detected