Spaces:
Running
Running
own error component
Browse files
src/lib/components/chat/User.svelte
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
<script lang="ts">
|
| 2 |
-
import { Send, X
|
| 3 |
import {
|
| 4 |
Handle,
|
| 5 |
useEdges,
|
|
@@ -11,7 +11,9 @@
|
|
| 11 |
type Node,
|
| 12 |
useSvelteFlow
|
| 13 |
} from '@xyflow/svelte';
|
|
|
|
| 14 |
|
|
|
|
| 15 |
import type { ChatModel, ChatMessage, TokenUsage } from '$lib/helpers/types';
|
| 16 |
import { Button } from '$lib/components/ui/button';
|
| 17 |
import ComboBoxModels from '$lib/components/model/ComboBoxModels.svelte';
|
|
@@ -22,7 +24,6 @@
|
|
| 22 |
import { SUGGESTIONS_PROMPT } from '$lib/consts';
|
| 23 |
import { authState } from '$lib/state/auth.svelte';
|
| 24 |
import { signinModalState } from '$lib/state/signin-modal.svelte';
|
| 25 |
-
import { onMount } from 'svelte';
|
| 26 |
|
| 27 |
let { id }: NodeProps = $props();
|
| 28 |
|
|
@@ -280,7 +281,7 @@
|
|
| 280 |
</div>
|
| 281 |
</header>
|
| 282 |
{#if errorMessage}
|
| 283 |
-
<div
|
| 284 |
class="mb-2.5 flex items-center justify-between gap-3 rounded-lg bg-rose-500/10 p-3 text-sm text-rose-600"
|
| 285 |
>
|
| 286 |
<div class="flex items-center gap-1">
|
|
@@ -295,7 +296,8 @@
|
|
| 295 |
>
|
| 296 |
<X class="size-3" />
|
| 297 |
</Button>
|
| 298 |
-
</div>
|
|
|
|
| 299 |
{/if}
|
| 300 |
{#if lastMessage}
|
| 301 |
<Message message={lastMessage} />
|
|
|
|
| 1 |
<script lang="ts">
|
| 2 |
+
import { Send, X } from '@lucide/svelte';
|
| 3 |
import {
|
| 4 |
Handle,
|
| 5 |
useEdges,
|
|
|
|
| 11 |
type Node,
|
| 12 |
useSvelteFlow
|
| 13 |
} from '@xyflow/svelte';
|
| 14 |
+
import { onMount } from 'svelte';
|
| 15 |
|
| 16 |
+
import ErrorMessage from '$lib/components/error/Error.svelte';
|
| 17 |
import type { ChatModel, ChatMessage, TokenUsage } from '$lib/helpers/types';
|
| 18 |
import { Button } from '$lib/components/ui/button';
|
| 19 |
import ComboBoxModels from '$lib/components/model/ComboBoxModels.svelte';
|
|
|
|
| 24 |
import { SUGGESTIONS_PROMPT } from '$lib/consts';
|
| 25 |
import { authState } from '$lib/state/auth.svelte';
|
| 26 |
import { signinModalState } from '$lib/state/signin-modal.svelte';
|
|
|
|
| 27 |
|
| 28 |
let { id }: NodeProps = $props();
|
| 29 |
|
|
|
|
| 281 |
</div>
|
| 282 |
</header>
|
| 283 |
{#if errorMessage}
|
| 284 |
+
<!-- <div
|
| 285 |
class="mb-2.5 flex items-center justify-between gap-3 rounded-lg bg-rose-500/10 p-3 text-sm text-rose-600"
|
| 286 |
>
|
| 287 |
<div class="flex items-center gap-1">
|
|
|
|
| 296 |
>
|
| 297 |
<X class="size-3" />
|
| 298 |
</Button>
|
| 299 |
+
</div> -->
|
| 300 |
+
<ErrorMessage error={errorMessage} />
|
| 301 |
{/if}
|
| 302 |
{#if lastMessage}
|
| 303 |
<Message message={lastMessage} />
|
src/lib/components/error/Error.svelte
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<script lang="ts">
|
| 2 |
+
import { TriangleAlert, X } from '@lucide/svelte';
|
| 3 |
+
|
| 4 |
+
let { error }: { error: string } = $props();
|
| 5 |
+
</script>
|
| 6 |
+
|
| 7 |
+
<div class="mb-2.5">
|
| 8 |
+
<div
|
| 9 |
+
class="relative inline-flex w-fit items-center gap-1.5 rounded-t-2xl bg-rose-500/10 pt-3 pr-5 pl-4 text-[11px] font-semibold text-rose-600 uppercase"
|
| 10 |
+
>
|
| 11 |
+
<div
|
| 12 |
+
class="flex size-3 -translate-y-[0.5px] items-center justify-center rounded-full bg-rose-600 text-white"
|
| 13 |
+
>
|
| 14 |
+
<X class="size-2.5" />
|
| 15 |
+
</div>
|
| 16 |
+
Error
|
| 17 |
+
<div
|
| 18 |
+
class="absolute -right-2.5 bottom-0 h-2.5 w-2.5"
|
| 19 |
+
style="background: radial-gradient(circle at top right, transparent 10px, rgb(244 63 94 / 0.1) 10px)"
|
| 20 |
+
></div>
|
| 21 |
+
</div>
|
| 22 |
+
<div
|
| 23 |
+
class="-translate-y-[3px] rounded-r-2xl rounded-b-xl bg-rose-500/10 px-4 py-3 text-xs text-rose-500"
|
| 24 |
+
>
|
| 25 |
+
{error}
|
| 26 |
+
</div>
|
| 27 |
+
</div>
|
src/routes/+layout.svelte
CHANGED
|
@@ -10,7 +10,6 @@
|
|
| 10 |
import { breakpointsState } from '$lib/state/breakpoints.svelte';
|
| 11 |
import { initAuth, handleAuthCallback, authState } from '$lib/state/auth.svelte';
|
| 12 |
import SigninModal from '$lib/components/auth/SigninModal.svelte';
|
| 13 |
-
import Toaster from '$lib/components/toaster/Toaster.svelte';
|
| 14 |
|
| 15 |
interface Props {
|
| 16 |
children?: import('svelte').Snippet;
|
|
@@ -51,7 +50,6 @@
|
|
| 51 |
{:else}
|
| 52 |
{@render children?.()}
|
| 53 |
{/if}
|
| 54 |
-
<Toaster />
|
| 55 |
<SigninModal />
|
| 56 |
</div>
|
| 57 |
</svelte:boundary>
|
|
|
|
| 10 |
import { breakpointsState } from '$lib/state/breakpoints.svelte';
|
| 11 |
import { initAuth, handleAuthCallback, authState } from '$lib/state/auth.svelte';
|
| 12 |
import SigninModal from '$lib/components/auth/SigninModal.svelte';
|
|
|
|
| 13 |
|
| 14 |
interface Props {
|
| 15 |
children?: import('svelte').Snippet;
|
|
|
|
| 50 |
{:else}
|
| 51 |
{@render children?.()}
|
| 52 |
{/if}
|
|
|
|
| 53 |
<SigninModal />
|
| 54 |
</div>
|
| 55 |
</svelte:boundary>
|