Skip to content

Commit 20f22fb

Browse files
committed
fix: update state assignment to use enum values directly in ToolRecord updates
1 parent 910c498 commit 20f22fb

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

apps/application/flow/step_node/tool_lib_node/impl/base_tool_lib_node.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
from common.utils.logger import maxkb_logger
2828
from common.utils.rsa_util import rsa_long_decrypt
2929
from common.utils.tool_code import ToolExecutor
30-
from knowledge.models import FileSourceType, State
30+
from knowledge.models import FileSourceType
31+
from knowledge.models.knowledge_action import State
3132
from oss.serializers.file import FileSerializer
3233
from tools.models import Tool, ToolRecord, ToolTaskTypeChoices
3334

@@ -265,16 +266,18 @@ def tool_exec_record(self, tool_lib, all_params):
265266
result = function_executor.exec_code(tool_lib.code, all_params)
266267
result_dict = _get_result_detail(result)
267268
QuerySet(ToolRecord).filter(id=task_record_id).update(
268-
state=State.SUCCESS.value,
269+
state=State.SUCCESS,
269270
run_time=time.time() - start_time,
270271
meta={'input': all_params, 'output': result_dict}
271272
)
272273

274+
print(result)
275+
273276
return result
274277
except Exception as e:
275278
maxkb_logger.error(f"Tool execution error: {traceback.format_exc()}")
276279
QuerySet(ToolRecord).filter(id=task_record_id).update(
277-
state=State.FAILURE.value,
280+
state=State.FAILURE,
278281
run_time=time.time() - start_time,
279282
meta={'input': all_params, 'output': 'Error: ' + str(e)}
280283
)

0 commit comments

Comments
 (0)