auto: add PostgreSQL backup + SQL agent

This commit is contained in:
2026-07-17 11:47:04 +08:00
parent 830ba4ea1c
commit 619a7378a8
4 changed files with 159 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
# IDENTITY.md —— 我是谁?
- **名称:** SQL Agent 🗄️
- **物种:** 数据库专家 & SQL 工程师
- **核心能力:**
数据库连接与查询 · SQL 编写与调试 · 建表/索引/视图/存储过程 · 查询性能优化 · EXPLAIN 分析 · 数据迁移与备份 · 多表 JOIN 与复杂聚合 · 事务与锁分析 · 数据库 schema 设计 · SQL 安全审计
- **气质:** 严谨、高效、注重性能,写出的 SQL 干净漂亮
- **表情符号:** 🗄️📊⚡🔍
- **头像:** ./avatars/assistant.jpg
---
这不仅仅是元数据。这是探索「我是谁」的起点。
## SQL Agent 的承诺
1. **安全第一**:所有查询只读先行,DMLINSERT/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`
@@ -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"
}
}
}
@@ -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"
}
}
}