{#if dragged}
🗂️
Add Files
Drop any files/images here to add to the conversation
{/if}
{#if autoScroll === false && messages.length > 0}
{ autoScroll = true; window.scrollTo({ top: document.body.scrollHeight, behavior: 'smooth' }); }} >
{/if}
{#if prompt.charAt(0) === '/'}
{:else if messages.length == 0 && suggestionPrompts.length !== 0}
{/if}
{ let reader = new FileReader(); reader.onload = (event) => { files = [ ...files, { type: 'image', url: `${event.target.result}` } ]; inputFiles = null; filesInputElement.value = ''; }; if (inputFiles && inputFiles.length > 0) { const file = inputFiles[0]; if (['image/gif', 'image/jpeg', 'image/png'].includes(file['type'])) { reader.readAsDataURL(file); } else if ( [ 'application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'text/plain', 'text/csv' ].includes(file['type']) ) { uploadDoc(file); filesInputElement.value = ''; } else { toast.error(`Unsupported File Type '${file['type']}'.`); inputFiles = null; } } else { toast.error(`File not found.`); } }} />
{ submitPrompt(prompt); }} > {#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}
Document
{/if}
{ files.splice(fileIdx, 1); files = files; }} >
{/each}
{/if}
{#if fileUploadEnabled}
{ filesInputElement.click(); }} >
{/if}
{ if (e.keyCode == 13 && !e.shiftKey) { e.preventDefault(); } if (prompt !== '' && e.keyCode == 13 && !e.shiftKey) { submitPrompt(prompt); } }} on:keydown={async (e) => { 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); console.log(userMessageElement); userMessageElement.scrollIntoView({ block: 'center' }); editButton?.click(); } if (prompt.charAt(0) === '/' && e.key === 'ArrowUp') { promptsElement.selectUp(); const commandOptionButton = [ ...document.getElementsByClassName('selected-command-option-button') ]?.at(-1); commandOptionButton.scrollIntoView({ block: 'center' }); } if (prompt.charAt(0) === '/' && e.key === 'ArrowDown') { promptsElement.selectDown(); const commandOptionButton = [ ...document.getElementsByClassName('selected-command-option-button') ]?.at(-1); commandOptionButton.scrollIntoView({ block: 'center' }); } if (prompt.charAt(0) === '/' && e.key === 'Enter') { e.preventDefault(); const commandOptionButton = [ ...document.getElementsByClassName('selected-command-option-button') ]?.at(-1); commandOptionButton?.click(); } if (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'; }} 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 messages.length == 0 || messages.at(-1).done == true} {#if speechRecognitionEnabled}
{ speechRecognitionHandler(); }} > {#if speechRecognitionListening}
{:else}
{/if}
{/if}
{:else}
{/if}
LLMs can make mistakes. Verify important information.