From 4d24095bc41be00286a0cf3a99234adf70cccba3 Mon Sep 17 00:00:00 2001 From: tglide <26071571+TGlide@users.noreply.github.com> Date: Mon, 28 Aug 2023 13:58:35 +0100 Subject: [PATCH 1/7] improve ai scrolling --- src/lib/commandCenter/panels/ai.svelte | 5 ++++- src/lib/commandCenter/panels/template.svelte | 19 ++++--------------- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/src/lib/commandCenter/panels/ai.svelte b/src/lib/commandCenter/panels/ai.svelte index 63dfbd6781..3a941f7274 100644 --- a/src/lib/commandCenter/panels/ai.svelte +++ b/src/lib/commandCenter/panels/ai.svelte @@ -105,7 +105,9 @@ })} clearOnCallback={false} on:keydown={(e) => { - e.detail.cancel(); + if (e.detail.key !== 'Escape') { + e.detail.cancel(); + } }} --min-height="40rem" --max-height="52.5rem"> @@ -117,6 +119,7 @@ {option.label} +

cool

{#if $isLoading || answer}
diff --git a/src/lib/commandCenter/panels/template.svelte b/src/lib/commandCenter/panels/template.svelte index 88cc9a3575..e9bde0a8b2 100644 --- a/src/lib/commandCenter/panels/template.svelte +++ b/src/lib/commandCenter/panels/template.svelte @@ -1,6 +1,5 @@ -
+
{#if label} @@ -79,11 +80,19 @@ } } + .noBoxPadding { + padding: 0 !important; + } + .with-scroll { height: 100%; overflow: auto; } + pre { + padding-inline-end: 7rem !important; // Add space for label and copy btn + } + code, pre { &[class*='language-'] { @@ -116,7 +125,7 @@ :not(pre) > code[class*='language-'], pre[class*='language-'] { background: hsl(var(--p-box-background-color)); - padding-block-start: 4%; + margin: 0; } .prism-token { From b61be6812169496fbd649d335d240f6a3f11fcdc Mon Sep 17 00:00:00 2001 From: tglide <26071571+TGlide@users.noreply.github.com> Date: Mon, 28 Aug 2023 14:57:51 +0100 Subject: [PATCH 4/7] ai-errors --- src/lib/commandCenter/panels/ai.svelte | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/lib/commandCenter/panels/ai.svelte b/src/lib/commandCenter/panels/ai.svelte index 8d4e501b05..2bfac62564 100644 --- a/src/lib/commandCenter/panels/ai.svelte +++ b/src/lib/commandCenter/panels/ai.svelte @@ -8,12 +8,11 @@ import { isLanguage, type Language } from '$lib/components/code.svelte'; import { preferences } from '$lib/stores/preferences'; - import { sdk } from '$lib/stores/sdk'; import { VARS } from '$lib/system'; const endpoint = VARS.APPWRITE_ENDPOINT ?? `${globalThis?.location?.origin}/v1`; - const { input, handleSubmit, completion, isLoading, complete } = useCompletion({ + const { input, handleSubmit, completion, isLoading, complete, error } = useCompletion({ api: endpoint + '/console/assistant', headers: { 'content-type': 'application/json' @@ -176,6 +175,18 @@
{/if} + {#if $error} +
+ + Something went wrong +

+ An unexpected error occurred while handling your request. Please try again + later. +

+
+
+ {/if} +