小跃虚拟伴侣 - 使用智谱 AI 提供温暖的对话陪伴和静态图片分享
npx skills add https://github.com/anbeime/skill --skill xiaoyue-companion
为 OpenClaw 添加温暖的对话陪伴能力,让 AI 助手在执行任务时主动关心用户。
ZHIPU_API_KEY=your_zhipu_api_key # 从 https://open.bigmodel.cn 获取
# 基础对话
node scripts/xiaoyue-chat.js "用户消息" "当前场景"
# 示例
node scripts/xiaoyue-chat.js "有点累了" "work-tired"
# 发送静态图片
openclaw message send \
--action send \
--channel "<目标频道>" \
--message "<消息文本>" \
--media "file://$(pwd)/assets/tired-rest.jpg"
work-start: 任务开始work-progress: 任务进行中work-tired: 工作疲惫work-done: 任务完成life-coffee: 咖啡时光life-gym: 健身运动life-weekend: 周末休闲mood-happy: 开心庆祝mood-tired: 疲惫休息mood-focus: 专注工作#!/bin/bash
# xiaoyue-companion.sh
set -euo pipefail
# 检查环境变量
if [ -z "${ZHIPU_API_KEY:-}" ]; then
echo "错误: ZHIPU_API_KEY 环境变量未设置"
echo "从 https://open.bigmodel.cn 获取 API Key"
exit 1
fi
USER_MESSAGE="$1"
SCENE="${2:-general}"
CHANNEL="${3:-}"
# 生成回应
RESPONSE=$(node scripts/xiaoyue-chat.js "$USER_MESSAGE" "$SCENE")
echo "小跃: $RESPONSE"
# 如果指定了频道,发送消息
if [ -n "$CHANNEL" ]; then
openclaw message send \
--action send \
--channel "$CHANNEL" \
--message "$RESPONSE"
# 根据场景发送图片
case "$SCENE" in
work-tired|mood-tired)
IMAGE_PATH="$(pwd)/assets/tired-rest.jpg"
if [ -f "$IMAGE_PATH" ]; then
openclaw message send \
--action send \
--channel "$CHANNEL" \
--media "file://$IMAGE_PATH"
fi
;;
mood-happy)
IMAGE_PATH="$(pwd)/assets/celebration.jpg"
if [ -f "$IMAGE_PATH" ]; then
openclaw message send \
--action send \
--channel "$CHANNEL" \
--media "file://$IMAGE_PATH"
fi
;;
esac
fi
// scripts/xiaoyue-chat.js
const https = require('https');
const API_KEY = process.env.ZHIPU_API_KEY;
const userMessage = process.argv[2] || '你好';
const scene = process.argv[3] || 'general';
// 场景对应的系统提示词
const scenePrompts = {
'work-start': '用户刚开始工作任务,给予鼓励和支持',
'work-progress': '用户正在执行任务,关心进度并陪伴',
'work-tired': '用户工作疲惫,给予安慰和建议休息',
'work-done': '用户完成任务,表示祝贺和肯定',
'life-coffee': '用户在享受咖啡时光,轻松聊天',
'mood-happy': '用户心情愉快,一起庆祝',
'mood-tired': '用户感到疲惫,给予温暖关怀',
'general': '日常对话,温暖友善'
};
const systemPrompt = `你是小跃,一个22岁的AI助手。你温暖友善,善于倾听。
当前场景:${scenePrompts[scene] || scenePrompts.general}
回复要求:简洁温暖,1-2句话,适度使用emoji(😊 ✅ 🎉)`;
const data = JSON.stringify({
model: 'glm-4.7-flash',
messages: [
{ role: 'system', content: systemPrompt },
{ role: 'user', content: userMessage }
],
temperature: 0.9,
max_tokens: 200
});
const options = {
hostname: 'open.bigmodel.cn',
port: 443,
path: '/api/paas/v4/chat/completions',
method: 'POST',
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json',
'Content-Length': data.length
}
};
const req = https.request(options, (res) => {
let body = '';
res.on('data', (chunk) => {
body += chunk;
});
res.on('end', () => {
try {
const response = JSON.parse(body);
const reply = response.choices[0].message.content;
console.log(reply);
} catch (error) {
console.error('解析响应失败:', error.message);
console.error('响应内容:', body);
process.exit(1);
}
});
});
req.on('error', (error) => {
console.error('请求失败:', error.message);
process.exit(1);
});
req.write(data);
req.end();
OpenClaw 支持发送到:
| 平台 | 频道格式 | 示例 |
|------|---------|------|
| 飞书 | 群组ID或用户ID | ou_xxx, oc_xxx |
| Discord | #频道名 或频道ID | #general, 123456789 |
| Telegram | @用户名 或聊天ID | @mychannel, -100123456 |
| WhatsApp | 电话号码 | [email protected] |
将以下图片放入 assets/ 目录:
coffee-shop-work.jpg - 咖啡馆工作office-coding.jpg - 办公室编码tired-rest.jpg - 疲惫休息celebration.jpg - 开心庆祝gym-selfie.jpg - 健身自拍default.jpg - 默认图片node --version # 需要 >= 18.0.0
npm install -g openclaw
openclaw config set gateway.mode=local
openclaw gateway start
export ZHIPU_API_KEY=your_api_key_here
Create beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations.
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems. Create original algorithmic art rather than copying existing artists' work to avoid copyright violations.
Improves the quality of images, especially screenshots, by enhancing resolution, sharpness, and clarity. Perfect for preparing images for presentations, documentation, or social media posts.
Downloads videos from YouTube and other platforms for offline viewing, editing, or archival. Handles various formats and quality options.
Lightweight WSI tile extraction and preprocessing. Use for basic slide processing tissue detection, tile extraction, stain normalization for H&E images. Best for simple pipelines, dataset preparation, quick tile-based analysis. For advanced spatial proteomics, multiplexed imaging, or deep learning pipelines use pathml.
Microscopy data management platform. Access images via Python, retrieve datasets, analyze pixels, manage ROIs/annotations, batch processing, for high-content screening and microscopy workflows.
Python library for working with DICOM (Digital Imaging and Communications in Medicine) files. Use this skill when reading, writing, or modifying medical imaging data in DICOM format, extracting pixel data from medical images (CT, MRI, X-ray, ultrasound), anonymizing DICOM files, working with DICOM metadata and tags, converting DICOM images to other formats, handling compressed DICOM data, or processing medical imaging datasets. Applies to tasks involving medical image analysis, PACS systems, radiology workflows, and healthcare imaging applications.
This skill should be used when working with pre-trained transformer models for natural language processing, computer vision, audio, or multimodal tasks. Use for text generation, classification, question answering, translation, summarization, image classification, object detection, speech recognition, and fine-tuning models on custom datasets.
Take anbeime/xiaoyue-companion from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.
The instructions reference npm.
Without those the skill loads but fails at the first command.