Restore Agent workspace and add platform pixel avatars

This commit is contained in:
鲨鱼辣椒 committed 2026-10-12 17:05:24 +08:00
1 parent 7a7d1f7fd8
commit c14d996c05
22 files changed
+1387 -462

No files matched your search

+11
View File
@@ -1,5 +1,6 @@
import { EMPTY_CLOUD_CONFIGURATION, type CloudAgentConfiguration, type CloudAgentDraft, type CloudAgentPage, type CreateCloudAgent, type SaveCloudAgentDraft, type CloudUpload } from '../../shared/cloud-agents';
import { operationPlan } from './cloud-agent-operations';
import { cloudAgentAvatarPreset } from './cloud-agent-avatar-presets';
const retiredChannelOperations = new Set([
'channelPolicy',
@@ -397,6 +398,16 @@ export class CloudAgentsModule {
return this.withAvatar({ icon: textField(result.icon, 255) });
}
async useAvatarPreset(value: unknown): Promise<{ icon: string; icon_url: string | null }> {
const id = textField(record(value).id, 32);
const preset = cloudAgentAvatarPreset(id);
if (!preset) throw new CloudAgentsError(422, 'invalid_input');
const body = new FormData();
body.append('file', new Blob([preset.bytes], { type: 'image/png' }), preset.fileName);
const result = record(await this.request('/api/makelore/avatars', 'POST', body));
return this.withAvatar({ icon: textField(result.icon, 255) });
}
async upload(): Promise<CloudUpload | null> {
const body = await this.pickUpload();
if (!body) return null;