Tentarc Logo文档

工具图标

工具图标配置

自定义聊天活动行中 CLI 命令旁显示的图标。

概述

当 Agent 运行 CLI 命令(例如 git statusnpm install)时,应用会将命令名称解析为品牌图标。映射定义在:

~/.tentarc/tool-icons/tool-icons.json

图标文件(.png.ico.svg.jpg)与 JSON 配置位于同一目录中。

Schema

{
  "version": 1,
  "tools": [
    {
      "id": "git",
      "displayName": "Git",
      "icon": "git.ico",
      "commands": ["git"]
    }
  ]
}

字段

字段类型描述
versionnumberSchema 版本(当前为 1
toolsarray工具条目数组
tools[].idstring唯一标识符(slug 格式,例如 "git"
tools[].displayNamestringUI 中显示的人类可读名称
tools[].iconstring相对于 tool-icons 目录的图标文件名
tools[].commandsstring[]映射到此工具的 CLI 命令名称

添加自定义工具

  1. 将图标文件放入 ~/.tentarc/tool-icons/(支持 .png.ico.svg.jpg
  2. tool-icons.json 中添加条目:
{
  "id": "my-tool",
  "displayName": "My Tool",
  "icon": "my-tool.png",
  "commands": ["my-tool", "mt"]
}
  1. 重启应用或开始新对话使更改生效。

命令匹配

命令解析器处理复杂的 bash 字符串:

  • 简单命令git status 匹配 git
  • 链式命令git add . && npm publish 匹配第一个识别到的工具
  • 环境变量前缀NODE_ENV=prod npm test 匹配 npm
  • Sudo/time 前缀sudo docker ps 匹配 docker
  • 路径前缀/usr/local/bin/node 匹配 node
  • 管道git log | head -10 匹配 git

字符串中第一个被识别的命令决定图标。

每个工具多个命令

一个工具可以匹配多个命令名称:

{
  "id": "npm",
  "displayName": "npm",
  "icon": "npm.png",
  "commands": ["npm", "npx"]
}

内置默认值

应用附带约 57 个内置工具图标,涵盖常用 CLI 工具(git、npm、docker、python、rust、aws 等)。这些在首次运行时初始化,且不会被覆盖,因此你的自定义配置在更新后仍然保留。

图标文件指南

  • 推荐尺寸:64x64 或 128x128 像素
  • 格式:PNG(推荐)、ICO、SVG、JPG
  • 背景:透明 PNG 效果最佳
  • 图标在 UI 中以 20x20px 显示,因此保持简洁易识别