fix ai panel input

This commit is contained in:
tglide committed 2023-08-17 18:59:44 +01:00
1 parent d8147034b0
commit 7bb0ae4db4
3 files changed
+26 -2

No files matched your search

+4
View File
@@ -8,6 +8,7 @@
import { isLanguage, type Language } from '$lib/components/code.svelte';
import { VARS } from '$lib/system';
import { key } from '$routes/console/project-[project]/overview/keys/[key]/store';
const { input, handleSubmit, completion, isLoading, complete } = useCompletion({
api: VARS.ASSISTANT_ENDPOINT
@@ -97,6 +98,9 @@
};
})}
clearOnCallback={false}
on:keydown={(e) => {
e.detail.cancel();
}}
--min-height="40rem"
--max-height="52.5rem">
<div slot="search">
+22 -1
View File
@@ -4,7 +4,7 @@
// This is the template for all panels used in the command center.
// Use this component when you want to create a new panel.
import { tick } from 'svelte';
import { createEventDispatcher, tick } from 'svelte';
import { getCommandCenterCtx } from '../commandCenter.svelte';
@@ -28,9 +28,25 @@
}
}
const dispatch = createEventDispatcher<{
keydown: {
originalEvent: KeyboardEvent;
cancel: () => void;
key: string;
};
}>();
function handleKeyDown(event: KeyboardEvent) {
if (!open) return;
let canceled = false;
dispatch('keydown', {
originalEvent: event,
cancel: () => (canceled = true),
key: event.key
});
if (canceled) return;
if (options) {
if (event.key === 'ArrowDown') {
event.preventDefault();
@@ -177,6 +193,10 @@
selected = option.index;
};
const getOptionBlurHandler = () => () => {
selected = -1;
};
const castOption = (option: IndexedOption) => option as Option;
function getBreadcrumbs(subPanels: typeof $subPanels) {
@@ -272,6 +292,7 @@
class="option"
on:click={getOptionClickHandler(item)}
on:mouseover={getOptionFocusHandler(item)}
on:mouseleave={getOptionBlurHandler()}
on:focus={getOptionFocusHandler(item)}>
<slot name="option" option={castOption(item)}>
<div class="u-flex u-gap-8 u-cross-center">
-1
View File
@@ -63,7 +63,6 @@
group: 'navigation',
rank: -2
},
{
label: 'Create new organization',
callback: () => {