feat: 补充 Local Tool API 端点缺失的字段

- 在 create_local_tool 中添加 category, version, icon, color 字段支持
- 在 update_local_tool 中添加只读字段保护(team, name)
- 在 get_local_tool_list 和 get_my_local_tool_list 中补充 category, version, icon, color 字段
- 在 get_local_tool 详情接口中补充所有缺失字段

确保 Local Tool API 端点支持完整的字段操作
This commit is contained in:
jingrow 2025-11-21 20:34:27 +08:00
parent e5c818d1a5
commit 56fcb67377
6 changed files with 63 additions and 14 deletions

View File

@ -243,9 +243,9 @@ def get_local_tool_list(filters=None, order_by=None, limit_start=None, limit_pag
"Local Tool", "Local Tool",
filters=query_filters, filters=query_filters,
fields=[ fields=[
"name", "tool_name", "title", "subtitle", "name", "tool_name", "title", "subtitle", "category", "version",
"enabled", "public", "team", "status", "repository_url", "enabled", "public", "team", "status", "repository_url",
"file_url", "tool_image", "creation", "modified" "file_url", "icon", "color", "tool_image", "creation", "modified"
], ],
order_by=order_by, order_by=order_by,
limit_start=limit_start, limit_start=limit_start,
@ -263,12 +263,16 @@ def get_local_tool_list(filters=None, order_by=None, limit_start=None, limit_pag
"tool_name": tool.tool_name, "tool_name": tool.tool_name,
"title": tool.title, "title": tool.title,
"subtitle": tool.subtitle, "subtitle": tool.subtitle,
"category": tool.category,
"version": tool.version,
"enabled": tool.enabled, "enabled": tool.enabled,
"public": tool.public, "public": tool.public,
"team": team_user_names.get(tool.team), "team": team_user_names.get(tool.team),
"status": tool.status, "status": tool.status,
"repository_url": tool.repository_url, "repository_url": tool.repository_url,
"file_url": tool.file_url, "file_url": tool.file_url,
"icon": tool.icon,
"color": tool.color,
"tool_image": tool.tool_image, "tool_image": tool.tool_image,
"creation": tool.creation, "creation": tool.creation,
"modified": tool.modified "modified": tool.modified
@ -721,9 +725,9 @@ def get_my_local_tool_list(filters=None, order_by=None, limit_start=None, limit_
"Local Tool", "Local Tool",
filters=query_filters, filters=query_filters,
fields=[ fields=[
"name", "tool_name", "title", "subtitle", "name", "tool_name", "title", "subtitle", "category", "version",
"enabled", "public", "team", "status", "repository_url", "enabled", "public", "team", "status", "repository_url",
"file_url", "tool_image", "creation", "modified" "file_url", "icon", "color", "tool_image", "creation", "modified"
], ],
order_by=order_by, order_by=order_by,
limit_start=limit_start, limit_start=limit_start,
@ -741,12 +745,16 @@ def get_my_local_tool_list(filters=None, order_by=None, limit_start=None, limit_
"tool_name": tool.tool_name, "tool_name": tool.tool_name,
"title": tool.title, "title": tool.title,
"subtitle": tool.subtitle, "subtitle": tool.subtitle,
"category": tool.category,
"version": tool.version,
"enabled": tool.enabled, "enabled": tool.enabled,
"public": tool.public, "public": tool.public,
"team": team_user_names.get(tool.team), "team": team_user_names.get(tool.team),
"status": tool.status, "status": tool.status,
"repository_url": tool.repository_url, "repository_url": tool.repository_url,
"file_url": tool.file_url, "file_url": tool.file_url,
"icon": tool.icon,
"color": tool.color,
"tool_image": tool.tool_image, "tool_image": tool.tool_image,
"creation": tool.creation, "creation": tool.creation,
"modified": tool.modified "modified": tool.modified
@ -807,6 +815,10 @@ def get_local_tool(name):
"title": tool.title, "title": tool.title,
"subtitle": tool.subtitle, "subtitle": tool.subtitle,
"description": tool.description, "description": tool.description,
"category": tool.category,
"version": tool.version,
"icon": tool.icon,
"color": tool.color,
"enabled": tool.enabled, "enabled": tool.enabled,
"public": tool.public, "public": tool.public,
"team": team_user_names.get(tool.team), "team": team_user_names.get(tool.team),
@ -876,6 +888,10 @@ def create_local_tool(tool_data):
"title": tool_data["title"], "title": tool_data["title"],
"subtitle": tool_data.get("subtitle", ""), "subtitle": tool_data.get("subtitle", ""),
"description": tool_data.get("description", ""), "description": tool_data.get("description", ""),
"category": tool_data.get("category"),
"version": tool_data.get("version"),
"icon": tool_data.get("icon"),
"color": tool_data.get("color"),
"team": team, "team": team,
"repository_url": tool_data.get("repository_url"), "repository_url": tool_data.get("repository_url"),
"file_url": tool_data.get("file_url"), "file_url": tool_data.get("file_url"),

View File

@ -30,7 +30,7 @@
"read_only": 1 "read_only": 1
}, },
{ {
"default": "0", "default": "1",
"fieldname": "public", "fieldname": "public",
"fieldtype": "Check", "fieldtype": "Check",
"label": "Public" "label": "Public"
@ -69,9 +69,11 @@
"fieldtype": "Data", "fieldtype": "Data",
"in_list_view": 1, "in_list_view": 1,
"label": "Title", "label": "Title",
"reqd": 1 "reqd": 1,
"search_index": 1
}, },
{ {
"default": "Published",
"fieldname": "status", "fieldname": "status",
"fieldtype": "Select", "fieldtype": "Select",
"label": "Status", "label": "Status",
@ -108,7 +110,7 @@
} }
], ],
"links": [], "links": [],
"modified": "2025-11-03 04:01:44.111717", "modified": "2025-11-21 18:53:14.977048",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Jcloud", "module": "Jcloud",
"name": "Local Agent", "name": "Local Agent",

View File

@ -83,7 +83,8 @@
"fieldtype": "Data", "fieldtype": "Data",
"in_list_view": 1, "in_list_view": 1,
"label": "Title", "label": "Title",
"reqd": 1 "reqd": 1,
"search_index": 1
}, },
{ {
"fieldname": "app_name", "fieldname": "app_name",
@ -107,7 +108,7 @@
} }
], ],
"links": [], "links": [],
"modified": "2025-11-02 22:55:33.457151", "modified": "2025-11-21 18:52:39.660644",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Jcloud", "module": "Jcloud",
"name": "Local App", "name": "Local App",

View File

@ -30,7 +30,7 @@
"read_only": 1 "read_only": 1
}, },
{ {
"default": "0", "default": "1",
"fieldname": "public", "fieldname": "public",
"fieldtype": "Check", "fieldtype": "Check",
"label": "Public" "label": "Public"
@ -69,9 +69,11 @@
"fieldtype": "Data", "fieldtype": "Data",
"in_list_view": 1, "in_list_view": 1,
"label": "Title", "label": "Title",
"reqd": 1 "reqd": 1,
"search_index": 1
}, },
{ {
"default": "Published",
"fieldname": "status", "fieldname": "status",
"fieldtype": "Select", "fieldtype": "Select",
"label": "Status", "label": "Status",
@ -98,7 +100,7 @@
} }
], ],
"links": [], "links": [],
"modified": "2025-11-02 23:06:55.789746", "modified": "2025-11-21 18:53:30.635980",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Jcloud", "module": "Jcloud",
"name": "Local Node", "name": "Local Node",

View File

@ -8,6 +8,8 @@
"tool_name", "tool_name",
"title", "title",
"subtitle", "subtitle",
"category",
"version",
"public", "public",
"enabled", "enabled",
"column_break_5", "column_break_5",
@ -15,6 +17,8 @@
"file_url", "file_url",
"repository_url", "repository_url",
"team", "team",
"icon",
"color",
"tool_image", "tool_image",
"section_break_otbv", "section_break_otbv",
"description" "description"
@ -69,7 +73,8 @@
"fieldtype": "Data", "fieldtype": "Data",
"in_list_view": 1, "in_list_view": 1,
"label": "Title", "label": "Title",
"reqd": 1 "reqd": 1,
"search_index": 1
}, },
{ {
"fieldname": "status", "fieldname": "status",
@ -95,10 +100,30 @@
"fieldname": "tool_image", "fieldname": "tool_image",
"fieldtype": "Attach Image", "fieldtype": "Attach Image",
"label": "Tool Image" "label": "Tool Image"
},
{
"fieldname": "version",
"fieldtype": "Data",
"label": "Version"
},
{
"fieldname": "icon",
"fieldtype": "Icon",
"label": "Icon"
},
{
"fieldname": "color",
"fieldtype": "Color",
"label": "Color"
},
{
"fieldname": "category",
"fieldtype": "Data",
"label": "Category"
} }
], ],
"links": [], "links": [],
"modified": "2025-11-21 11:26:56.096514", "modified": "2025-11-21 18:53:02.875551",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Jcloud", "module": "Jcloud",
"name": "Local Tool", "name": "Local Tool",

View File

@ -14,6 +14,8 @@ class LocalTool(Page):
if TYPE_CHECKING: if TYPE_CHECKING:
from jingrow.types import DF from jingrow.types import DF
category: DF.Data | None
color: DF.Color | None
enabled: DF.Check enabled: DF.Check
file_url: DF.Data | None file_url: DF.Data | None
public: DF.Check public: DF.Check
@ -24,5 +26,6 @@ class LocalTool(Page):
title: DF.Data title: DF.Data
tool_image: DF.AttachImage | None tool_image: DF.AttachImage | None
tool_name: DF.Data tool_name: DF.Data
version: DF.Data | None
# end: auto-generated types # end: auto-generated types
pass pass