Makelore 2.0 initial clean snapshot
This commit is contained in:
23
src/lib/agent-avatars.ts
Normal file
23
src/lib/agent-avatars.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
const avatarModules = import.meta.glob('../assets/agent-avatars/avatar-*.png', {
|
||||
eager: true,
|
||||
import: 'default',
|
||||
}) as Record<string, string>;
|
||||
|
||||
export type AgentAvatarOption = {
|
||||
id: string;
|
||||
src: string;
|
||||
label: string;
|
||||
};
|
||||
|
||||
export const agentAvatarOptions: AgentAvatarOption[] = Array.from({ length: 16 }, (_, index) => {
|
||||
const number = String(index + 1).padStart(2, '0');
|
||||
return {
|
||||
id: `avatar-${number}`,
|
||||
src: avatarModules[`../assets/agent-avatars/avatar-${number}.png`],
|
||||
label: `像素伙伴 ${index + 1}`,
|
||||
};
|
||||
});
|
||||
|
||||
export function getAgentAvatarSrc(avatarId: string | null | undefined): string {
|
||||
return agentAvatarOptions.find((option) => option.id === avatarId)?.src ?? agentAvatarOptions[0]!.src;
|
||||
}
|
||||
Reference in New Issue
Block a user