From b88f883d44692051b0411b64d7d844e27aeed1af Mon Sep 17 00:00:00 2001 From: deploy Date: Wed, 15 Jul 2026 18:58:15 +0800 Subject: [PATCH] =?UTF-8?q?feat(market):=20admin=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=89=8D=E5=8F=B0=E5=AF=BC=E5=85=A5=E7=9A=84Agent/Skill/MCP?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E6=A0=87=E8=AE=B0=E4=B8=BA=E5=AE=98=E6=96=B9?= =?UTF-8?q?(official)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - POST /market/apps: 当 current_user.role == "admin" 时,source 强制设为 official - 前端发送 source:/user/ 也会被后端覆盖为 official - 前台卡片已有 official-badge 徽章展示,无需额外前端改动 --- backend/python/app/api/market.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/backend/python/app/api/market.py b/backend/python/app/api/market.py index ee71b4e..5d0bc62 100644 --- a/backend/python/app/api/market.py +++ b/backend/python/app/api/market.py @@ -340,13 +340,22 @@ def upload_app( detail=f"Agent 连接校验未通过:{v['detail']}", ) + # source 判定:管理员(admin 角色)通过前台市场导入/开发的 Agent/Skill/MCP + # 统一标记为官方(official),其余用户按请求或默认为 user。 + if current_user.role == "admin": + app_source = "official" + elif req.source and req.source in ("official", "user"): + app_source = req.source + else: + app_source = "user" + app = MarketApp( id=gen_uuid(), name=req.name, description=req.description, icon=req.icon, type=req.type if req.type in ("skill","agent","mcp") else "skill", - source=req.source if req.source in ("official","user") else "user", + source=app_source, platform=req.platform, price=req.price, install_count=0,