{#if value !== null && value.length > 0} {#if show_share_button} { try { // @ts-ignore const formatted = await format_chat_for_sharing(value); dispatch("share", { description: formatted }); } catch (e) { console.error(e); let message = e instanceof ShareError ? e.message : "Share failed."; dispatch("error", message); } }} > {/if} dispatch("clear")} label={"Clear"} > {#if show_copy_all_button} {/if} {/if}
{#if value !== null && value.length > 0 && groupedMessages !== null}
{#each groupedMessages as messages, i} {@const role = messages[0].role === "user" ? "user" : "bot"} {@const avatar_img = avatar_images[role === "user" ? 0 : 1]} {@const opposite_avatar_img = avatar_images[role === "user" ? 0 : 1]} {#if is_image_preview_open}
{image_preview_source_alt}
{/if} handle_like(i, messages[0], selected)} {scroll} /> {/each} {#if pending_message} {/if}
{:else}
{#if placeholder !== null}
{/if} {#if examples !== null}
{#each examples as example, i} {/each}
{/if}
{/if}
{#if show_scroll_button}
{/if}