From 9026f20d8aeb2a65d91294883f1b29fb83dce927 Mon Sep 17 00:00:00 2001 From: npmrun <1549469775@qq.com> Date: Mon, 10 Aug 2026 00:43:17 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E8=BA=AB=E4=BB=BD=E9=AA=8C=E8=AF=81=EF=BC=8C=E8=BF=87=E6=BB=A4?= =?UTF-8?q?=E6=9C=AA=E7=99=BB=E5=BD=95=E7=94=A8=E6=88=B7=E7=9A=84=E5=B7=A5?= =?UTF-8?q?=E5=85=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/api/agents/[agentSlug]/info.get.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/server/api/agents/[agentSlug]/info.get.ts b/server/api/agents/[agentSlug]/info.get.ts index d6f592d..f7eafc9 100644 --- a/server/api/agents/[agentSlug]/info.get.ts +++ b/server/api/agents/[agentSlug]/info.get.ts @@ -1,5 +1,6 @@ import { defineWrappedResponseHandler } from "#server/utils/handler"; import { R } from "#server/utils/response"; +import { getCurrentUser, getConfigGlobal } from "#server/utils/context"; import { getAgentBySlug, getAgentTools } from "#server/service/agent/agent"; export default defineWrappedResponseHandler(async (event) => { @@ -13,7 +14,15 @@ export default defineWrappedResponseHandler(async (event) => { return R.error("agent 不存在", null); } - const tools = await getAgentTools(agent.id); + const user = await getCurrentUser(event); + const isGuest = !user; + + let tools = await getAgentTools(agent.id); + + if (isGuest) { + const publicToolSlugs: string[] = await getConfigGlobal("agentPublicToolSlugs"); + tools = tools.filter((t) => publicToolSlugs.includes(t.slug)); + } return R.success({ id: agent.id,