fix: refactor all 'or []' and 'or {}' logic to make code more clear (#10883)

Signed-off-by: yihong0618 <zouzou0208@gmail.com>
This commit is contained in:
yihong
2024-11-21 10:34:43 +08:00
committed by GitHub
parent ec9f6220c9
commit 0067b16d1e
11 changed files with 20 additions and 26 deletions

View File

@ -341,7 +341,7 @@ class AppService:
if not app_model_config:
return meta
agent_config = app_model_config.agent_mode_dict or {}
agent_config = app_model_config.agent_mode_dict
# get all tools
tools = agent_config.get("tools", [])

View File

@ -242,7 +242,7 @@ class ToolTransformService:
# get tool parameters
parameters = tool.parameters or []
# get tool runtime parameters
runtime_parameters = tool.get_runtime_parameters() or []
runtime_parameters = tool.get_runtime_parameters()
# override parameters
current_parameters = parameters.copy()
for runtime_parameter in runtime_parameters:

View File

@ -51,8 +51,8 @@ class WebsiteService:
excludes = options.get("excludes").split(",") if options.get("excludes") else []
params = {
"crawlerOptions": {
"includes": includes or [],
"excludes": excludes or [],
"includes": includes,
"excludes": excludes,
"generateImgAltText": True,
"limit": options.get("limit", 1),
"returnOnlyUrls": False,