chore: 移除本地专用 skill(nix-helper/mc-query/browser/file-process)

This commit is contained in:
Claw
2026-05-04 16:31:09 +08:00
parent 4068869217
commit 6b51154d42
4 changed files with 0 additions and 286 deletions

View File

@ -1,47 +0,0 @@
# 无头浏览器 Skill
当用户发来网页链接需要查看页面内容时使用。可以获取页面文字内容或截图。
## 环境
- 浏览器:系统 Chromium(/usr/local/bin/chromium)
- 驱动:Playwright(需在 self-workplace/.venv 中运行)
- 注意:某些网站反爬可能拒绝访问
## 使用方法
### 1. 获取页面文字内容
```bash
self-workplace/.venv/bin/python3 scripts/browse.py "https://example.com"
```
输出:页面标题 + 正文文字(前5000字符)
### 2. 截图保存
```bash
self-workplace/.venv/bin/python3 scripts/browse.py "https://example.com" --screenshot
```
截图会保存到 `files/screenshot_xxx.png`,可以调用 `qq_send_file.py` 发给用户查看。
### 3. JS 渲染页面(需要等一会儿再抓取)
```bash
self-workplace/.venv/bin/python3 scripts/browse.py "https://example.com" --wait 3
```
`--wait 3` 表示等待3秒让 JS 执行完毕再提取内容。
## 典型场景
1. **用户发了个链接想让你看** → 用 browse.py 获取文字内容,复述给用户
2. **页面需要截图才能看清**(图表、图片为主)→ `--screenshot` 截图,然后发图片给用户
3. **页面内容很长** → 自动截取前5000字符,告诉用户剩余内容长度
## 注意事项
- 某些网站(需登录、验证码、Cloudflare等)可能无法正常访问
- 单页面最多等15秒,超时会打印已获取的内容
- 截图是全页截图,可能很大(长页面),发送前注意文件大小

View File

@ -1,129 +0,0 @@
# 办公文件处理 Skill
处理用户发来的 Word (.docx)、Excel (.xlsx)、PowerPoint (.pptx)、PDF (.pdf) 等办公文件。
## 工作流程
```
收到用户文件请求
↓
从 files/ 目录找到文件(或先用 qq_get_file.py 下载)
↓
复制到 self-workplace/ 下处理(避免污染原文件)
↓
用 Python 脚本处理并输出结果
↓
将处理结果通过 qq_send_msg.py 或 qq_send_file.py 发送给用户
↓
删除 self-workplace/ 下的临时副本
```
## 环境
虚拟环境位置:`YOUR_WORKSPACE_PATH/self-workplace/.venv`
用 `.venv/bin/python3` 调用,或用 `source .venv/bin/activate` 激活后直接 `python3`。
已安装的包:
| 包 | 用途 | 支持格式 |
|---|---|---|
| python-docx | 读写 Word 文档 | .docx |
| python-pptx | 读写 PPT 演示文稿 | .pptx |
| openpyxl | 读写 Excel 工作簿 | .xlsx |
| PyMuPDF (fitz) | PDF 通用解析(文字/图片/元数据) | .pdf |
| pdfplumber | PDF 精确提取(表格友好) | .pdf |
| Pillow | 图片处理 | .jpg/.png |
## 使用方法
### 1. Word (.docx) — python-docx
```python
from docx import Document
doc = Document("self-workplace/文件名.docx")
# 读取所有段落
for para in doc.paragraphs:
print(f"[{para.style.name}] {para.text}")
# 读取表格
for table in doc.tables:
for row in table.rows:
print(" | ".join(cell.text for cell in row.cells))
# 修改后保存
# doc.save("self-workplace/输出.docx")
```
### 2. PowerPoint (.pptx) — python-pptx
```python
from pptx import Presentation
prs = Presentation("self-workplace/文件名.pptx")
for slide in prs.slides:
print(f"--- 幻灯片 {slide.slide_id} ---")
for shape in slide.shapes:
if shape.has_text_frame:
text = shape.text_frame.text.strip()
if text:
print(text)
if shape.has_table:
table = shape.table
for row in table.rows:
print(" | ".join(cell.text for cell in row.cells))
```
### 3. Excel (.xlsx) — openpyxl
```python
from openpyxl import load_workbook
wb = load_workbook("self-workplace/文件名.xlsx", data_only=True)
# 工作表列表
print("工作表:", wb.sheetnames)
# 读取第一个工作表
ws = wb.active
for row in ws.iter_rows(values_only=True):
print(" | ".join(str(cell) if cell is not None else "" for cell in row))
```
### 4. PDF — PyMuPDF(通用提取)
```python
import fitz
doc = fitz.open("self-workplace/文件名.pdf")
print(f"共 {len(doc)} 页")
for page_num in range(len(doc)):
page = doc[page_num]
text = page.get_text()
print(f"--- 第 {page_num+1} 页 ---")
print(text)
```
### 5. PDF 表格 — pdfplumber(表格提取)
```python
import pdfplumber
with pdfplumber.open("self-workplace/文件名.pdf") as pdf:
for i, page in enumerate(pdf.pages):
tables = page.extract_tables()
for t_idx, table in enumerate(tables):
print(f"--- 第 {i+1} 页 表格 {t_idx+1} ---")
for row in table:
print(" | ".join(str(c) if c else "" for c in row))
```
## 注意事项
1. **复制到 self-workplace 处理**:先 cp 过去再处理,原始文件不动,处理完删临时副本
2. **处理完发送结果**:用 `qq_send_msg.py` 发文字摘要,或 `qq_send_file.py` 发生成的文档
3. **必须清理**:处理完成后删除 `self-workplace/` 下的副本,防止堆积
4. **编码问题**:Python 默认 utf-8,一般没问题。中文 .docx 如果有乱码可尝试 `encoding="utf-8"`

View File

@ -1,85 +0,0 @@
# mc-query Skill
Minecraft 服务器信息查询能力。通过本地脚本直接读取服务器数据,无需经过 ops-manager。
## 脚本清单
| 脚本 | 功能 | 输出 |
|---|---|---|
| `mc_query.py status` | 服务器运行状态 | 人数、内存、CPU、TPS、版本、存档大小、磁盘 |
| `mc_query.py players` | 玩家信息 | 最近动态、在线时间排行、死亡排行、成就排行 |
| `mc_query.py world` | 世界详情 | 世界时间、实体统计、网络流量、活跃模组 |
| `mc_query.py all` | 全部信息 | 综合输出 |
## 使用方法
```python
import subprocess, json
# 获取服务器状态(JSON)
result = subprocess.run(
["python3", "YOUR_WORKSPACE_PATH/scripts/mc_query.py", "status", "--json"],
capture_output=True, text=True, timeout=30
)
data = json.loads(result.stdout)
# 获取玩家排行
result = subprocess.run(
["python3", "YOUR_WORKSPACE_PATH/scripts/mc_query.py", "players", "--json"],
capture_output=True, text=True, timeout=30
)
data = json.loads(result.stdout)
# 获取世界详情
result = subprocess.run(
["python3", "YOUR_WORKSPACE_PATH/scripts/mc_query.py", "world", "--json"],
capture_output=True, text=True, timeout=30
)
data = json.loads(result.stdout)
```
## JSON 返回示例
### status
```json
{
"players": {"online": 3, "max": 20, "list": "Alice, Bob, Charlie"},
"memory": {"used_mb": 4096, "used_gb": "4.0GB"},
"cpu": "15.2%",
"uptime": "2天5小时30分钟",
"tps": {"tps_1m": 19.8},
"version": "NeoForge 21.1.72",
"world_size": "12.3G",
"disk": {"used": "45.2GB", "total": "100.0GB", "percent": "45.2%"},
"load": {"avg": 0.85, "percent": "28.3%", "cores": 8}
}
```
### players
```json
{
"recent_events": [{"type": "join", "player": "Alice"}],
"playtime": [
{"name": "Alice", "seconds": 45000, "formatted": "12小时30分钟"}
],
"deaths": [{"name": "Charlie", "deaths": 23}],
"achievements": [{"name": "Alice", "achievements": 47}]
}
```
### world
```json
{
"world_time": {"day": 123, "time": "14:30", "phase": "白天"},
"entities": {"total": 1523, "hostile": 234, "friendly": 890, "other": 399},
"top_entities": {"sheep": 120, "zombie": 89},
"network": {"rx_gb": 1.2, "tx_gb": 0.8},
"mods": ["create", "appliedenergistics2", "farmersdelight"]
}
```
## 注意事项
- 所有脚本依赖 `mc_config.py` 中的 RCON 配置
- 脚本设计为功能正交:每个只做一件事,可组合使用
- 输出到 QQ 时禁止使用 Markdown(不用 `#`, `*`, `` ` ``, `>`, `-` 列表等)

View File

@ -1,25 +0,0 @@
# nix-helper Skill
遇到运维、系统、脚本、Linux 等技术问题时,通过 ask_nix.py 向 Nix 求助。
## 原理
`ask_nix.py` 通过 Gateway `/v1/chat/completions` 同步 API 调用 ops-manager agent。Nix 的回复会直接返回,不需要额外桥接。
## 用法
```python
import subprocess
result = subprocess.run(
["python3", "YOUR_WORKSPACE_PATH/scripts/ask_nix.py", "你的问题"],
timeout=125, capture_output=True, text=True
)
answer = result.stdout.strip() if result.returncode == 0 else result.stderr.strip()
```
## 限制
- **最长等待 120 秒**,超时告诉用户 "Nix 没回 超时了 要么他不在线 要么忙着呢 老板稍后再试吧"
- **禁止用 sessions_spawn 调用 ops-manager**,永远通过 ask_nix.py 联系
- 把 answer 返回给用户时,开头加 `[Nix说]`