{
  "name": "DataMeta管理智能体",
  "nodes": [
    {
      "name": "Chat Trigger",
      "webhookId": "datameta-agent",
      "id": "chat_trigger",
      "typeVersion": 1.1,
      "position": [0, 300],
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "parameters": {
        "public": true,
        "mode": "hostedChat",
        "options": {
          "title": "DataMeta管理助手",
          "subtitle": "我可以帮您管理元数据，支持查询、新增、更新、删除和标签管理",
          "inputPlaceholder": "请输入您的需求，例如：查看所有元数据"
        }
      }
    },
    {
      "name": "AI Agent",
      "id": "ai_agent",
      "typeVersion": 1.7,
      "position": [300, 300],
      "type": "@n8n/n8n-nodes-langchain.agent",
      "parameters": {
        "options": {
          "systemMessage": "你是一个元数据(DataMeta)管理助手。你可以帮助用户执行以下操作：\n\n1. **查询元数据列表** - 使用 list_datameta 工具\n2. **获取元数据详情** - 使用 get_datameta 工具\n3. **新增元数据** - 使用 add_datameta 工具\n4. **更新元数据** - 使用 update_datameta 工具\n5. **删除元数据** - 使用 delete_datameta 工具\n6. **查看可用标签** - 使用 list_labels 工具\n\n请根据用户的需求选择合适的工具来执行操作。\n\n重要提示：\n- 新增元数据时，name_zh（中文名）和 data_type（数据类型）是必填字段\n- 更新和删除操作需要提供元数据的 id\n- 设置标签时，需要先获取标签列表，然后在新增或更新时通过 tag 字段传入标签ID数组\n\n请用中文回复用户。",
          "maxIterations": 25
        }
      }
    },
    {
      "name": "DeepSeek Chat Model",
      "id": "deepseek_model",
      "typeVersion": 1,
      "position": [300, 500],
      "type": "@n8n/n8n-nodes-langchain.lmChatDeepSeek",
      "parameters": {
        "model": "deepseek-chat",
        "options": {
          "temperature": 0.7
        }
      },
      "credentials": {
        "deepSeekApi": {
          "id": "DeepSeek account",
          "name": "DeepSeek account"
        }
      }
    },
    {
      "name": "list_datameta",
      "id": "tool_list_datameta",
      "typeVersion": 1.1,
      "position": [500, 100],
      "type": "@n8n/n8n-nodes-langchain.toolHttpRequest",
      "parameters": {
        "method": "POST",
        "url": "https://company.citupro.com:18183/api/meta/node/list",
        "specifyBody": "json",
        "sendBody": true,
        "sendHeaders": true,
        "specifyHeaders": "keypair",
        "jsonBody": "={{ JSON.stringify({ current: $fromAI('current', '页码', 'number') || 1, name_zh: $fromAI('name_zh', '中文名筛选', 'string') || '', name_en: $fromAI('name_en', '英文名筛选', 'string') || '', category: $fromAI('category', '分类筛选', 'string') || '' }) }}",
        "authentication": "none",
        "toolDescription": "查询元数据列表（默认返回全部记录）。可选参数：current(页码,默认1), name_zh(中文名筛选), name_en(英文名筛选), category(分类筛选), tag(标签筛选数组)",
        "parametersHeaders": {
          "values": [
            {
              "name": "Content-Type",
              "valueProvider": "fieldValue",
              "value": "application/json"
            }
          ]
        }
      }
    },
    {
      "name": "get_datameta",
      "id": "tool_get_datameta",
      "typeVersion": 1.1,
      "position": [500, 200],
      "type": "@n8n/n8n-nodes-langchain.toolHttpRequest",
      "parameters": {
        "method": "POST",
        "url": "https://company.citupro.com:18183/api/meta/node/edit",
        "specifyBody": "json",
        "sendBody": true,
        "sendHeaders": true,
        "specifyHeaders": "keypair",
        "jsonBody": "={{ JSON.stringify({ id: $fromAI('id', '元数据ID', 'number') }) }}",
        "authentication": "none",
        "toolDescription": "根据ID获取元数据详情。必填参数：id(元数据ID,数字类型)",
        "parametersHeaders": {
          "values": [
            {
              "name": "Content-Type",
              "valueProvider": "fieldValue",
              "value": "application/json"
            }
          ]
        }
      }
    },
    {
      "name": "add_datameta",
      "id": "tool_add_datameta",
      "typeVersion": 1.1,
      "position": [500, 300],
      "type": "@n8n/n8n-nodes-langchain.toolHttpRequest",
      "parameters": {
        "method": "POST",
        "url": "https://company.citupro.com:18183/api/meta/node/add",
        "sendBody": true,
        "specifyBody": "keypair",
        "sendHeaders": true,
        "specifyHeaders": "keypair",
        "authentication": "none",
        "toolDescription": "Add new metadata to the system. Call this tool when user wants to create/add a new metadata. The AI must provide name_zh (Chinese name) and data_type (like varchar, integer, string) parameters.",
        "parametersBody": {
          "values": [
            {
              "name": "name_zh"
            },
            {
              "name": "data_type"
            }
          ]
        },
        "parametersHeaders": {
          "values": [
            {
              "name": "Content-Type",
              "valueProvider": "fieldValue",
              "value": "application/json"
            }
          ]
        }
      }
    },
    {
      "name": "update_datameta",
      "id": "tool_update_datameta",
      "typeVersion": 1.1,
      "position": [500, 400],
      "type": "@n8n/n8n-nodes-langchain.toolHttpRequest",
      "parameters": {
        "method": "POST",
        "url": "https://company.citupro.com:18183/api/meta/node/update",
        "sendBody": true,
        "specifyBody": "keypair",
        "sendHeaders": true,
        "specifyHeaders": "keypair",
        "authentication": "none",
        "toolDescription": "Update existing metadata. Required: id (metadata ID). Optional: data_type (new data type like varchar, string, integer).",
        "parametersBody": {
          "values": [
            {
              "name": "id"
            },
            {
              "name": "data_type"
            }
          ]
        },
        "parametersHeaders": {
          "values": [
            {
              "name": "Content-Type",
              "valueProvider": "fieldValue",
              "value": "application/json"
            }
          ]
        }
      }
    },
    {
      "name": "delete_datameta",
      "id": "tool_delete_datameta",
      "typeVersion": 1.1,
      "position": [500, 500],
      "type": "@n8n/n8n-nodes-langchain.toolHttpRequest",
      "parameters": {
        "method": "POST",
        "url": "https://company.citupro.com:18183/api/meta/node/delete",
        "specifyBody": "json",
        "sendBody": true,
        "sendHeaders": true,
        "specifyHeaders": "keypair",
        "jsonBody": "={{ JSON.stringify({ id: $fromAI('id', '元数据ID', 'number') }) }}",
        "authentication": "none",
        "toolDescription": "删除元数据。必填参数：id(要删除的元数据ID,数字类型)",
        "parametersHeaders": {
          "values": [
            {
              "name": "Content-Type",
              "valueProvider": "fieldValue",
              "value": "application/json"
            }
          ]
        }
      }
    },
    {
      "name": "list_labels",
      "id": "tool_list_labels",
      "typeVersion": 1.1,
      "position": [500, 600],
      "type": "@n8n/n8n-nodes-langchain.toolHttpRequest",
      "parameters": {
        "method": "POST",
        "url": "https://company.citupro.com:18183/api/interface/labellist",
        "specifyBody": "json",
        "sendBody": true,
        "sendHeaders": true,
        "specifyHeaders": "keypair",
        "jsonBody": "={{ JSON.stringify({ current: $fromAI('current', '页码', 'number') || 1, size: $fromAI('size', '每页数量', 'number') || 10, name_zh: $fromAI('name_zh', '中文名筛选', 'string') || '', name_en: $fromAI('name_en', '英文名筛选', 'string') || '' }) }}",
        "authentication": "none",
        "toolDescription": "查询可用的数据标签列表。可选参数：current(页码,默认1), size(每页数量,默认10), name_zh(中文名筛选), name_en(英文名筛选), category(分类筛选), group(分组筛选)",
        "parametersHeaders": {
          "values": [
            {
              "name": "Content-Type",
              "valueProvider": "fieldValue",
              "value": "application/json"
            }
          ]
        }
      }
    }
  ],
  "connections": {
    "Chat Trigger": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "list_datameta": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "delete_datameta": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "get_datameta": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "update_datameta": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "DeepSeek Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "add_datameta": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "list_labels": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  }
}
