新增技能目录重新扫描接口与分页,关掉技能安全扫描的配置开关
- 后端新增 POST /api/skills/reconcile-custom:扫描 custom 目录,把磁盘存在但 DB 无记录的技能登记到调用者名下(published=false),附 4 个单元测试 - 前端技能列表加"重新扫描技能目录"按钮,列表分页每页 10 条 - SkillsConfig 新增 security_scan.enabled(默认 true)用于关闭 LLM 安全扫描;scan_skill_content 在开关关闭时直接放行 - 智能体卡片/对话页长名 truncate 显示 + loading 占位 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
b6a2c9336e
commit
80fc2a9240
14 files changed
+366
-11
No files matched your search
@@ -446,7 +446,14 @@ export const enUS: Translations = {
|
||||
"Manage the configuration and enabled status of the agent skills.",
|
||||
createSkill: "Create skill",
|
||||
installSkill: "Install skill",
|
||||
rescanSkills: "Rescan skills directory",
|
||||
rescanSkillsRunning: "Scanning…",
|
||||
rescanSkillsAdopted: "Adopted {count} new skill(s)",
|
||||
rescanSkillsNoop: "No new skills found on disk",
|
||||
goToEvolution: "Skill evolution",
|
||||
paginationPrev: "Prev",
|
||||
paginationNext: "Next",
|
||||
paginationPageOf: "Page {page} of {total}",
|
||||
emptyTitle: "No agent skill yet",
|
||||
emptyDescription:
|
||||
"Put your agent skill folders under the `/skills/custom` folder under the root folder of CM Assistant.",
|
||||
|
||||
@@ -381,7 +381,14 @@ export interface Translations {
|
||||
description: string;
|
||||
createSkill: string;
|
||||
installSkill: string;
|
||||
rescanSkills: string;
|
||||
rescanSkillsRunning: string;
|
||||
rescanSkillsAdopted: string;
|
||||
rescanSkillsNoop: string;
|
||||
goToEvolution: string;
|
||||
paginationPrev: string;
|
||||
paginationNext: string;
|
||||
paginationPageOf: string;
|
||||
emptyTitle: string;
|
||||
emptyDescription: string;
|
||||
emptyButton: string;
|
||||
|
||||
@@ -427,7 +427,14 @@ export const zhCN: Translations = {
|
||||
description: "管理 Agent Skill 配置和启用状态。",
|
||||
createSkill: "新建技能",
|
||||
installSkill: "安装技能",
|
||||
rescanSkills: "重新扫描技能目录",
|
||||
rescanSkillsRunning: "扫描中…",
|
||||
rescanSkillsAdopted: "已收纳 {count} 个新技能",
|
||||
rescanSkillsNoop: "没有发现需要收纳的新技能",
|
||||
goToEvolution: "自我进化",
|
||||
paginationPrev: "上一页",
|
||||
paginationNext: "下一页",
|
||||
paginationPageOf: "第 {page} / {total} 页",
|
||||
emptyTitle: "还没有技能",
|
||||
emptyDescription:
|
||||
"将你的 Agent Skill 文件夹放在 CM 助手 根目录下的 `/skills/custom` 文件夹中。",
|
||||
|
||||
@@ -135,6 +135,22 @@ export async function installSkillUpload(
|
||||
return response.json() as Promise<InstallSkillResponse>;
|
||||
}
|
||||
|
||||
export interface ReconcileCustomSkillsResponse {
|
||||
adopted: string[];
|
||||
already_registered: string[];
|
||||
}
|
||||
|
||||
export async function reconcileCustomSkills(): Promise<ReconcileCustomSkillsResponse> {
|
||||
const response = await apiFetch(
|
||||
`${getBackendBaseURL()}/api/skills/reconcile-custom`,
|
||||
{ method: "POST" },
|
||||
);
|
||||
if (!response.ok) {
|
||||
throw await parseDetailedError(response, "Failed to reconcile skills directory");
|
||||
}
|
||||
return response.json() as Promise<ReconcileCustomSkillsResponse>;
|
||||
}
|
||||
|
||||
export interface SetSkillPublishedResponse {
|
||||
name: string;
|
||||
owner_user_id: string | null;
|
||||
|
||||
@@ -11,6 +11,7 @@ import {
|
||||
getSkill,
|
||||
getSkillContent,
|
||||
installSkillUpload,
|
||||
reconcileCustomSkills,
|
||||
setSkillDetail,
|
||||
setSkillPinned,
|
||||
setSkillPublished,
|
||||
@@ -95,6 +96,16 @@ export function useInstallSkillUpload() {
|
||||
});
|
||||
}
|
||||
|
||||
export function useReconcileCustomSkills() {
|
||||
const queryClient = useQueryClient();
|
||||
return useMutation({
|
||||
mutationFn: () => reconcileCustomSkills(),
|
||||
onSuccess: () => {
|
||||
void queryClient.invalidateQueries({ queryKey: ["skills"] });
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export function useSetSkillPublished() {
|
||||
const queryClient = useQueryClient();
|
||||
return useMutation({
|
||||
|
||||
Reference in new issue
Block a user