feat(pet): integrate attributed pixel sprite pack
这个提交存在于:
父节点
68614824c0
当前提交
6adf752c3a
共有 8 个文件被更改,包括 92 次插入 和 15 次删除
|
|
@ -143,6 +143,7 @@ otification`、`offline`。
|
|||
- 2D 纸片人桌宠已从 manifest 基础推进到可运行窗口:透明、无边框、跳过任务栏、关闭后回托盘,并预留状态动作循环。
|
||||
- JWT 运行时已支持 `exp` 过期识别、401/403 状态映射和聊天界面重新登录提示。
|
||||
- 桌宠窗口已接入双槽位运行状态:连接中工作、重连回应、断开休息、认证过期/致命错误提示。
|
||||
- 已接入 `aemeath_withclaude-2.0.8` 的 MIT 像素素材;保留来源署名,并将 spritesheet 动作行映射到当前桌宠状态。
|
||||
|
||||
- 不复制 Hermes 或 Codex 的私有实现;只参考交互模式和资源组织方式。
|
||||
- 不在首轮实现 Live2D、Spine、3D 桌宠或用户脚本插件。
|
||||
|
|
|
|||
|
|
@ -199,4 +199,11 @@ Still not claimed complete: automatic startup activation, real Tauri multi-windo
|
|||
- AstrBot 401/403 responses during probe or chat now preserve the affected slot and expose an `authExpired` runtime error.
|
||||
- Chat UI shows a re-login warning for the affected slot; credentials remain managed by Windows Credential Manager.
|
||||
- The floating 2D pet now polls the dual-slot runtime and switches between idle, work, reply, rest, and error states instead of running an isolated demo loop.
|
||||
|
||||
## 2026-07-20: Aemeath pixel sprite integration
|
||||
|
||||
- Reviewed `aemeath_withclaude-2.0.8`; the supplied repository and referenced pixel asset are MIT-licensed, not CC-licensed.
|
||||
- Added the original 8-column, 192x208-frame WebP spritesheet as a project-local pet asset with preserved attribution.
|
||||
- Added a validated pet manifest and mapped the source animation rows into idle, thinking, speaking, notification, error, and offline states.
|
||||
- Replaced the CSS placeholder character in the floating pet view with the real pixel spritesheet renderer.
|
||||
- Validation: Rust workspace tests (65), Clippy, TypeScript, ESLint, Vitest (6), and Vite build pass.
|
||||
|
|
|
|||
51
src/App.tsx
51
src/App.tsx
|
|
@ -21,6 +21,19 @@ const initialStatus: BootstrapStatus = {
|
|||
databaseSchemaVersion: 4,
|
||||
};
|
||||
|
||||
const AEMEATH_SPRITESHEET = new URL(
|
||||
"./features/pet/assets/aemeath/aemeath-spritesheet.webp",
|
||||
import.meta.url,
|
||||
).href;
|
||||
|
||||
const AEMEATH_FRAMES: Record<"idle" | "working" | "resting" | "speaking" | "error", number[]> = {
|
||||
idle: [0, 1, 2, 3, 4, 5],
|
||||
working: [80, 81, 82, 83, 84, 85, 86, 87, 104, 105, 106, 107, 108, 109, 110, 111],
|
||||
resting: [48, 49, 50, 51, 52, 53],
|
||||
speaking: [72, 73, 74, 75, 76, 77, 78, 79],
|
||||
error: [40, 41, 42, 43, 44, 45, 46, 47],
|
||||
};
|
||||
|
||||
const navigation: Array<{ key: PageKey; label: string; description: string }> =
|
||||
[
|
||||
{ key: "chat", label: "聊天", description: "陪伴与运维对话" },
|
||||
|
|
@ -392,6 +405,7 @@ function PetPage() {
|
|||
|
||||
function DesktopPetView() {
|
||||
const [state, setState] = useState<"idle" | "working" | "resting" | "speaking" | "error">("idle");
|
||||
const [frameIndex, setFrameIndex] = useState(0);
|
||||
|
||||
useEffect(() => {
|
||||
let cancelled = false;
|
||||
|
|
@ -429,6 +443,19 @@ function DesktopPetView() {
|
|||
};
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
setFrameIndex(0);
|
||||
const frames = AEMEATH_FRAMES[state];
|
||||
const timer = window.setInterval(() => {
|
||||
setFrameIndex((current) => (current + 1) % frames.length);
|
||||
}, state === "resting" ? 180 : 125);
|
||||
return () => window.clearInterval(timer);
|
||||
}, [state]);
|
||||
|
||||
const frame = AEMEATH_FRAMES[state][frameIndex % AEMEATH_FRAMES[state].length];
|
||||
const frameRow = Math.floor(frame / 8);
|
||||
const frameColumn = frame % 8;
|
||||
|
||||
return (
|
||||
<main className={`pet-window pet-window-${state}`} aria-label="AstrBot 桌宠">
|
||||
<button
|
||||
|
|
@ -439,21 +466,15 @@ function DesktopPetView() {
|
|||
>
|
||||
×
|
||||
</button>
|
||||
<div className="paper-pet" role="img" aria-label={`桌宠状态:${state}`}>
|
||||
<div className="paper-pet-shadow" />
|
||||
<div className="paper-pet-head">
|
||||
<span className="paper-pet-ear left" />
|
||||
<span className="paper-pet-ear right" />
|
||||
<span className="paper-pet-eye left" />
|
||||
<span className="paper-pet-eye right" />
|
||||
<span className="paper-pet-mouth" />
|
||||
</div>
|
||||
<div className="paper-pet-body">
|
||||
<span className="paper-pet-book" />
|
||||
<span className="paper-pet-arm left" />
|
||||
<span className="paper-pet-arm right" />
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
className={`aemeath-pet-sprite aemeath-pet-${state}`}
|
||||
role="img"
|
||||
aria-label={`桌宠状态:${state}`}
|
||||
style={{
|
||||
backgroundImage: `url(${AEMEATH_SPRITESHEET})`,
|
||||
backgroundPosition: `-${frameColumn * 192}px -${frameRow * 208}px`,
|
||||
}}
|
||||
/>
|
||||
<span className="pet-window-status">{state === "working" ? "正在写写画画" : state === "resting" ? "休息中" : state === "speaking" ? "正在回应" : state === "error" ? "需要重新登录或检查连接" : "陪伴中"}</span>
|
||||
</main>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,12 @@
|
|||
# Aemeath Pixel Companion Attribution
|
||||
|
||||
This asset is adapted from the `aemeath_withclaude-2.0.8` project.
|
||||
|
||||
- Pixel sprite source: `lzy-buaa-jdi/ameath`
|
||||
- Source: https://gitee.com/lzy-buaa-jdi/ameath
|
||||
- License: MIT
|
||||
- Upstream project license: MIT License, copyright (c) 2026 sinlatansen
|
||||
|
||||
AstrBot Desktop keeps this attribution with the adapted sprite asset. The
|
||||
character and related visual references remain the property of their respective
|
||||
rights holders; this project does not claim ownership of the character design.
|
||||
二进制文件未显示。
|
之后 宽度: | 高度: | 大小: 560 KiB |
|
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"format": "astrbot-pet-pack.v1",
|
||||
"name": "Aemeath Pixel Companion",
|
||||
"version": "1.0.0",
|
||||
"image": "aemeath-spritesheet.webp",
|
||||
"width": 1536,
|
||||
"height": 3120,
|
||||
"frameWidth": 192,
|
||||
"frameHeight": 208,
|
||||
"columns": 8,
|
||||
"animations": [
|
||||
{ "id": "idle", "state": "idle", "frames": [0, 1, 2, 3, 4, 5], "fps": 6, "loop": true, "movement": "stationary" },
|
||||
{ "id": "thinking", "state": "thinking", "frames": [80, 81, 82, 83, 84, 85, 86, 87, 104, 105, 106, 107, 108, 109, 110, 111], "fps": 8, "loop": true, "movement": "stationary" },
|
||||
{ "id": "speaking", "state": "speaking", "frames": [72, 73, 74, 75, 76, 77, 78, 79], "fps": 8, "loop": true, "movement": "stationary" },
|
||||
{ "id": "notification", "state": "notification", "frames": [24, 25, 26, 27, 32, 33, 34, 35], "fps": 7, "loop": true, "movement": "stationary" },
|
||||
{ "id": "error", "state": "error", "frames": [40, 41, 42, 43, 44, 45, 46, 47], "fps": 7, "loop": true, "movement": "stationary" },
|
||||
{ "id": "offline", "state": "offline", "frames": [48, 49, 50, 51, 52, 53], "fps": 5, "loop": true, "movement": "stationary" }
|
||||
]
|
||||
}
|
||||
|
|
@ -44,6 +44,9 @@ export const petPackManifestSchema = z
|
|||
image: z.string().regex(/^[^\\/:*?"<>|]+\\.(png|webp)$/i),
|
||||
width: z.number().int().positive().max(4096),
|
||||
height: z.number().int().positive().max(4096),
|
||||
frameWidth: z.number().int().positive().max(1024),
|
||||
frameHeight: z.number().int().positive().max(1024),
|
||||
columns: z.number().int().positive().max(64),
|
||||
animations: z.array(petAnimationSchema).min(1),
|
||||
})
|
||||
.strict();
|
||||
|
|
|
|||
|
|
@ -1158,3 +1158,17 @@ select:focus {
|
|||
@keyframes pet-work { from { transform: translateY(0) rotate(-2deg); } to { transform: translateY(-4px) rotate(2deg); } }
|
||||
@keyframes pet-rest { 50% { transform: translateY(8px) rotate(8deg); } }
|
||||
@keyframes pet-error { from { transform: translateX(-3px); } to { transform: translateX(3px); } }
|
||||
|
||||
.aemeath-pet-sprite {
|
||||
width: 192px;
|
||||
height: 208px;
|
||||
background-repeat: no-repeat;
|
||||
background-size: 1536px 3120px;
|
||||
image-rendering: pixelated;
|
||||
transform: scale(.78);
|
||||
transform-origin: center;
|
||||
}
|
||||
|
||||
.aemeath-pet-working { filter: drop-shadow(0 0 8px rgb(115 190 255 / 45%)); }
|
||||
.aemeath-pet-speaking { filter: drop-shadow(0 0 8px rgb(255 207 125 / 45%)); }
|
||||
.aemeath-pet-error { filter: drop-shadow(0 0 8px rgb(255 105 130 / 60%)); }
|
||||
|
|
|
|||
正在加载…
添加表格
在新工单中引用