{ 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", ""); } formData.set("tools", tools.join(",")); return async ({ result }) => { loading = false; await applyAction(result); }; }} > {#if assistant}

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

Modifying an existing assistant will propagate the 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)}

{#if selectedModel?.tools}
Tools Experimental

Choose up to 3 community tools that will be used with this assistant.

{/if} {#if page.data.enableAssistantsRAG}
Internet access {#if isHuggingChat} Give feedback {/if} {#if ragMode === "domains"} Specify domains and URLs that the application can search, separated by commas.

{getError("ragDomainList", form)}

{/if} {#if ragMode === "links"} Specify a maximum of 10 direct URLs that the Assistant will access. HTML & Plain Text only, separated by commas

{getError("ragLinkList", form)}

{/if}
{/if}
Instructions (System Prompt) {#if dynamicPrompt && templateVariables.length}
{/if}
{#if modelId} {@const model = models.find((_model) => _model.id === modelId)} {#if model?.tokenizer && systemPrompt} {/if} {/if}

{getError("preprompt", form)}

Cancel