{$settings.showChatTitleInTab !== false && $chatTitle ? `${$chatTitle.length > 30 ? `${$chatTitle.slice(0, 30)}...` : $chatTitle} • ${$REXPRO_NAME}` : `${$REXPRO_NAME}`} { confirmDeleteChat(); }} >
{$i18n.t("This will delete")} {$chatTitle}.
{ if (e.detail) { eventCallback(e.detail); } else { eventCallback(true); } }} on:cancel={() => { eventCallback(false); }} />
{#if !loading}
{#if $selectedFolder && $selectedFolder?.meta?.background_image_url}
{:else if $settings?.backgroundImageUrl ?? $config?.license_metadata?.background_image_url ?? null}
{/if} { try { if ( !history?.currentId || !Object.keys(history.messages).length ) { toast.error( $i18n.t("No conversation to save"), ); return; } const messages = createMessagesList( history, history.currentId, ); const title = messages.find((m) => m.role === "user") ?.content ?? $i18n.t("New Chat"); const savedChat = await createNewChat( localStorage.token, { id: uuidv4(), title: title.length > 50 ? `${title.slice(0, 50)}...` : title, models: selectedModels, params: params, history: history, messages: messages, timestamp: Date.now(), }, null, ); if (savedChat) { temporaryChatEnabled.set(false); chatId.set(savedChat.id); chats.set( await getChatList( localStorage.token, $currentChatPage, ), ); await goto(`/c/${savedChat.id}`); toast.success( $i18n.t( "Conversation saved successfully", ), ); } } catch (error) { console.error( "Error saving conversation:", error, ); toast.error( $i18n.t("Failed to save conversation"), ); } }} />
{#if ($settings?.landingPageMode === "chat" && !$selectedFolder) || createMessagesList(history, history.currentId).length > 0}
{ const queue = $chatRequestQueues[$chatId] ?? []; const item = queue.find( (m) => m.id === id, ); if (item) { // Remove from queue chatRequestQueues.update((q) => ({ ...q, [$chatId]: queue.filter( (m) => m.id !== id, ), })); await stopResponse(false); await tick(); await submitPrompt( item.prompt, item.files, ); } }} onQueueEdit={(id) => { const queue = $chatRequestQueues[$chatId] ?? []; const item = queue.find( (m) => m.id === id, ); if (item) { // Remove from queue chatRequestQueues.update((q) => ({ ...q, [$chatId]: queue.filter( (m) => m.id !== id, ), })); // Set files and restore prompt to input files = item.files; messageInput?.setText(item.prompt); } }} onQueueDelete={(id) => { const queue = $chatRequestQueues[$chatId] ?? []; chatRequestQueues.update((q) => ({ ...q, [$chatId]: queue.filter( (m) => m.id !== id, ), })); }} onChange={(data) => { if (!$temporaryChatEnabled) { saveDraft(data, $chatId); } }} on:submit={async (e) => { clearDraft($chatId); if (e.detail || files.length > 0) { await tick(); submitHandler(e.detail); } }} />
{:else}
{ if (!$temporaryChatEnabled) { saveDraft(data); } }} on:submit={async (e) => { clearDraft(); if (e.detail || files.length > 0) { await tick(); submitHandler(e.detail); } }} />
{/if}
{ const model = $models.find((m) => m.id === e); if (model) { return [...a, model]; } return a; }, [])} submitPrompt={submitHandler} {stopResponse} {showMessage} {eventTarget} {codeInterpreterEnabled} />
{:else if loading}
{/if}