feat: merge with dev

This commit is contained in:
Fabio Polito
2025-03-07 00:22:47 +00:00
63 changed files with 226 additions and 133 deletions

View File

@@ -45,6 +45,16 @@
<hr class=" border-gray-100 dark:border-gray-850 my-2" />
<div class="mb-2.5">
<div class=" flex w-full justify-between">
<div class=" self-center text-xs font-medium">
{$i18n.t('Enable Code Execution')}
</div>
<Switch bind:state={config.ENABLE_CODE_EXECUTION} />
</div>
</div>
<div class="mb-2.5">
<div class="flex w-full justify-between">
<div class=" self-center text-xs font-medium">{$i18n.t('Code Execution Engine')}</div>

View File

@@ -1937,7 +1937,7 @@
<PaneGroup direction="horizontal" class="w-full h-full">
<Pane defaultSize={50} class="h-full flex w-full relative">
{#if $banners.length > 0 && !history.currentId && !$chatId && selectedModels.length <= 1}
{#if !history.currentId && !$chatId && selectedModels.length <= 1 && ($banners.length > 0 || ($config?.license_metadata?.type ?? null) === 'trial' || (($config?.license_metadata?.seats ?? null) !== null && $config?.user_count > $config?.license_metadata?.seats))}
<div class="absolute top-12 left-0 right-0 w-full z-30">
<div class=" flex flex-col gap-1 w-full">
{#if ($config?.license_metadata?.type ?? null) === 'trial'}

View File

@@ -85,6 +85,8 @@
let loaded = false;
let recording = false;
let isComposing = false;
let chatInputContainerElement;
let chatInputElement;
@@ -707,6 +709,8 @@
console.log(res);
return res;
}}
oncompositionstart={() => (isComposing = true)}
oncompositionend={() => (isComposing = false)}
on:keydown={async (e) => {
e = e.detail.event;
@@ -806,6 +810,10 @@
navigator.msMaxTouchPoints > 0
)
) {
if (isComposing) {
return;
}
// Uses keyCode '13' for Enter key for chinese/japanese keyboards.
//
// Depending on the user's settings, it will send the message
@@ -882,6 +890,8 @@
class="scrollbar-hidden bg-transparent dark:text-gray-100 outline-hidden w-full pt-3 px-1 resize-none"
placeholder={placeholder ? placeholder : $i18n.t('Send a Message')}
bind:value={prompt}
on:compositionstart={() => (isComposing = true)}
on:compositionend={() => (isComposing = false)}
on:keydown={async (e) => {
const isCtrlPressed = e.ctrlKey || e.metaKey; // metaKey is for Cmd key on Mac
@@ -983,6 +993,10 @@
navigator.msMaxTouchPoints > 0
)
) {
if (isComposing) {
return;
}
console.log('keypress', e);
// Prevent Enter key from creating a new line
const isCtrlPressed = e.ctrlKey || e.metaKey;

View File

@@ -439,7 +439,7 @@
</div>
</button>
{#if lang.toLowerCase() === 'python' || lang.toLowerCase() === 'py' || (lang === '' && checkPythonCode(code))}
{#if ($config?.features?.enable_code_execution ?? true) && (lang.toLowerCase() === 'python' || lang.toLowerCase() === 'py' || (lang === '' && checkPythonCode(code)))}
{#if executing}
<div class="run-code-button bg-none border-none p-1 cursor-not-allowed">Running</div>
{:else if run}

View File

@@ -27,6 +27,9 @@
import { PASTED_TEXT_CHARACTER_LIMIT } from '$lib/constants';
export let oncompositionstart = (e) => {};
export let oncompositionend = (e) => {};
// create a lowlight instance with all languages loaded
const lowlight = createLowlight(all);
@@ -226,6 +229,14 @@
editorProps: {
attributes: { id },
handleDOMEvents: {
compositionstart: (view, event) => {
oncompositionstart(event);
return false;
},
compositionend: (view, event) => {
oncompositionend(event);
return false;
},
focus: (view, event) => {
eventDispatch('focus', { event });
return false;