Skip to content

Commit b857412

Browse files
fix: Fix not_contain compare
1 parent 915d03e commit b857412

15 files changed

Lines changed: 22 additions & 13 deletions

File tree

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/application_node/impl/base_application_node.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ def reset_application_node_dict(application_node_dict, runtime_node_id, node_dat
141141
'${value}', content)
142142
application_node['content'] = res.replace('${value}', value)
143143
except Exception as e:
144-
pass
144+
maxkb_logger.warning(f'reset_application_node_dict error: {e}', exc_info=True)
145145

146146

147147
class BaseApplicationNode(IApplicationNode):

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/common/handle/impl/text/pdf_split_handle.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,3 +343,5 @@ def get_content(self, file, save_image):
343343
finally:
344344
if pdf_document is not None:
345345
pdf_document.close()
346+
# 处理完后可以删除临时文件
347+
os.remove(temp_file_path)

apps/common/utils/tool_code.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def init_sandbox_dir():
7373
local_ip = socket.gethostbyname(hostname)
7474
banned_hosts = f"{banned_hosts},{local_ip}"
7575
banned_hosts = ",".join(s.strip() for s in banned_hosts.split(",") if s.strip() and s.strip().lower() != hostname.lower())
76-
with open(sandbox_conf_file_path, "w") as f:
76+
with open(sandbox_conf_file_path, "w", encoding='utf-8') as f:
7777
f.write(f"SANDBOX_PYTHON_BANNED_HOSTS={banned_hosts}\n")
7878
f.write(f"SANDBOX_PYTHON_ALLOW_DL_PATHS={','.join(sorted(set(filter(None, sys.path + _sandbox_python_sys_path + allow_dl_paths.split(',')))))}\n")
7979
f.write(f"SANDBOX_PYTHON_ALLOW_DL_OPEN={allow_dl_open}\n")

apps/knowledge/serializers/paragraph.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ def edit(self, instance: Dict):
226226
return self.one(), instance, self.data.get('knowledge_id')
227227

228228
def get_problem_list(self):
229+
ProblemParagraphMapping(ProblemParagraphMapping)
229230
problem_paragraph_mapping = QuerySet(ProblemParagraphMapping).filter(
230231
paragraph_id=self.data.get("paragraph_id"))
231232
if len(problem_paragraph_mapping) > 0:

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/application_task.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ def valid_value_type(value, _type):
5151
return isinstance(value, int)
5252
if _type == 'boolean':
5353
return isinstance(value, bool)
54+
if _type == 'any':
55+
return True
5456
return isinstance(value, str)
5557

5658

0 commit comments

Comments
 (0)