From 07bc5f027e7ce10a1df17369461067da91e3bb29 Mon Sep 17 00:00:00 2001 From: fujie Date: Sat, 28 Feb 2026 16:14:38 +0800 Subject: [PATCH] feat(skills-manager): add openwebui_id and fix tool type sync bug --- .../openwebui_skills_manager.py | 1 + scripts/openwebui_community_client.py | 21 +++++++++++-------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/plugins/tools/openwebui-skills-manager/openwebui_skills_manager.py b/plugins/tools/openwebui-skills-manager/openwebui_skills_manager.py index 33440aa..eef5ed2 100644 --- a/plugins/tools/openwebui-skills-manager/openwebui_skills_manager.py +++ b/plugins/tools/openwebui-skills-manager/openwebui_skills_manager.py @@ -4,6 +4,7 @@ author: Fu-Jie author_url: https://github.com/Fu-Jie/openwebui-extensions funding_url: https://github.com/open-webui version: 0.2.0 +openwebui_id: b4bce8e4-08e7-4f90-bea7-dc31d463a0bb requirements: description: Standalone OpenWebUI tool for managing native Workspace Skills (list/show/install/create/update/delete) for any model. """ diff --git a/scripts/openwebui_community_client.py b/scripts/openwebui_community_client.py index 0f34b8e..a516bf3 100644 --- a/scripts/openwebui_community_client.py +++ b/scripts/openwebui_community_client.py @@ -299,8 +299,10 @@ class OpenWebUICommunityClient: if not post_data: 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 等系统字段 clean_metadata = { @@ -309,22 +311,23 @@ class OpenWebUICommunityClient: if k not in ["openwebui_id", "post_id"] } - function_data = { - "id": current_function.get("id", ""), - "name": metadata.get("title", current_function.get("name", "Plugin")), - "type": current_function.get("type", "action"), + # 重建插件数据结构 + plugin_data = { + "id": current_data.get("id", ""), + "name": metadata.get("title", current_data.get("name", "Plugin")), + "type": current_data.get("type", "action"), "content": source_code, "meta": { "description": metadata.get( "description", - current_function.get("meta", {}).get("description", ""), + current_data.get("meta", {}).get("description", ""), ), "manifest": clean_metadata, }, } - post_data["data"] = {"function": function_data} - post_data["type"] = "function" + post_data["data"] = {data_key: plugin_data} + post_data["type"] = post_type # 更新 README(社区页面展示内容) if readme_content: