Skip to content

Commit 3e3590a

Browse files
wangliang181230liuruibin
authored andcommitted
fix: enhance error logging and improve file handling in application components
1 parent 5f148ba commit 3e3590a

4 files changed

Lines changed: 6 additions & 3 deletions

File tree

apps/application/flow/step_node/application_node/impl/base_application_node.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from application.flow.common import Answer
99
from application.flow.i_step_node import NodeResult, INode
1010
from application.flow.step_node.application_node.i_application_node import IApplicationNode
11+
from common.utils.logger import maxkb_logger
1112
from application.models import Chat, ChatSourceChoices
1213

1314

@@ -141,7 +142,7 @@ def reset_application_node_dict(application_node_dict, runtime_node_id, node_dat
141142
'${value}', content)
142143
application_node['content'] = res.replace('${value}', value)
143144
except Exception as e:
144-
pass
145+
maxkb_logger.warning(f'reset_application_node_dict error: {e}', exc_info=True)
145146

146147

147148
class BaseApplicationNode(IApplicationNode):

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/models_provider/impl/local_model_provider/model/embedding/web.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def embed_documents(self, texts: List[str]) -> List[List[float]]:
4646
bind = f'{CONFIG.get("LOCAL_MODEL_HOST")}:{CONFIG.get("LOCAL_MODEL_PORT")}'
4747
prefix = CONFIG.get_admin_path()
4848
res = requests.post(
49-
f'{CONFIG.get("LOCAL_MODEL_PROTOCOL")}://{bind}/{prefix}/api/model/{self.model_id}/embed_documents',
49+
f'{CONFIG.get("LOCAL_MODEL_PROTOCOL")}://{bind}{prefix}/api/model/{self.model_id}/embed_documents',
5050
{'texts': texts})
5151
result = res.json()
5252
if result.get('code', 500) == 200:

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)