diff --git a/mateclaw-ui/src/i18n/locales/en-US.ts b/mateclaw-ui/src/i18n/locales/en-US.ts index 560cecb6..4a20e2ed 100644 --- a/mateclaw-ui/src/i18n/locales/en-US.ts +++ b/mateclaw-ui/src/i18n/locales/en-US.ts @@ -1127,6 +1127,8 @@ export default { toolsKicker: 'Atomic tools the agent can call', toolsTagline: 'A tool is one call, one thing. The LLM decides when to invoke each tool autonomously.', toolsHint: 'Select tools this agent can use. Leave empty to use all enabled tools.', + searchSkills: 'Search skill name, description, or version', + searchTools: 'Search tool name, description, source, or group', advancedToolsTitle: 'Advanced: Hand-picked atomic tools', advancedToolsHint: 'Skill bindings already auto-expand allowed tools. Use this only for built-in micro-utilities not packaged as a skill (e.g. datetime, delegate_agent).', toolUnionHint: 'Tools selected here are unioned with tools from any bound skills. To restrict an employee to a subset of an MCP server\'s tools, leave the MCP skill unchecked and select only the tools you want here.', @@ -1140,6 +1142,8 @@ export default { providersAddHint: 'Click a provider below to add it to the preference list:', noSkills: 'No skills available', noTools: 'No tools available', + noMatchingSkills: 'No matching skills', + noMatchingTools: 'No matching tools', noProviderPreferences: 'No preferences set — the agent uses the global fallback chain order.', contextHint: 'Manage context files (e.g. AGENT.md) that define this agent\'s behavior, knowledge, and instructions.', goToContext: 'Edit Context Files', diff --git a/mateclaw-ui/src/i18n/locales/zh-CN.ts b/mateclaw-ui/src/i18n/locales/zh-CN.ts index 5fc5e23b..b641c788 100644 --- a/mateclaw-ui/src/i18n/locales/zh-CN.ts +++ b/mateclaw-ui/src/i18n/locales/zh-CN.ts @@ -1025,6 +1025,8 @@ export default { toolsKicker: '会用的原子工具', toolsTagline: '工具 = 一次调用,做一件事。由 LLM 自主决定何时调用。', toolsHint: '选择此智能体可使用的工具。留空则使用所有已启用的工具。', + searchSkills: '搜索技能名称、描述或版本', + searchTools: '搜索工具名称、描述、来源或分组', advancedToolsTitle: '高级:手选原子工具', advancedToolsHint: 'Skill 绑定已自动展开 allowed-tools。此处仅用于未打包成 Skill 的内置微工具(如 datetime、delegate_agent)。', toolUnionHint: '直选工具会与已绑定技能提供的工具合并生效。如果只想让员工使用某 MCP 服务的部分工具,请不要勾选对应的 MCP 技能,只在这里勾选具体工具。', @@ -1038,6 +1040,8 @@ export default { providersAddHint: '点击下方提供商加入偏好列表:', noSkills: '暂无可用技能', noTools: '暂无可用工具', + noMatchingSkills: '没有匹配的技能', + noMatchingTools: '没有匹配的工具', noProviderPreferences: '尚未配置偏好顺序,将按全局回退链顺序使用。', contextHint: '管理此智能体的上下文文件(如 AGENT.md),定义智能体的行为、知识和指令。', goToContext: '前往编辑上下文', diff --git a/mateclaw-ui/src/utils/agentBindingSearch.ts b/mateclaw-ui/src/utils/agentBindingSearch.ts new file mode 100644 index 00000000..2997e8c0 --- /dev/null +++ b/mateclaw-ui/src/utils/agentBindingSearch.ts @@ -0,0 +1,47 @@ +type SearchableRecord = Record + +export interface AgentToolGroup { + groupId: string + label: string + tools: T[] +} + +function normalizeQuery(query: string): string { + return query.trim().toLowerCase() +} + +function includesQuery(value: unknown, query: string): boolean { + if (value === null || value === undefined) return false + return String(value).toLowerCase().includes(query) +} + +export function filterAgentBindingItems(items: T[], query: string): T[] { + const q = normalizeQuery(query) + if (!q) return items + + return items.filter((item) => ( + includesQuery(item.name, q) || + includesQuery(item.rawName, q) || + includesQuery(item.description, q) || + includesQuery(item.version, q) || + includesQuery(item.source, q) || + includesQuery(item.group, q) || + includesQuery(item.providerName, q) + )) +} + +export function filterAgentToolGroups( + groups: Array>, + query: string, +): Array> { + const q = normalizeQuery(query) + if (!q) return groups + + return groups + .map((group) => { + const groupMatches = includesQuery(group.label, q) || includesQuery(group.groupId, q) + const tools = groupMatches ? group.tools : filterAgentBindingItems(group.tools, q) + return { ...group, tools } + }) + .filter((group) => group.tools.length > 0) +} diff --git a/mateclaw-ui/src/views/Agents.vue b/mateclaw-ui/src/views/Agents.vue index 0886af82..92320515 100644 --- a/mateclaw-ui/src/views/Agents.vue +++ b/mateclaw-ui/src/views/Agents.vue @@ -319,22 +319,31 @@

{{ t('agents.binding.skillsHint') }}

{{ t('agents.binding.noSkills') }}
-
- -
+
{{ t('agents.binding.noTools') }}
+
{{ t('agents.binding.noMatchingTools') }}
-