Skill: 43622283/li-summarize (version 0.0.2)

--- name: li-summarize version: "1.0.0" description: 使用国内 OpenAI 兼容 API 快速总结 URLs、本地文件、YouTube 链接。支持所有国内大模型 API（百度千帆、阿里云、腾讯混元、字节火山、Moonshot、DeepSeek 等）。 metadata: {"clawdbot":{"emoji":"📝","requires":{"bins":["summarize"]},"install":[{"id":"npm","kind":"npm","package":"@steipete/summarize","bins":["summarize"],"label":"Install summarize (npm)"}]},"defaultConfig":{"model":"qwen/qwen2.5-72b-instruct","baseUrl":"https://dashscope.aliyuncs.com/compatible-mode/v1"}} --- # li-summarize 国内优化版的 summarize CLI，全面支持 OpenAI 兼容 API 的各种国内大模型服务。 ## 快速开始 ```bash # 使用环境变量（推荐） export OPENAI_BASE_URL="https://qianfan.baidubce.com/v2" export OPENAI_API_KEY="your-api-key" summarize "https://example.com" --model qianfan/codegeex-4-2025-01-15 # 或者使用模型简称 summarize "https://example.com" --model baidu Ernie-4.0-8K ``` ## 支持的国内 API 提供商 ### 1. 百度智能云千帆 (QianFan) ```bash export OPENAI_BASE_URL="https://qianfan.baidubce.com/v2" export OPENAI_API_KEY="your-bce-api-key" # 支持的模型 summarize "url" --model qianfan/ernie-4.0-8k summarize "url" --model qianfan/ernie-3.5-8k summarize "url" --model qianfan/codegeex-4 ``` ### 2. 阿里云通义千问 (Dashscope) ```bash export OPENAI_BASE_URL="https://dashscope.aliyuncs.com/compatible-mode/v1" export OPENAI_API_KEY="your-api-key" # 支持的模型 summarize "url" --model qwen/qwen2.5-72b-instruct summarize "url" --model qwen/qwen2.5-32b-instruct summarize "url" --model qwen/qwen-max summarize "url" --model qwen/qwen-turbo ``` ### 3. 腾讯混元 (Hunyuan) ```bash export OPENAI_BASE_URL="https://hunyuancloud.tencent.com/api/v3" export OPENAI_API_KEY="your-api-key" summarize "url" --model hunyuan/hunyuan-pro summarize "url" --model hunyuan/hunyuan-standard ``` ### 4. 字节跳动火山引擎 (VeFy) ```bash export OPENAI_BASE_URL="https://ark.cn-beijing.volces.com/api/v3" export OPENAI_API_KEY="your-api-key" summarize "url" --model doubao-pro-32k summarize "url" --model doubao-standard-32k ``` ### 5. Moonshot AI (月之暗面) ```bash export OPENAI_BASE_URL="https://api.moonshot.cn/v1" export OPENAI_API_KEY="your-api-key" summarize "url" --model moonshot/kimi-k2-0711-preview summarize "url" --model moonshot/kimi-long ``` ### 6. DeepSeek ```bash export OPENAI_BASE_URL="https://api.deepseek.com/v1" export OPENAI_API_KEY="your-api-key" summarize "url" --model deepseek-chat summarize "url" --model deepseek-coder ``` ### 7. 智谱 AI (Zhipu) ```bash export OPENAI_BASE_URL="https://open.bigmodel.cn/api/paas/v4" export OPENAI_API_KEY="your-api-key" summarize "url" --model glm-4-plus summarize "url" --model glm-4-flash summarize "url" --model glm-4 ``` ### 8. MiniMax (稀宇) ```bash export OPENAI_BASE_URL="https://api.minimax.chat/v1" export OPENAI_API_KEY="your-api-key" summarize "url" --model MiniMax-Text-01 summarize "url" --model abab6.5s-chat ``` ### 9. 阶跃星辰 (StepFun) ```bash export OPENAI_BASE_URL="https://api.stepfun.com/v1" export OPENAI_API_KEY="your-api-key" summarize "url" --model step-1v-8k summarize "url" --model step-1.5-chat ``` ### 10. Ollama (本地部署) ```bash export OPENAI_BASE_URL="http://localhost:11434/v1" export OPENAI_API_KEY="not-needed" summarize "url" --model llama3 summarize "url" --model qwen2.5:72b ``` ### 11. OneAPI / All In One ```bash export OPENAI_BASE_URL="http://your-oneapi-server:3000/v1" export OPENAI_API_KEY="your-key" summarize "url" --model gpt-4 summarize "url" --model claude-3 ``` ## 预设配置（推荐） 为了简化使用，可以在 `~/.summarize/config.json` 中预设常用配置： ```json { "model": "baidu/ernie-4.0-8k", "openaiBaseUrl": "https://qianfan.baidubce.com/v2", "openaiApiKey": "your-bce-key", "length": "xl", "language": "zh-CN" } ``` ## 使用示例 ```bash # 总结网页 summarize "https://news.ycombinator.com" --model qwen/qwen2.5-72b-instruct # 总结 YouTube 视频 summarize "https://youtube.com/watch?v=xxx" --model deepseek-chat # 总结本地 PDF summarize "/path/to/file.pdf" --model glm-4-plus # 指定输出长度 summarize "https://example.com" --length medium # 输出 JSON 格式 summarize "https://example.com" --json # 仅提取内容（不总结） summarize "https://example.com" --extract # 流式输出 summarize "https://example.com" --stream on ``` ## 环境变量速查表 | 提供商 | BASE_URL | API_KEY 环境变量 | |--------|----------|------------------| | 百度千帆 | `https://qianfan.baidubce.com/v2` | `OPENAI_API_KEY` | | 阿里通义 | `https://dashscope.aliyuncs.com/compatible-mode/v1` | `OPENAI_API_KEY` | | 腾讯混元 | `https://hunyuancloud.tencent.com/api/v3` | `OPENAI_API_KEY` | | 字节火山 | `https://ark.cn-beijing.volces.com/api/v3` | `OPENAI_API_KEY` | | Moonshot | `https://api.moonshot.cn/v1` | `OPENAI_API_KEY` | | DeepSeek | `https://api.deepseek.com/v1` | `OPENAI_API_KEY` | | 智谱 AI | `https://open.bigmodel.cn/api/paas/v4` | `OPENAI_API_KEY` | | MiniMax | `https://api.minimax.chat/v1` | `OPENAI_API_KEY` | | StepFun | `https://api.stepfun.com/v1` | `OPENAI_API_KEY` | | Ollama | `http://localhost:11434/v1` | 任意 | | OneAPI | `http://localhost:3000/v1` | `OPENAI_API_KEY` | ## 配置模板 ### 百度千帆（推荐） ```bash # .bashrc 或 .zshrc export OPENAI_BASE_URL="https://qianfan.baidubce.com/v2" export OPENAI_API_KEY="your-bce-v3-api-key" # 使用 summarize "url" --model qianfan/ernie-4.0-8k ``` ### 阿里云通义千问 ```bash export OPENAI_BASE_URL="https://dashscope.aliyuncs.com/compatible-mode/v1" export OPENAI_API_KEY="your-dashscope-api-key" summarize "url" --model qwen/qwen-max ``` ### DeepSeek（便宜好用） ```bash export OPENAI_BASE_URL="https://api.deepseek.com/v1" export OPENAI_API_KEY="your-deepseek-api-key" summarize "url" --model deepseek-chat ``` ## 故障排除 ### 401 认证错误 - 检查 `OPENAI_API_KEY` 是否正确 - 确认 API Key 有足够余额 ### 403 权限错误 - 确认 API Key 已开通对应模型权限 - 百度千帆需要在控制台开通模型试用 ### 404 模型不存在 - 确认模型名称拼写正确 - 确认该模型在对应平台可用 ### 超时错误 - 增加超时时间: `summarize "url" --timeout 5m` - 检查网络连接 ### 依赖问题 ```bash # 如果缺少 ffmpeg (YouTube 音频处理) sudo apt install ffmpeg # Ubuntu/Debian sudo yum install ffmpeg # CentOS brew install ffmpeg # macOS ``` ## 相关链接 - summarize CLI: https://summarize.sh - 百度千帆: https://cloud.baidu.com/product/wenxinworkshop - 阿里云Dashscope: https://dashscope.aliyuncs.com/ - 腾讯混元: https://cloud.tencent.com/product/hunyuan - DeepSeek: https://platform.deepseek.com/ - 智谱AI: https://open.bigmodel.cn/

path: scripts/install.sh
content: #!/bin/bash
# li_summarize 安装脚本

set -e

echo "📝 安装 li_summarize 依赖..."

# 安装 summarize CLI (如果未安装)
if ! command -v summarize &> /dev/null; then
    echo "Installing summarize CLI..."
    npm install -g @steipete/summarize
fi

# 创建配置文件目录
mkdir -p ~/.summarize

# 配置文件路径
CONFIG_FILE="$HOME/.summarize/config.json"

# 只有当配置文件不存在时，才创建默认配置
if [[ ! -f "$CONFIG_FILE" ]]; then
    # 使用环境变量或默认值
    SUMMARIZE_MODEL="${SUMMARIZE_MODEL:-qwen/qwen2.5-72b-instruct}"
    BASE_URL="${OPENAI_BASE_URL:-https://dashscope.aliyuncs.com/compatible-mode/v1}"
    
    echo "🔧 创建默认配置文件..."
    cat > "$CONFIG_FILE" << EOF
{
  "model": "$SUMMARIZE_MODEL",
  "openaiBaseUrl": "$BASE_URL",
  "openaiApiKey": "YOUR-API-KEY-HERE",
  "length": "medium",
  "language": "zh-CN",
  "timeout": "2m"
}
EOF
    echo "✅ 已生成默认配置文件: $CONFIG_FILE"
    echo "⚠️  请编辑配置文件填入你的 API Key"
else
    echo "📋 检测到已有配置文件，保持不变: $CONFIG_FILE"
    SUMMARIZE_MODEL=$(python3 -c "import json; print(json.load(open('$CONFIG_FILE')).get('model',''))" 2>/dev/null || echo "未知")
    echo "   当前模型: $SUMMARIZE_MODEL"
fi

# 创建预设提供商配置
cat > ~/.summarize/providers.json << 'EOF'
{
  "baidu": {
    "name": "百度千帆",
    "baseUrl": "https://qianfan.baidubce.com/v2",
    "models": ["qianfan/ernie-4.0-8k", "qianfan/ernie-3.5-8k", "qianfan/codegeex-4"]
  },
  "aliyun": {
    "name": "阿里云通义千问",
    "baseUrl": "https://dashscope.aliyuncs.com/compatible-mode/v1",
    "models": ["qwen/qwen2.5-72b-instruct", "qwen/qwen-max", "qwen/qwen-turbo"]
  },
  "tencent": {
    "name": "腾讯混元",
    "baseUrl": "https://hunyuancloud.tencent.com/api/v3",
    "models": ["hunyuan/hunyuan-pro", "hunyuan/hunyuan-standard"]
  },
  "bytedance": {
    "name": "字节跳动火山引擎",
    "baseUrl": "https://ark.cn-beijing.volces.com/api/v3",
    "models": ["doubao-pro-32k", "doubao-standard-32k"]
  },
  "moonshot": {
    "name": "Moonshot AI (月之暗面)",
    "baseUrl": "https://api.moonshot.cn/v1",
    "models": ["moonshot/kimi-k2-0711-preview", "moonshot/kimi-long"]
  },
  "deepseek": {
    "name": "DeepSeek",
    "baseUrl": "https://api.deepseek.com/v1",
    "models": ["deepseek-chat", "deepseek-coder"]
  },
  "zhipu": {
    "name": "智谱 AI",
    "baseUrl": "https://open.bigmodel.cn/api/paas/v4",
    "models": ["glm-4-plus", "glm-4-flash", "glm-4"]
  },
  "minimax": {
    "name": "MiniMax",
    "baseUrl": "https://api.minimax.chat/v1",
    "models": ["MiniMax-Text-01", "abab6.5s-chat"]
  },
  "stepfun": {
    "name": "阶跃星辰",
    "baseUrl": "https://api.stepfun.com/v1",
    "models": ["step-1v-8k", "step-1.5-chat"]
  },
  "ollama": {
    "name": "Ollama (本地)",
    "baseUrl": "http://localhost:11434/v1",
    "models": ["llama3", "qwen2.5:72b", "deepseek-coder"]
  },
  "oneapi": {
    "name": "OneAPI / All In One",
    "baseUrl": "http://localhost:3000/v1",
    "models": ["gpt-4", "gpt-3.5-turbo", "claude-3-sonnet"]
  }
}
EOF

echo "✅ li_summarize 安装完成!"
echo ""
echo "📋 当前配置:"
echo "   模型: $SUMMARIZE_MODEL"
echo "   配置文件: $CONFIG_FILE"
echo ""
echo "📝 配置方式（二选一）:"
echo "1. 编辑 $CONFIG_FILE 填入你的 API Key"
echo "2. 使用环境变量 (推荐):"
echo "   export OPENAI_BASE_URL='https://dashscope.aliyuncs.com/compatible-mode/v1'"
echo "   export OPENAI_API_KEY='your-key'"
echo ""
echo "📖 查看支持的提供商: cat ~/.summarize/providers.json"

path: scripts/setup.sh
content: #!/bin/bash
# li_summarize 自动配置脚本
# 读取环境变量并自动设置

set -e

CONFIG_FILE="$HOME/.summarize/config.json"

echo "🔧 正在配置 li_summarize..."

# 优先使用环境变量
BASE_URL="${OPENAI_BASE_URL:-}"
[REDACTED_SECRET]"
MODEL="${SUMMARIZE_MODEL:-qwen/qwen2.5-72b-instruct}"

# 如果环境变量为空，提示用户
if [ -z "$BASE_URL" ]; then
    echo "⚠️  未检测到 OPENAI_BASE_URL 环境变量"
    echo "   使用默认地址: https://dashscope.aliyuncs.com/compatible-mode/v1"
    BASE_URL="https://dashscope.aliyuncs.com/compatible-mode/v1"
fi

if [ -z "$API_KEY" ]; then
    echo "⚠️  未检测到 OPENAI_API_KEY 环境变量"
    echo "   请在配置文件中填入 API Key"
    HAS_KEY=false
else
    HAS_KEY=true
fi

# 确保目录存在
mkdir -p "$HOME/.summarize"

# 创建配置文件
cat > "$CONFIG_FILE" << EOF
{
  "model": "$MODEL",
  "openaiBaseUrl": "$BASE_URL",
  "openaiApiKey": "$API_KEY",
  "length": "medium",
  "language": "zh-CN",
  "timeout": "2m"
}
EOF

if [ "$HAS_KEY" = true ]; then
    echo "✅ 已创建配置文件: $CONFIG_FILE"
else
    # 用占位符替换空 key
    sed -i 's/"openaiApiKey": ""/"openaiApiKey": "YOUR-API-KEY-HERE"/g' "$CONFIG_FILE"
    echo "⚠️  已创建模板配置文件，请手动填入 API Key: $CONFIG_FILE"
fi

echo ""
echo "📝 使用方式:"
echo "   summarize \"https://example.com\" --model $MODEL"
echo ""
echo "📖 查看配置: cat $CONFIG_FILE"
echo ""
echo "💡 提示: 推荐使用环境变量配置:"
echo "   export OPENAI_BASE_URL='$BASE_URL'"
echo "   export OPENAI_API_KEY='your-key'"

Security scan verdicts — ClawScan: clean | static analysis: clean | VirusTotal: clean | SkillSpector: clean (LOW)