Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions desktop/scripts/check-px-text.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const rules = [
const overrides = new Set([
"src/features/settings/ui/ProfileSettingsCard.tsx:584",
"src/features/onboarding/ui/AvatarStep.tsx:89",
"src/features/agents/ui/AgentCreationPreview.tsx:711",
]);

await runPxTextCheck({
Expand Down
23 changes: 7 additions & 16 deletions desktop/src/features/agents/channelAgents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ import {
} from "@/features/agents/agentReuse";
export { findReusableAgent } from "@/features/agents/agentReuse";
import { normalizePubkey } from "@/shared/lib/pubkey";
import { resolveManagedAgentAvatarUrl } from "@/features/agents/ui/managedAgentAvatar";
import {
addChannelMembers,
createManagedAgent,
getChannelMembers,
listManagedAgents,
startManagedAgent,
updateManagedAgent,
uploadMediaBytes,
} from "@/shared/api/tauri";
import type {
AcpRuntime,
Expand Down Expand Up @@ -341,21 +341,12 @@ export async function createChannelManagedAgent(
}
}

// If the avatar is a data URI (e.g. from a persona PNG card import),
// upload it to get a hosted URL the relay can serve.
let resolvedAvatarUrl = input.avatarUrl?.trim() || undefined;
if (resolvedAvatarUrl?.startsWith("data:image/")) {
try {
const [, b64] = resolvedAvatarUrl.split(",", 2);
if (!b64) throw new Error("empty data URI payload");
const bytes = Array.from(atob(b64), (c) => c.charCodeAt(0));
const blob = await uploadMediaBytes(bytes);
resolvedAvatarUrl = blob.url;
} catch (err) {
console.warn("Avatar upload failed, proceeding without avatar:", err);
resolvedAvatarUrl = undefined;
}
}
// Resolve the avatar for the channel-managed agent. Base64 data URIs (e.g.
// from a persona PNG card import) are uploaded to a hosted URL the relay can
// serve; percent-encoded emoji SVG data URLs pass through unchanged so the
// selected emoji survives deployment. Shared with agent creation so both
// paths handle emoji avatars identically.
const resolvedAvatarUrl = await resolveManagedAgentAvatarUrl(input.avatarUrl);

const isProviderMode = input.backend?.type === "provider";

Expand Down
Loading
Loading