You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

24 lines
798 B

import { defineWrappedResponseHandler } from "#server/utils/handler";
import { R } from "#server/utils/response";
import { requireAdmin } from "#server/utils/admin-guard";
import { setGlobalConfigValue } from "#server/service/config";
export default defineWrappedResponseHandler(async (event) => {
await requireAdmin(event);
const body = await readBody(event);
const { publicToolSlugs } = body as { publicToolSlugs?: string[] };
if (!Array.isArray(publicToolSlugs)) {
return R.error("参数无效", null);
}
for (const slug of publicToolSlugs) {
if (typeof slug !== "string" || slug.length === 0) {
return R.error("工具slug无效", null);
}
}
await setGlobalConfigValue("agentPublicToolSlugs", publicToolSlugs);
return R.success({ publicToolSlugs });
});