{ loading = true; if (files?.[0] && files[0].size > 0 && compress) { await compress(files[0], { maxWidth: 500, maxHeight: 500, quality: 1, }).then((resizedImage) => { formData.set("avatar", resizedImage); }); } if (deleteExistingAvatar === true) { if (assistant?.avatar) { // if there is an avatar we explicitly removei t formData.set("avatar", "null"); } else { // else we just remove it from the input formData.delete("avatar"); } } else { if (files === null) { formData.delete("avatar"); } } formData.delete("ragMode"); if (ragMode === false || !$page.data.enableAssistantsRAG) { formData.set("ragAllowAll", "false"); formData.set("ragLinkList", ""); formData.set("ragDomainList", ""); } else if (ragMode === "all") { formData.set("ragAllowAll", "true"); formData.set("ragLinkList", ""); formData.set("ragDomainList", ""); } else if (ragMode === "links") { formData.set("ragAllowAll", "false"); formData.set("ragDomainList", ""); } else if (ragMode === "domains") { formData.set("ragAllowAll", "false"); formData.set("ragLinkList", ""); } return async ({ result }) => { loading = false; await applyAction(result); }; }} > {#if assistant}

Edit {assistant?.name ?? "assistant"}

Modifying an existing assistant will propagate those changes to all users.

{:else}

Create new assistant

Create and share your own AI Assistant. All assistants are public

{/if}
Avatar
{#if (files && files[0]) || (assistant?.avatar && !deleteExistingAvatar)}
{#if files && files[0]} avatar {:else if assistant?.avatar} avatar {/if}
{:else}
{/if}

{getError("avatar", form)}