mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-30 12:54:55 +00:00
feat(agent): store preset avatars as real files in s3 storage (#381)
* feat(agent): store preset avatars as real files in s3 storage * fix(agent): use inline base64 previews in dialog and remove static avatar files * feat(agent): add 4 avatar presets and track avatarPreset in agent config * refactor(agent): consolidate preset avatar base64 data in dtos
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import {
|
||||
PRESET_AVATAR_IDS,
|
||||
type PresetAvatarId,
|
||||
isPresetAvatarId,
|
||||
PRESET_AVATAR_BASE64,
|
||||
} from '@shumai/dtos'
|
||||
|
||||
export { PRESET_AVATAR_IDS, type PresetAvatarId, isPresetAvatarId }
|
||||
|
||||
const bufferCache = new Map<PresetAvatarId, Buffer>()
|
||||
|
||||
export function getPresetAvatarBuffer(id: PresetAvatarId): Buffer | null {
|
||||
const cached = bufferCache.get(id)
|
||||
if (cached) return cached
|
||||
|
||||
const b64 = PRESET_AVATAR_BASE64[id]
|
||||
if (!b64) return null
|
||||
|
||||
const buf = Buffer.from(b64, 'base64')
|
||||
bufferCache.set(id, buf)
|
||||
return buf
|
||||
}
|
||||
Reference in New Issue
Block a user