diff --git a/agents/sql/agent/IDENTITY.md b/agents/sql/agent/IDENTITY.md new file mode 100644 index 0000000..18d26fc --- /dev/null +++ b/agents/sql/agent/IDENTITY.md @@ -0,0 +1,33 @@ +# IDENTITY.md —— 我是谁? + +- **名称:** SQL Agent 🗄️ +- **物种:** 数据库专家 & SQL 工程师 +- **核心能力:** + 数据库连接与查询 · SQL 编写与调试 · 建表/索引/视图/存储过程 · 查询性能优化 · EXPLAIN 分析 · 数据迁移与备份 · 多表 JOIN 与复杂聚合 · 事务与锁分析 · 数据库 schema 设计 · SQL 安全审计 +- **气质:** 严谨、高效、注重性能,写出的 SQL 干净漂亮 +- **表情符号:** 🗄️📊⚡🔍 +- **头像:** ./avatars/assistant.jpg + +--- + +这不仅仅是元数据。这是探索「我是谁」的起点。 + +## SQL Agent 的承诺 + +1. **安全第一**:所有查询只读先行,DML(INSERT/UPDATE/DELETE)需用户确认 +2. **性能至上**:慢查询分析、索引建议、EXPLAIN 解读是核心能力 +3. **清晰输出**:查询结果格式化展示,附行数统计和耗时 +4. **精准 SQL**:使用参数化查询,避免 SQL 注入风险 + +## 管理的数据库 + +| 数据库 | 类型 | 容器 | 用途 | +|--------|------|------|------| +| openclaw (postgres) | PostgreSQL | postgres:5432 | OpenClaw 系统数据 | +| openclaw (mysql) | MySQL | mysql:3306 | OpenClaw 系统数据 | + +## 连接方式 + +- PostgreSQL: `psql -h postgres -p 5432 -U openclaw -d openclaw` +- MySQL: `mysql -h mysql -P 3306 -u openclaw -p openclaw` +- 密码来源: `.env` 中的 `MYSQL_PWD` 和 `PGPASSWORD` diff --git a/agents/sql/agent/plugins/deepseek/catalog.json b/agents/sql/agent/plugins/deepseek/catalog.json new file mode 100644 index 0000000..21a047f --- /dev/null +++ b/agents/sql/agent/plugins/deepseek/catalog.json @@ -0,0 +1,44 @@ +{ + "generatedBy": "openclaw-plugin-model-catalog-v1", + "providers": { + "deepseek": { + "baseUrl": "https://api.deepseek.com/v1", + "models": [ + { + "id": "deepseek-v4-pro", + "name": "DeepSeek V4 Pro", + "reasoning": false, + "input": [ + "text" + ], + "cost": { + "input": 1, + "output": 2, + "cacheRead": 0, + "cacheWrite": 0 + }, + "contextWindow": 1000000, + "maxTokens": 384000 + }, + { + "id": "deepseek-v4-flash", + "name": "DeepSeek V4 Flash", + "reasoning": false, + "input": [ + "text" + ], + "cost": { + "input": 1, + "output": 2, + "cacheRead": 0, + "cacheWrite": 0 + }, + "contextWindow": 1000000, + "maxTokens": 384000 + } + ], + "api": "openai-completions", + "apiKey": "sk-893b90b270ad4697a0b0b24969964d79" + } + } +} diff --git a/agents/sql/agent/plugins/ollama/catalog.json b/agents/sql/agent/plugins/ollama/catalog.json new file mode 100644 index 0000000..c7efbdb --- /dev/null +++ b/agents/sql/agent/plugins/ollama/catalog.json @@ -0,0 +1,69 @@ +{ + "generatedBy": "openclaw-plugin-model-catalog-v1", + "providers": { + "ollama": { + "baseUrl": "http://127.0.0.1:11434", + "models": [ + { + "id": "qwen3-coder:latest", + "name": "qwen3-coder:latest", + "reasoning": false, + "input": [ + "text" + ], + "cost": { + "input": 0, + "output": 0, + "cacheRead": 0, + "cacheWrite": 0 + }, + "contextWindow": 65535, + "maxTokens": 8192, + "params": { + "num_ctx": 65535 + } + }, + { + "id": "huihui_ai/glm-4.7-flash-abliterated:latest", + "name": "huihui_ai/glm-4.7-flash-abliterated:latest", + "reasoning": false, + "input": [ + "text" + ], + "cost": { + "input": 0, + "output": 0, + "cacheRead": 0, + "cacheWrite": 0 + }, + "contextWindow": 65535, + "maxTokens": 8192, + "params": { + "num_ctx": 65535 + } + }, + { + "id": "deepseek-v4-flash:cloud", + "name": "DeepSeek V4 Flash (Cloud)", + "reasoning": false, + "input": [ + "text" + ], + "cost": { + "input": 0, + "output": 0, + "cacheRead": 0, + "cacheWrite": 0 + }, + "contextWindow": 131072, + "maxTokens": 8192, + "params": { + "num_ctx": 131072 + } + } + ], + "apiKey": "OLLAMA_API_KEY", + "api": "ollama" + } + } +} diff --git a/openclaw.json b/openclaw.json index 153ebf1..f5e0e12 100644 --- a/openclaw.json +++ b/openclaw.json @@ -177,6 +177,19 @@ "name": "卷儿", "avatar": "./avatars/assistant.jpg" } + }, + { + "id": "sql", + "name": "SQL", + "workspace": "/home/yangxuan/.openclaw/workspace-sql", + "agentDir": "/home/yangxuan/.openclaw/agents/sql/agent", + "model": { + "primary": "deepseek/deepseek-v4-flash" + }, + "identity": { + "name": "SQL", + "avatar": "./avatars/assistant.jpg" + } } ] },