mirror of
https://github.com/block/buzz.git
synced 2026-08-18 06:50:31 +02:00
Address remaining agent profile review feedback
This commit is contained in:
@@ -82,7 +82,7 @@ pub fn parse_png_persona(png_bytes: &[u8]) -> Result<ParsedPersonaPreview, Strin
|
||||
display_name: fields.display_name,
|
||||
system_prompt: fields.system_prompt,
|
||||
avatar_data_url,
|
||||
avatar_ref: fields.avatar_url,
|
||||
avatar_ref: None,
|
||||
runtime: fields.runtime,
|
||||
model: fields.model,
|
||||
provider: fields.provider,
|
||||
|
||||
@@ -165,6 +165,8 @@ export function AddChannelBotDialog({
|
||||
[personas, selectedPersonaIds],
|
||||
);
|
||||
const selectedCount = selectedPersonas.length + (includeGeneric ? 1 : 0);
|
||||
const allowForceNewInstance =
|
||||
includeGeneric && selectedPersonas.length === 0 && !customPrompt.trim();
|
||||
|
||||
const reusableAgent = useReusableAgentDetection(
|
||||
channelId,
|
||||
@@ -175,6 +177,12 @@ export function AddChannelBotDialog({
|
||||
customPrompt,
|
||||
);
|
||||
|
||||
React.useEffect(() => {
|
||||
if (!allowForceNewInstance) {
|
||||
setForceNewInstance(false);
|
||||
}
|
||||
}, [allowForceNewInstance]);
|
||||
|
||||
const { runtimeWarnings, effectiveRuntimes } = useEffectiveRuntimes(
|
||||
personas,
|
||||
selectedPersonas,
|
||||
@@ -360,7 +368,6 @@ export function AddChannelBotDialog({
|
||||
model: persona.model ?? undefined,
|
||||
role: "bot" as const,
|
||||
backend,
|
||||
forceNewInstance,
|
||||
...respondToFields,
|
||||
};
|
||||
}),
|
||||
@@ -613,7 +620,7 @@ export function AddChannelBotDialog({
|
||||
/>
|
||||
) : null}
|
||||
|
||||
{reusableAgent ? (
|
||||
{reusableAgent && allowForceNewInstance ? (
|
||||
<div className="pt-2">
|
||||
<AddChannelBotReuseGuard
|
||||
disabled={createBotsMutation.isPending}
|
||||
|
||||
@@ -160,6 +160,15 @@ export function UserProfilePanel({
|
||||
return undefined;
|
||||
}, [managedAgentsQuery.data, persona, pubkey]);
|
||||
const resolvedPersonaFromSource = React.useMemo(() => {
|
||||
const personaId = persona?.id ?? managedAgent?.personaId;
|
||||
if (personaId) {
|
||||
const refreshedPersona = personasQuery.data?.find(
|
||||
(candidate) => candidate.id === personaId,
|
||||
);
|
||||
if (refreshedPersona) {
|
||||
return refreshedPersona;
|
||||
}
|
||||
}
|
||||
if (persona) {
|
||||
return persona;
|
||||
}
|
||||
|
||||
@@ -48,15 +48,27 @@ export function useProfileAgentDeletion({
|
||||
}: UseProfileAgentDeletionInput) {
|
||||
const removeAgentFromAllChannels = React.useCallback(
|
||||
async (agentPubkey: string) => {
|
||||
const channelIds = getRelayAgentChannelIds(relayAgents, agentPubkey);
|
||||
if (channelIds.length === 0) return;
|
||||
const normalizedPubkey = agentPubkey.toLowerCase();
|
||||
const channelIds = new Set(
|
||||
getRelayAgentChannelIds(relayAgents, agentPubkey),
|
||||
);
|
||||
for (const channel of channels ?? []) {
|
||||
if (
|
||||
channel.memberPubkeys.some(
|
||||
(memberPubkey) => memberPubkey.toLowerCase() === normalizedPubkey,
|
||||
)
|
||||
) {
|
||||
channelIds.add(channel.id);
|
||||
}
|
||||
}
|
||||
if (channelIds.size === 0) return;
|
||||
await Promise.allSettled(
|
||||
channelIds.map((channelId) =>
|
||||
[...channelIds].map((channelId) =>
|
||||
removeChannelMember(channelId, agentPubkey),
|
||||
),
|
||||
);
|
||||
},
|
||||
[relayAgents],
|
||||
[channels, relayAgents],
|
||||
);
|
||||
|
||||
const deleteManagedAgentRecord = React.useCallback(
|
||||
|
||||
Reference in New Issue
Block a user