Skip to content

Commit cf637a8

Browse files
fix: Fix the wrong result of not_contain_compare when source_value is a list (#5152)
* perf: system prompt double-generating * fix: Fix some minor problem * fix * 小调整。 * 文件处理,使用 with ... as file 语法,避免文件未关闭。 * 修正错误字符串 * fix bugs: invalid regex escape sequences, and resource leaks * fix bugs: invalid regex escape sequences, and resource leaks * 撤回对正则的修正。 * operation * 小调整 * 小调整 * 小调整 * revert * revert * 小调整。 * 小调整。 * 小调整. * revert * fix: Fix `not_contain` compare * fix style * revert * revert
1 parent 90fd184 commit cf637a8

10 files changed

Lines changed: 14 additions & 12 deletions

File tree

apps/application/chat_pipeline/step/chat_step/impl/base_chat_step.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,7 @@ def execute(self, message_list: List[BaseMessage],
185185
mcp_output_enable=True,
186186
**kwargs):
187187
chat_model = get_model_instance_by_model_workspace_id(model_id, workspace_id,
188-
**(
189-
model_params_setting or {})) if model_id is not None else None
188+
**(model_params_setting or {})) if model_id is not None else None
190189
if stream:
191190
return self.execute_stream(message_list, chat_id, problem_text, post_response_handler, chat_model,
192191
paragraph_list,

apps/application/flow/compare/not_contain_compare.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def support(self, node_id, fields: List[str], source_value, compare, target_valu
2020
def compare(self, source_value, compare, target_value):
2121
if isinstance(source_value, str):
2222
return str(target_value) not in source_value
23-
elif isinstance(self, list):
23+
elif isinstance(source_value, list):
2424
return not any([str(item) == str(target_value) for item in source_value])
2525
else:
2626
return str(target_value) not in str(source_value)

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@ def convert_value(name: str, value, _type, is_required, source, node):
110110
if _type == 'int':
111111
return int(value)
112112
if _type == 'boolean':
113-
value = 0 if ['0', '[]'].__contains__(value) else value
113+
if isinstance(value, str) and value.lower() in ('false', '0', '[]', ''):
114+
return False
114115
return bool(value)
115116
if _type == 'float':
116117
return float(value)

apps/application/flow/step_node/tool_node/impl/base_tool_node.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ def convert_value(name: str, value, _type, is_required, source, node):
8585
if _type == 'int':
8686
return int(value)
8787
if _type == 'boolean':
88-
value = 0 if ['0', '[]'].__contains__(value) else value
88+
if isinstance(value, str) and value.lower() in ('false', '0', '[]', ''):
89+
return False
8990
return bool(value)
9091
if _type == 'float':
9192
return float(value)

apps/knowledge/views/paragraph.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ def get(self, request: Request, workspace_id: str, knowledge_id: str, document_i
6464
@log(
6565
menu='Paragraph', operate='Create Paragraph',
6666
get_operation_object=lambda r, keywords: get_knowledge_document_operation_object(
67-
get_knowledge_operation_object(keywords.get('knowledge_id')),
6867
get_knowledge_operation_object(keywords.get('knowledge_id')),
6968
get_document_operation_object(keywords.get('document_id'))
7069
),

apps/tools/serializers/tool.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,8 @@ def convert_value(name: str, value: str, _type: str, is_required: bool):
536536
if _type == 'int':
537537
return int(value)
538538
if _type == 'boolean':
539-
value = 0 if ['0', '[]'].__contains__(value) else value
539+
if isinstance(value, str) and value.lower() in ('false', '0', '[]', ''):
540+
return False
540541
return bool(value)
541542
if _type == 'float':
542543
return float(value)

apps/trigger/handler/impl/task/tool_task/base_tool_task.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ def _convert_value(_type, value):
5050
if _type == 'int':
5151
return int(value)
5252
if _type == 'boolean':
53-
value = 0 if ['0', '[]'].__contains__(value) else value
53+
if isinstance(value, str) and value.lower() in ('false', '0', '[]', ''):
54+
return False
5455
return bool(value)
5556
if _type == 'float':
5657
return float(value)

apps/trigger/handler/impl/task/tool_task/workflow_tool_task.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ def _convert_value(_type, value):
5252
if _type == 'int':
5353
return int(value)
5454
if _type == 'boolean':
55-
value = 0 if ['0', '[]'].__contains__(value) else value
55+
if isinstance(value, str) and value.lower() in ('false', '0', '[]', ''):
56+
return False
5657
return bool(value)
5758
if _type == 'float':
5859
return float(value)

apps/trigger/handler/impl/trigger/scheduled_trigger.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,11 +243,11 @@ def execute(trigger, **kwargs):
243243
if source_type == "APPLICATION":
244244
from trigger.handler.impl.task.application_task import ApplicationTask
245245

246-
ApplicationTask.execute(trigger_task, **kwargs)
246+
ApplicationTask().execute(trigger_task, **kwargs)
247247
elif source_type == "TOOL":
248248
from trigger.handler.impl.task.tool_task import ToolTask
249249

250-
ToolTask.execute(trigger_task, **kwargs)
250+
ToolTask().execute(trigger_task, **kwargs)
251251
else:
252252
maxkb_logger.warning(f"unsupported source_type={source_type}, task_id={trigger_task['id']}")
253253

ui/src/workflow/common/NodeSearch.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,6 @@ const handleSearch = (kw: string) => {
217217
}
218218
}
219219
const reSearch = () => {
220-
console.log('ss')
221220
handleSearch(searchText.value)
222221
}
223222
// 生命周期

0 commit comments

Comments
 (0)