From 1eabe70e43be95cc94d3fac1b49b0748562bbff0 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 8 Oct 2026 18:20:21 +0000 Subject: [PATCH 1/5] feat(avatar): dress elves, dwarves and orcs and grow talking flowers The Avatar editor offers elf, dwarf, orc and flower species, a beard tab, armor/robe/tunic/cloak outfits, helmet/hood headwear, and a flower's petals and base. Tabs for choices the current species or headwear keeps but does not show display a note instead of discarding them; petals and base appear only for a flower, beards for everyone else. Random covers every species, beards and flower parts. Requires @botharness/pixel-avatar 0.4.0 (dependency bump follows its release). Issue: #1212 Issue: #1213 Agent-Task: claude/cloud/session_01MozvQ2eMvqX1MzSqm9G2o8 Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01MozvQ2eMvqX1MzSqm9G2o8 --- CHANGELOG.md | 2 + CHANGELOG.zh.md | 2 + .../src/client/avatar-appearance-editor.tsx | 66 ++++++++++++++-- packages/client/src/client/locale.ts | 51 ++++++++++++ packages/client/src/client/styles.ts | 2 + .../test/avatar-appearance-editor.test.ts | 79 +++++++++++++++++++ packages/core/src/bots/avatar-appearance.ts | 3 + 7 files changed, 198 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5eb73e4b0c..68a058f0a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,8 @@ WeChat original voice can be prepared for playback, native quotes and retained l ### Added +- Pixel Avatars can be an elf, dwarf, orc or talking flower. Beards always leave the speaking mouth visible. Armor, robe, tunic and cloak outfits are available, and a helmet or hood hides the hair underneath. Flowers have bead eyes, five petal styles and a stem or pot. Choices a species or headwear doesn't show stay saved, with a note, and return when switched back ([#1212](https://github.com/BotHarness/DeepSeekBot/issues/1212), [#1213](https://github.com/BotHarness/DeepSeekBot/issues/1213)). + - Pixel Avatars can be a goblin, with pointed ears through the hair, small tusks and suggested green skin, and left and right side hair can each have their own style and color; the goblin keeps head turns and speaking mouths in Window Companions, random covers both species, and existing Avatars render unchanged ([#1210](https://github.com/BotHarness/DeepSeekBot/issues/1210), [ADR-0148](docs/adr/0148-avatar-species-and-custom-parts-extend-one-pixel-rig.md)). - The welcome now offers a daily evening check-in at 21:00 with the browser time zone and current DM shown before selection; missing time zones are confirmed first, and existing model setup retains the complete request for explicit sending ([#1228](https://github.com/BotHarness/DeepSeekBot/issues/1228)). diff --git a/CHANGELOG.zh.md b/CHANGELOG.zh.md index 46bbd6ee96..48d2d5f2d5 100644 --- a/CHANGELOG.zh.md +++ b/CHANGELOG.zh.md @@ -17,6 +17,8 @@ ### Added +- 像素头像新增精灵、矮人、兽人和会说话的花。胡子始终露出说话的嘴,新增盔甲、法袍、束腰外衣和斗篷,戴上头盔或兜帽会遮住下面的头发。花有豆豆眼、五种花瓣样式,以及茎叶或花盆。当前物种或头饰不显示的选择会保留并给出提示,换回后恢复([#1212](https://github.com/BotHarness/DeepSeekBot/issues/1212)、[#1213](https://github.com/BotHarness/DeepSeekBot/issues/1213))。 + - 像素头像可以选择哥布林:尖耳朵穿出头发、带小獠牙、配建议的绿色肤色;左右侧发可以分别选择样式和颜色。哥布林在 Window Companion 中同样支持转头和说话嘴型,随机也会覆盖两个物种,已有头像渲染不变([#1210](https://github.com/BotHarness/DeepSeekBot/issues/1210)、[ADR-0148](docs/adr/0148-avatar-species-and-custom-parts-extend-one-pixel-rig.md))。 - 欢迎消息提供每天 21:00 的晚间问候示例,选择前显示浏览器时区与当前私聊;无法识别时区时先询问,既有模型配置流程保留完整请求并等待明确发送([#1228](https://github.com/BotHarness/DeepSeekBot/issues/1228))。 diff --git a/packages/client/src/client/avatar-appearance-editor.tsx b/packages/client/src/client/avatar-appearance-editor.tsx index e7022e05d1..79b1ea8d03 100644 --- a/packages/client/src/client/avatar-appearance-editor.tsx +++ b/packages/client/src/client/avatar-appearance-editor.tsx @@ -2,14 +2,17 @@ import { useMemo, useState, type ReactElement } from 'react'; import { AVATAR_COLORS, AVATAR_FAMILIES, + AVATAR_EXTRA_PARTS, AVATAR_HAIR_PARTS, AVATAR_PARTS, + AVATAR_PARTS_V2, AVATAR_PIECE_COLORS, AVATAR_PRESETS, AVATAR_RANGES, AVATAR_SPECIES, AVATAR_SPECIES_SWATCHES, detailedAvatarRecipe, + hiddenAvatarChoices, type IllustratedAvatarRecipe, AVATAR_SWATCHES, withAvatarSpecies, @@ -50,9 +53,12 @@ const FAMILIES: Record = { illustrated: { parts: { species: AVATAR_SPECIES, - ...AVATAR_PARTS, + ...AVATAR_PARTS_V2, ...AVATAR_HAIR_PARTS, rightSideHair: AVATAR_HAIR_PARTS.sideHair, + beard: ['none', ...AVATAR_EXTRA_PARTS.beard], + petals: AVATAR_EXTRA_PARTS.petals, + flowerBase: AVATAR_EXTRA_PARTS.flowerBase, }, colors: [...AVATAR_COLORS, ...AVATAR_PIECE_COLORS], swatches: { @@ -70,7 +76,10 @@ const FAMILIES: Record = { 'sideHair', 'rightSideHair', 'backHair', + 'petals', + 'flowerBase', ...Object.keys(AVATAR_PARTS).filter((part) => part !== 'backdrop' && part !== 'hair'), + 'beard', 'shape', 'colors', ], @@ -98,14 +107,28 @@ const FAMILIES: Record = { type Fields = Record; const DETAIL = new Set([...Object.keys(AVATAR_HAIR_PARTS), ...Object.keys(AVATAR_RANGES)]); -const SPLIT = new Set(['species', 'sideHair', 'rightSideHair', ...AVATAR_PIECE_COLORS]); +const EXTRAS = new Set(Object.keys(AVATAR_EXTRA_PARTS)); +const SPLIT = new Set([ + 'species', + 'sideHair', + 'rightSideHair', + ...AVATAR_PIECE_COLORS, + ...EXTRAS, +]); +const V2_ONLY = (part: string, value: string | number) => + (part === 'outfit' || part === 'accessory') && + !(AVATAR_PARTS[part] as readonly (string | number)[]).includes(value); function withPart(recipe: AvatarRecipe, key: string, value: string | number): AvatarRecipe { if (recipe.family !== 'illustrated') return { ...(recipe as unknown as Fields), [key]: value } as unknown as AvatarRecipe; if (key === 'species') return withAvatarSpecies(recipe, value as IllustratedAvatarRecipe['species'] & string); - if (SPLIT.has(key)) + if (EXTRAS.has(key) && value === 'none') { + const { [key]: _removed, ...rest } = recipe as unknown as Fields; + return rest as unknown as AvatarRecipe; + } + if (SPLIT.has(key) || V2_ONLY(key, value)) return { ...withAvatarSpecies(recipe, recipe.species ?? 'human'), [key]: value, @@ -143,12 +166,36 @@ function shuffled(recipe: AvatarRecipe): AvatarRecipe { const species = pick(AVATAR_SPECIES); const random = withAvatarSpecies(next as unknown as IllustratedAvatarRecipe, species); for (const color of AVATAR_PIECE_COLORS) delete random[color]; + for (const extra of EXTRAS) delete random[extra as keyof typeof random]; + const beard = pick(['none', ...AVATAR_EXTRA_PARTS.beard] as const); return { ...random, sideHair: pick(AVATAR_HAIR_PARTS.sideHair), rightSideHair: pick(AVATAR_HAIR_PARTS.sideHair), skinColor: pick(AVATAR_SPECIES_SWATCHES[species]), - }; + ...(species === 'flower' + ? { + petals: pick(AVATAR_EXTRA_PARTS.petals), + flowerBase: pick(AVATAR_EXTRA_PARTS.flowerBase), + } + : beard === 'none' + ? {} + : { beard }), + } as IllustratedAvatarRecipe; +} + +function categoriesFor(spec: FamilySpec, recipe: AvatarRecipe | undefined): readonly string[] { + if (recipe?.family !== 'illustrated') return spec.categories; + const flower = recipe.species === 'flower'; + return spec.categories.filter((key) => + key === 'petals' || key === 'flowerBase' ? flower : key === 'beard' ? !flower : true, + ); +} + +function hiddenFor(recipe: AvatarRecipe | undefined, category: string): boolean { + if (recipe?.family !== 'illustrated') return false; + const hidden = hiddenAvatarChoices(recipe); + return hidden.includes(category) || (category === 'hair' && hidden.includes('bangs')); } function swatchesFor(spec: FamilySpec, fields: Fields, key: string): readonly string[] { @@ -369,7 +416,7 @@ export function AvatarAppearanceEditor({
- {spec.categories.map((key) => ( + {categoriesFor(spec, draft).map((key) => (