- 前端: React+Vite 首页/AI专区, 算法库(MARD色板/量化/背景去除), API对接 - 后端: Express+SQLite, 兑换码/订单/支付/chibi生成, 风控+云端同步 - CI/CD: GitHub Actions + Docker + nginx 配置 - 文档: PRD/DESIGN/LAUNCH/ROADMAP/E2E/竞品对照等 15 份 - 工程: 任务看板(taskboard) + 健康巡检(agent-health) + Git流程(gitflow)
192 lines
7.2 KiB
TypeScript
192 lines
7.2 KiB
TypeScript
/**
|
||
* chibi AI 拼豆提示词模板库
|
||
*
|
||
* 5 大类 × 3 细分 = 15 套模板,参数来自竞品逆向(copy-library.md):
|
||
* - 分类: 风景/人物/宠物/物品/食物
|
||
* - 参数: gridSize 48/64/80/96 · colorCount 16/24/32/40 · 构图 3 种
|
||
*/
|
||
|
||
export type ChibiCategory = "landscape" | "person" | "pet" | "object" | "food";
|
||
export type Composition = "主体特写" | "半幅构图" | "完整构图";
|
||
|
||
export interface ChibiTemplate {
|
||
category: ChibiCategory;
|
||
categoryName: string;
|
||
subtype: string;
|
||
subtypeName: string;
|
||
note: string;
|
||
basePrompt: string;
|
||
negativePrompt: string;
|
||
styleHint: string;
|
||
}
|
||
|
||
export interface BuildPromptOptions {
|
||
category: ChibiCategory;
|
||
subtype: string;
|
||
gridSize: number;
|
||
colorCount: number;
|
||
composition: Composition;
|
||
detailTags: string[];
|
||
customPrompt?: string;
|
||
hasReferenceImage?: boolean;
|
||
}
|
||
|
||
/** 像素拼豆风格通用前缀 */
|
||
const PIXEL_STYLE = "像素拼豆风格,色块分明,颗粒感强,马赛克效果";
|
||
|
||
/** 通用负面提示词 */
|
||
const NEGATIVE_DEFAULT =
|
||
"模糊,噪点,文字,水印,多手指,变形,复杂渐变,高光溢出,照片写实";
|
||
|
||
/** 15 套模板 */
|
||
export const TEMPLATES: ChibiTemplate[] = [
|
||
// ---------- 风景 ----------
|
||
{
|
||
category: "landscape", categoryName: "风景", subtype: "nature", subtypeName: "自然山川",
|
||
note: "山川、森林、河流",
|
||
basePrompt: "自然风景,山川森林河流,层次分明,构图大气",
|
||
negativePrompt: NEGATIVE_DEFAULT + ",人物,杂乱线条",
|
||
styleHint: "风景默认像素拼豆风",
|
||
},
|
||
{
|
||
category: "landscape", categoryName: "风景", subtype: "city", subtypeName: "城市夜景",
|
||
note: "霓虹、地标、灯火",
|
||
basePrompt: "城市夜景,霓虹灯光,地标建筑,冷暖对比",
|
||
negativePrompt: NEGATIVE_DEFAULT + ",过曝灯光,车流拖影",
|
||
styleHint: "城市夜景霓虹风",
|
||
},
|
||
{
|
||
category: "landscape", categoryName: "风景", subtype: "landmark", subtypeName: "地标建筑",
|
||
note: "知名建筑与天际线",
|
||
basePrompt: "地标建筑特写,轮廓清晰,比例准确",
|
||
negativePrompt: NEGATIVE_DEFAULT + ",透视畸变",
|
||
styleHint: "地标纪念风",
|
||
},
|
||
// ---------- 人物 ----------
|
||
{
|
||
category: "person", categoryName: "人物", subtype: "big-eye", subtypeName: "萌系大眼",
|
||
note: "大眼、圆脸、粗轮廓",
|
||
basePrompt: "萌系动漫人物,大眼圆脸,粗轮廓线条,可爱风格",
|
||
negativePrompt: NEGATIVE_DEFAULT + ",写实五官",
|
||
styleHint: "萌系大眼动漫风",
|
||
},
|
||
{
|
||
category: "person", categoryName: "人物", subtype: "youth", subtypeName: "清爽少年",
|
||
note: "自然五官、利落穿搭",
|
||
basePrompt: "清爽少年形象,自然五官,利落穿搭,干净背景",
|
||
negativePrompt: NEGATIVE_DEFAULT,
|
||
styleHint: "清爽少年风",
|
||
},
|
||
{
|
||
category: "person", categoryName: "人物", subtype: "retro", subtypeName: "复古像素",
|
||
note: "怀旧配色、游戏感",
|
||
basePrompt: "复古像素游戏风格人物,怀旧配色,8-bit 质感",
|
||
negativePrompt: NEGATIVE_DEFAULT + ",现代写实",
|
||
styleHint: "复古 8-bit 游戏风",
|
||
},
|
||
// ---------- 宠物 ----------
|
||
{
|
||
category: "pet", categoryName: "宠物", subtype: "cat", subtypeName: "猫咪头像",
|
||
note: "圆润脸型与花纹",
|
||
basePrompt: "猫咪头像特写,圆润脸型,花纹清晰,眼睛有神",
|
||
negativePrompt: NEGATIVE_DEFAULT + ",多只猫,全身",
|
||
styleHint: "宠物默认像素拼豆风",
|
||
},
|
||
{
|
||
category: "pet", categoryName: "宠物", subtype: "dog", subtypeName: "狗狗全身",
|
||
note: "耳朵、四肢和毛色",
|
||
basePrompt: "狗狗全身像,耳朵四肢完整,毛色层次分明",
|
||
negativePrompt: NEGATIVE_DEFAULT + ",多只狗",
|
||
styleHint: "狗狗全身像素风",
|
||
},
|
||
{
|
||
category: "pet", categoryName: "宠物", subtype: "duo", subtypeName: "双宠互动",
|
||
note: "两只宠物同框",
|
||
basePrompt: "两只宠物同框互动,姿态自然,主次分明",
|
||
negativePrompt: NEGATIVE_DEFAULT + ",肢体重叠遮挡",
|
||
styleHint: "双宠互动像素风",
|
||
},
|
||
// ---------- 物品 ----------
|
||
{
|
||
category: "object", categoryName: "物品", subtype: "toy", subtypeName: "手办玩具",
|
||
note: "造型轮廓优先",
|
||
basePrompt: "手办玩具,造型轮廓优先,还原特征细节",
|
||
negativePrompt: NEGATIVE_DEFAULT + ",塑料反光过强",
|
||
styleHint: "手办造型像素风",
|
||
},
|
||
{
|
||
category: "object", categoryName: "物品", subtype: "daily", subtypeName: "生活用品",
|
||
note: "保留结构与材质",
|
||
basePrompt: "生活用品,结构清晰,材质质感还原",
|
||
negativePrompt: NEGATIVE_DEFAULT + ",变形扭曲",
|
||
styleHint: "生活用品像素风",
|
||
},
|
||
{
|
||
category: "object", categoryName: "物品", subtype: "gift", subtypeName: "礼物纪念",
|
||
note: "突出包装和装饰",
|
||
basePrompt: "礼物纪念品,包装装饰突出,喜庆完整",
|
||
negativePrompt: NEGATIVE_DEFAULT + ",包装破损",
|
||
styleHint: "礼物纪念像素风",
|
||
},
|
||
// ---------- 食物 ----------
|
||
{
|
||
category: "food", categoryName: "食物", subtype: "dessert", subtypeName: "甜品蛋糕",
|
||
note: "奶油与装饰清晰",
|
||
basePrompt: "甜品蛋糕,奶油与装饰清晰,诱人色泽",
|
||
negativePrompt: NEGATIVE_DEFAULT + ",融化变形",
|
||
styleHint: "甜品像素风",
|
||
},
|
||
{
|
||
category: "food", categoryName: "食物", subtype: "drink", subtypeName: "咖啡饮品",
|
||
note: "杯型、分层和配料",
|
||
basePrompt: "咖啡饮品,杯型正确,分层与配料清晰",
|
||
negativePrompt: NEGATIVE_DEFAULT + ",杯型变形",
|
||
styleHint: "饮品像素风",
|
||
},
|
||
{
|
||
category: "food", categoryName: "食物", subtype: "meal", subtypeName: "家常美食",
|
||
note: "主食材清晰可辨",
|
||
basePrompt: "家常美食,主食材清晰可辨,色彩饱满",
|
||
negativePrompt: NEGATIVE_DEFAULT + ",食材混杂难辨",
|
||
styleHint: "家常美食像素风",
|
||
},
|
||
];
|
||
|
||
/** 按分类+细分查找模板 */
|
||
export function findTemplate(category: ChibiCategory, subtype: string): ChibiTemplate {
|
||
const t = TEMPLATES.find(
|
||
(x) => x.category === category && x.subtype === subtype,
|
||
);
|
||
if (!t) {
|
||
throw new Error(`未知的拼豆模板: ${category}/${subtype}`);
|
||
}
|
||
return t;
|
||
}
|
||
|
||
/** 组装最终提示词 */
|
||
export function buildPrompt(options: BuildPromptOptions): string {
|
||
const t = findTemplate(options.category, options.subtype);
|
||
const grid = options.gridSize;
|
||
const colors = options.colorCount;
|
||
const comp = options.composition;
|
||
const tags = options.detailTags.slice(0, 5); // 最多 5 项
|
||
|
||
const parts: string[] = [
|
||
t.basePrompt,
|
||
PIXEL_STYLE,
|
||
`${grid}×${grid} 网格`,
|
||
`最多 ${colors} 色`,
|
||
`主体${comp}`,
|
||
];
|
||
if (tags.length) parts.push(`细节要求:${tags.join("、")}`);
|
||
if (options.customPrompt?.trim()) parts.push(options.customPrompt.trim());
|
||
if (options.hasReferenceImage) parts.push("参考示例风格(不复制示例主体)");
|
||
|
||
return parts.join(",");
|
||
}
|
||
|
||
/** 组装负面提示词 */
|
||
export function buildNegativePrompt(category: ChibiCategory, subtype: string): string {
|
||
return findTemplate(category, subtype).negativePrompt;
|
||
}
|