chore(integration): snapshot local main worktree
This commit is contained in:
1 parent
48a9189939
commit
33fb31fb28
116 files changed
+8108
-3026
No files matched your search
@@ -76,15 +76,15 @@ async function encodeAvatarCanvas(canvas: HTMLCanvasElement): Promise<{
|
||||
export async function prepareAgentAvatar(file: File): Promise<PreparedAgentAvatar> {
|
||||
const mimeType = file.type.trim().toLowerCase();
|
||||
if (!isSupportedMimeType(mimeType)) {
|
||||
throw new Error('伙伴头像仅支持 PNG、JPEG 或 WebP 图片');
|
||||
throw new Error('智能体头像仅支持 PNG、JPEG 或 WebP 图片');
|
||||
}
|
||||
if (file.size > AGENT_AVATAR_MAX_SOURCE_BYTES) {
|
||||
throw new Error('伙伴头像图片不能超过 32 MB');
|
||||
throw new Error('智能体头像图片不能超过 32 MB');
|
||||
}
|
||||
|
||||
const frameCount = await browserImageCodec.inspectFrameCount(file, mimeType);
|
||||
if (frameCount !== 1) {
|
||||
throw new Error(frameCount && frameCount > 1 ? '伙伴头像不支持动态图片' : '无法确认伙伴头像为静态图片');
|
||||
throw new Error(frameCount && frameCount > 1 ? '智能体头像不支持动态图片' : '无法确认智能体头像为静态图片');
|
||||
}
|
||||
|
||||
const decoded = await browserImageCodec.decode(file, {
|
||||
@@ -100,7 +100,7 @@ export async function prepareAgentAvatar(file: File): Promise<PreparedAgentAvata
|
||||
|
||||
try {
|
||||
const context = canvas.getContext('2d');
|
||||
if (!context) throw new Error('伙伴头像图片处理失败');
|
||||
if (!context) throw new Error('智能体头像图片处理失败');
|
||||
context.imageSmoothingEnabled = true;
|
||||
context.imageSmoothingQuality = 'high';
|
||||
context.clearRect(0, 0, targetSize, targetSize);
|
||||
|
||||
Reference in new issue
Block a user