{#if dragged}
{/if}
{#if autoScroll === false && messages.length > 0}
{ autoScroll = true; scrollToBottom(); }} >
{/if}
{#if prompt.charAt(0) === '/'}
{:else if prompt.charAt(0) === '#'}
{ uploadWeb(e.detail); }} on:select={(e) => { files = [ ...files, { type: e?.detail?.type ?? 'doc', ...e.detail, upload_status: true } ]; }} /> {:else if prompt.charAt(0) === '@'}
{/if}
{ if (inputFiles && inputFiles.length > 0) { const _inputFiles = Array.from(inputFiles); _inputFiles.forEach((file) => { if (['image/gif', 'image/jpeg', 'image/png'].includes(file['type'])) { let reader = new FileReader(); reader.onload = (event) => { files = [ ...files, { type: 'image', url: `${event.target.result}` } ]; inputFiles = null; filesInputElement.value = ''; }; reader.readAsDataURL(file); } else if ( SUPPORTED_FILE_TYPE.includes(file['type']) || SUPPORTED_FILE_EXTENSIONS.includes(file.name.split('.').at(-1)) ) { uploadDoc(file); filesInputElement.value = ''; } else { toast.error( `Unknown File Type '{{file_type}}', but accepting and treating as plain text`, { file_type: file['type'] } ); uploadDoc(file); filesInputElement.value = ''; } }); } else { toast.error('Plik nie został znaleziony.'); } }} />
{ submitPrompt(prompt, user); }} > {#if files.length > 0}
{#each files as file, fileIdx}
{#if file.type === 'image'}
{:else if file.type === 'doc'}
{#if file.upload_status}
{:else}
{/if}
{file.name}
{'Dokument'}
{:else if file.type === 'collection'}
{file?.title ?? `#${file.name}`}
{'Kolekcja'}
{/if}
{ files.splice(fileIdx, 1); files = files; }} >
{/each}
{/if}
{#if fileUploadEnabled}
{ dropdownDirection = messages.length > 0 ? 'up' : 'down'; if (window.innerWidth >= 768) { dropdownOpen = !dropdownOpen; } else { drawerOpen = true; } }} > {#if $desktopLoading}
{:else}
{/if}
{#if ($hfEnabled || $searchEnabled || $kernelEnabled || $desktopEnabled || $githubEnabled) && !$desktopLoading}
{/if} {#if dropdownOpen}
dropdownOpen = false} on:mousedown|preventDefault role="button" aria-label="Zamknij" tabindex="-1" />
{ closeMenu(); filesInputElement.click(); }} >
Dodaj zdjęcia i pliki
{ setSingleMode($searchEnabled ? null : 'search'); closeMenu(); }} >
Szukaj w internecie
{#if $searchEnabled}
{/if}
{ setSingleMode($hfEnabled ? null : 'hf'); }} >
HuggingFace Hub
{#if $hfEnabled}
{/if}
{ setSingleMode($githubEnabled ? null : 'github'); }} >
GitHub Agent
{#if $githubEnabled}
{/if}
{ const enabling = !$kernelEnabled; setSingleMode(enabling ? 'kernel' : null); if (enabling && !$kernelBrowserUrl) { try { const res = await fetch('/api/kernel/session', { method: 'POST' }); const data = await res.json(); kernelBrowserUrl.set(data.live_view_url); kernelSessionId.set(data.session_id); } catch (e) { console.error('Kernel session error', e); } } }} >
Browser Agent
{#if $kernelEnabled}
{/if}
{ if ($desktopEnabled) { setSingleMode(null); desktopLoading.set(false); desktopBrowserUrl.set(''); desktopSessionId.set(''); } else { desktopLoading.set(true); setSingleMode('desktop'); try { const res = await fetch('/api/e2b/session', { method: 'POST' }); const data = await res.json(); desktopBrowserUrl.set(data.live_view_url); desktopSessionId.set(data.session_id); desktopEnabled.set(true); } catch (e) { console.error('Desktop session error', e); } finally { desktopLoading.set(false); } } }} > {#if $desktopLoading}
{:else}
{/if}
{#if $desktopLoading}Tworzenie sesji...{:else}Desktop Agent{/if}
{#if $desktopEnabled && !$desktopLoading}
{/if}
{/if}
{/if}
{ if (e.keyCode == 13 && !e.shiftKey) { e.preventDefault(); } if (prompt !== '' && e.keyCode == 13 && !e.shiftKey) { submitPrompt(prompt, user); } }} on:keydown={async (e) => { const isCtrlPressed = e.ctrlKey || e.metaKey; // metaKey is for Cmd key on Mac // Check if Ctrl + R is pressed if (prompt === '' && isCtrlPressed && e.key.toLowerCase() === 'r') { e.preventDefault(); const regenerateButton = [ ...document.getElementsByClassName('regenerate-response-button') ]?.at(-1); regenerateButton?.click(); } if (prompt === '' && e.key == 'ArrowUp') { e.preventDefault(); const userMessageElement = [ ...document.getElementsByClassName('user-message') ]?.at(-1); const editButton = [ ...document.getElementsByClassName('edit-user-message-button') ]?.at(-1); userMessageElement.scrollIntoView({ block: 'center' }); editButton?.click(); } if (['/', '#', '@'].includes(prompt.charAt(0)) && e.key === 'ArrowUp') { e.preventDefault(); (promptsElement || documentsElement || modelsElement).selectUp(); const commandOptionButton = [ ...document.getElementsByClassName('selected-command-option-button') ]?.at(-1); commandOptionButton.scrollIntoView({ block: 'center' }); } if (['/', '#', '@'].includes(prompt.charAt(0)) && e.key === 'ArrowDown') { e.preventDefault(); (promptsElement || documentsElement || modelsElement).selectDown(); const commandOptionButton = [ ...document.getElementsByClassName('selected-command-option-button') ]?.at(-1); commandOptionButton.scrollIntoView({ block: 'center' }); } if (['/', '#', '@'].includes(prompt.charAt(0)) && e.key === 'Enter') { e.preventDefault(); const commandOptionButton = [ ...document.getElementsByClassName('selected-command-option-button') ]?.at(-1); commandOptionButton?.click(); } if (['/', '#', '@'].includes(prompt.charAt(0)) && e.key === 'Tab') { e.preventDefault(); const commandOptionButton = [ ...document.getElementsByClassName('selected-command-option-button') ]?.at(-1); commandOptionButton?.click(); } else if (e.key === 'Tab') { const words = findWordIndices(prompt); if (words.length > 0) { const word = words.at(0); const fullPrompt = prompt; prompt = prompt.substring(0, word?.endIndex + 1); await tick(); e.target.scrollTop = e.target.scrollHeight; prompt = fullPrompt; await tick(); e.preventDefault(); e.target.setSelectionRange(word?.startIndex, word.endIndex + 1); } } }} rows="1" on:input={(e) => { e.target.style.height = ''; e.target.style.height = Math.min(e.target.scrollHeight, 200) + 'px'; user = null; }} on:focus={(e) => { e.target.style.height = ''; e.target.style.height = Math.min(e.target.scrollHeight, 200) + 'px'; }} on:paste={(e) => { const clipboardData = e.clipboardData || window.clipboardData; if (clipboardData && clipboardData.items) { for (const item of clipboardData.items) { if (item.type.indexOf('image') !== -1) { const blob = item.getAsFile(); const reader = new FileReader(); reader.onload = function (e) { files = [ ...files, { type: 'image', url: `${e.target.result}` } ]; }; reader.readAsDataURL(blob); } } } }} />
{#if !processing}
{:else}
{/if}
{'LLMy mogą popełniać błędy. Zweryfikuj ważne informacje.'}
{ closeMenu(); const el = document.createElement('input'); el.type = 'file'; el.accept = 'image/*'; el.capture = 'environment'; el.onchange = () => { if (el.files?.length) { filesInputElement.files = el.files; filesInputElement.dispatchEvent(new Event('change', { bubbles: true })); } }; el.click(); }} >
Aparat
{ closeMenu(); const el = document.createElement('input'); el.type = 'file'; el.accept = 'image/*,video/*'; el.multiple = true; el.onchange = () => { if (el.files?.length) { filesInputElement.files = el.files; filesInputElement.dispatchEvent(new Event('change', { bubbles: true })); } }; el.click(); }} >
Zdjęcia
{ closeMenu(); filesInputElement.click(); }} >
Pliki
{ setSingleMode($searchEnabled ? null : 'search'); closeMenu(); }} >
Szukaj w internecie
Brave Search — aktualne wyniki
{#if $searchEnabled}
{/if}
{ setSingleMode($hfEnabled ? null : 'hf'); closeMenu(); }} >
HuggingFace Hub
Modele, datasety, spaces
{#if $hfEnabled}
{/if}
{ setSingleMode($githubEnabled ? null : 'github'); closeMenu(); }} >
GitHub Agent
Repozytoria, pliki, commity, gałęzie
{#if $githubEnabled}
{/if}
{ const enabling = !$kernelEnabled; setSingleMode(enabling ? 'kernel' : null); closeMenu(); if (enabling && !$kernelBrowserUrl) { try { const res = await fetch('/api/kernel/session', { method: 'POST' }); const data = await res.json(); kernelBrowserUrl.set(data.live_view_url); kernelSessionId.set(data.session_id); } catch (e) { console.error('Kernel session error', e); } } }} >
Browser Agent
Autonomiczna przeglądarka
{#if $kernelEnabled}
{/if}
{ if ($desktopEnabled) { setSingleMode(null); desktopLoading.set(false); desktopBrowserUrl.set(''); desktopSessionId.set(''); closeMenu(); } else { desktopLoading.set(true); setSingleMode('desktop'); closeMenu(); try { const res = await fetch('/api/e2b/session', { method: 'POST' }); const data = await res.json(); desktopBrowserUrl.set(data.live_view_url); desktopSessionId.set(data.session_id); desktopEnabled.set(true); } catch (e) { console.error('Desktop session error', e); } finally { desktopLoading.set(false); } } }} > {#if $desktopLoading}
{:else}
{/if}
Desktop Agent
{#if $desktopLoading}Tworzenie sesji...{:else}Autonomiczny pulpit e2b{/if}
{#if $desktopEnabled}
{:else if $desktopLoading}
{/if}