feat(skills-manager): add openwebui_id and fix tool type sync bug
This commit is contained in:
@@ -4,6 +4,7 @@ author: Fu-Jie
|
|||||||
author_url: https://github.com/Fu-Jie/openwebui-extensions
|
author_url: https://github.com/Fu-Jie/openwebui-extensions
|
||||||
funding_url: https://github.com/open-webui
|
funding_url: https://github.com/open-webui
|
||||||
version: 0.2.0
|
version: 0.2.0
|
||||||
|
openwebui_id: b4bce8e4-08e7-4f90-bea7-dc31d463a0bb
|
||||||
requirements:
|
requirements:
|
||||||
description: Standalone OpenWebUI tool for managing native Workspace Skills (list/show/install/create/update/delete) for any model.
|
description: Standalone OpenWebUI tool for managing native Workspace Skills (list/show/install/create/update/delete) for any model.
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -299,8 +299,10 @@ class OpenWebUICommunityClient:
|
|||||||
if not post_data:
|
if not post_data:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# 严格重建 data 结构,避免包含只读字段(如 data.function.id)
|
# 获取当前帖子的类型和数据结构
|
||||||
current_function = post_data.get("data", {}).get("function", {})
|
post_type = post_data.get("type", "function")
|
||||||
|
data_key = post_type if post_type in post_data.get("data", {}) else "function"
|
||||||
|
current_data = post_data.get("data", {}).get(data_key, {})
|
||||||
|
|
||||||
# 过滤 metadata,移除 openwebui_id 等系统字段
|
# 过滤 metadata,移除 openwebui_id 等系统字段
|
||||||
clean_metadata = {
|
clean_metadata = {
|
||||||
@@ -309,22 +311,23 @@ class OpenWebUICommunityClient:
|
|||||||
if k not in ["openwebui_id", "post_id"]
|
if k not in ["openwebui_id", "post_id"]
|
||||||
}
|
}
|
||||||
|
|
||||||
function_data = {
|
# 重建插件数据结构
|
||||||
"id": current_function.get("id", ""),
|
plugin_data = {
|
||||||
"name": metadata.get("title", current_function.get("name", "Plugin")),
|
"id": current_data.get("id", ""),
|
||||||
"type": current_function.get("type", "action"),
|
"name": metadata.get("title", current_data.get("name", "Plugin")),
|
||||||
|
"type": current_data.get("type", "action"),
|
||||||
"content": source_code,
|
"content": source_code,
|
||||||
"meta": {
|
"meta": {
|
||||||
"description": metadata.get(
|
"description": metadata.get(
|
||||||
"description",
|
"description",
|
||||||
current_function.get("meta", {}).get("description", ""),
|
current_data.get("meta", {}).get("description", ""),
|
||||||
),
|
),
|
||||||
"manifest": clean_metadata,
|
"manifest": clean_metadata,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
post_data["data"] = {"function": function_data}
|
post_data["data"] = {data_key: plugin_data}
|
||||||
post_data["type"] = "function"
|
post_data["type"] = post_type
|
||||||
|
|
||||||
# 更新 README(社区页面展示内容)
|
# 更新 README(社区页面展示内容)
|
||||||
if readme_content:
|
if readme_content:
|
||||||
|
|||||||
Reference in New Issue
Block a user