{$settings.showChatTitleInTab !== false && $chatTitle ? `${$chatTitle.length > 30 ? `${$chatTitle.slice(0, 30)}...` : $chatTitle} • ${$WEBUI_NAME}` : `${$WEBUI_NAME}`} { 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} {}} {moveChatHandler} onSaveTempChat={async () => { 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, 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}
{ if (!$temporaryChatEnabled) { saveDraft(data, $chatId); } }} on:upload={async (e) => { const { type, data } = e.detail; if (type === 'web') { await uploadWeb(data); } else if (type === 'youtube') { await uploadYoutubeTranscription(data); } else if (type === 'google-drive') { await uploadGoogleDriveFile(data); } }} on:submit={async (e) => { clearDraft(); if (e.detail || files.length > 0) { await tick(); submitPrompt(e.detail.replaceAll('\n\n', '\n')); } }} />
{:else}
{ if (!$temporaryChatEnabled) { saveDraft(data); } }} on:upload={async (e) => { const { type, data } = e.detail; if (type === 'web') { await uploadWeb(data); } else if (type === 'youtube') { await uploadYoutubeTranscription(data); } }} on:submit={async (e) => { clearDraft(); if (e.detail || files.length > 0) { await tick(); submitPrompt(e.detail.replaceAll('\n\n', '\n')); } }} />
{/if}
{ const model = $models.find((m) => m.id === e); if (model) { return [...a, model]; } return a; }, [])} {submitPrompt} {stopResponse} {showMessage} {eventTarget} />
{:else if loading}
{/if}