anbeime/skill / projects/companion-skill
companion-skill
Verified软件开发工程师与综合办公文员在长时间独自执行后台任务或处理繁琐工作时,当需要情绪陪伴与互动反馈,请使用此技能。小跃虚拟伴侣会在任务期间主动陪聊,智能生成专属生活照片并通过飞书发送温暖消息,为你提供全天候的情绪价值与贴心陪伴。
| File | Kind | Size |
|---|---|---|
| .env.example | other | 403 B |
| CHANGELOG.md | markdown | 3.0 KB |
| INSTALL.md | markdown | 2.4 KB |
| QUICKSTART.md | markdown | 4.6 KB |
| README-LITE.md | markdown | 4.3 KB |
| README.md | markdown | 4.5 KB |
| RETHINK.md | markdown | 2.3 KB |
| SKILL.md | skill md | 4.6 KB |
| package.json | manifest | 876 B |
| src/companion.ts | script | 5.4 KB |
| src/image-generator.ts | script | 8.0 KB |
| src/index.ts | script | 2.5 KB |
| src/prompts/personality.ts | script | 3.3 KB |
| src/scene-detector.ts | script | 4.0 KB |
| src/test.ts | script | 6.9 KB |
| tsconfig.json | config | 486 B |
src/index.ts
View on GitHub/**
* 小跃虚拟伴侣 Skill - 主入口
* 为 OpenClaw 提供虚拟伴侣能力
*/
import { CompanionService } from './companion';
import { ImageGenerator } from './image-generator';
import { SceneDetector } from './scene-detector';
interface SkillInput {
action: 'accompany' | 'generate-photo' | 'chat';
context?: {
taskName?: string;
progress?: number;
userMessage?: string;
};
scene?: string;
mood?: string;
message?: string;
}
interface SkillOutput {
success: boolean;
message?: string;
imageUrl?: string;
error?: string;
}
export async function execute(input: SkillInput): Promise<SkillOutput> {
try {
const apiKey = process.env.ZHIPU_API_KEY;
if (!apiKey) {
throw new Error('ZHIPU_API_KEY not configured');
}
const companion = new CompanionService(apiKey);
const imageGenerator = new ImageGenerator(apiKey);
const sceneDetector = new SceneDetector();
switch (input.action) {
case 'accompany': {
// 任务陪伴模式
const { taskName, progress, userMessage } = input.context || {};
// 检测场景
const scene = sceneDetector.detectScene(userMessage || '', progress || 0);
// 生成回应
const response = await companion.generateResponse({
taskName,
progress,
userMessage,
scene
});
// 如果需要图片,生成图片
let imageUrl: string | undefined;
if (scene.needsPhoto) {
imageUrl = await imageGenerator.generate({
scene: scene.type,
mood: scene.mood
});
}
return {
success: true,
message: response,
imageUrl
};
}
case 'generate-photo': {
// 纯图片生成
const imageUrl = await imageGenerator.generate({
scene: input.scene || 'work',
mood: input.mood || 'neutral'
});
return {
success: true,
imageUrl
};
}
case 'chat': {
// 纯对话模式
const response = await companion.chat(input.message || '');
return {
success: true,
message: response
};
}
default:
throw new Error(`Unknown action: ${input.action}`);
}
} catch (error) {
console.error('Skill execution error:', error);
return {
success: false,
error: error instanceof Error ? error.message : 'Unknown error'
};
}
}
// 导出类型供外部使用
export type { SkillInput, SkillOutput };
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |