feat: 初始化画个标仓库 - AI驱动设计系统(BYOK模式) - 224源/371504图标+25海报源+130技能

This commit is contained in:
sgp
2026-10-03 21:44:18 +08:00
commit 9e222877ea
497 changed files with 43611 additions and 0 deletions
+48
View File
@@ -0,0 +1,48 @@
/**
* 画个标 · 表情技能资源库(核心:注册表 + 通用工具)
* 表情专属技能(动态表情/贴纸),主分类 motion(动画),统一 workspaces:['emoji']
*
* 与共享技能库(HGB_Skills)/ 海报技能库(HGB_PosterSkills)的关系:
* - 复用:共享技能库的构图/配色等通用技能跨工作区复用
* - 区分:本库收录表情专属技能(动画节奏/物理/循环/体积/平台等)
* 每个技能标准化字段:id / name / category / emoji / scene / summary / params / source / run / test
*/
const HGB_StickerSkills = (function () {
'use strict';
const skills = [];
const DEFAULT_WORKSPACES = ['emoji'];
function register(defs) {
for (const d of (defs || [])) skills.push(d);
return skills.length;
}
function all() { return skills; }
function categories() {
const map = {};
for (const s of skills) map[s.category] = (map[s.category] || 0) + 1;
return Object.entries(map).map(([id, count]) => ({ id, count }));
}
function get(id) { return skills.find(s => s.id === id) || null; }
function run(id, args) {
const s = get(id);
if (!s) return { error: '表情技能不存在: ' + id };
try { return s.run(args || {}); }
catch (e) { return { error: '表情技能执行失败: ' + e.message }; }
}
function test(id) {
const s = get(id);
if (!s) return { error: '表情技能不存在: ' + id };
try { return s.test ? s.test() : { note: '该技能未提供自测' }; }
catch (e) { return { error: '表情技能自测失败: ' + e.message }; }
}
function workspacesOf(id) {
const s = get(id);
return (s && s.workspaces) || DEFAULT_WORKSPACES;
}
function forWorkspace(ws) {
return skills.filter(s => workspacesOf(s.id).includes(ws));
}
return { register, all, categories, get, run, test, workspacesOf, forWorkspace };
})();