Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/lib/helpers/types/conversationTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
* @property {string} status - The conversation status.
* @property {Object} states - The conversation states.
* @property {string[]} tags - The conversation tags.
* @property {boolean?} accessible - Whether the conversation is accessible.
* @property {boolean?} is_realtime_enabled - Whether the realtime feature is enabled.
* @property {Date} updated_time - The conversation updated time.
* @property {Date} created_time - The conversation created time.
Expand Down
54 changes: 50 additions & 4 deletions src/routes/+error.svelte
Original file line number Diff line number Diff line change
@@ -1,11 +1,57 @@
<script>
import { page } from '$app/stores';
import Error500 from '$lib/common/errors/error-500.svelte'
import { Col, Container, Row } from '@sveltestrap/sveltestrap';
import Link from 'svelte-link';
import Error500 from '$lib/common/errors/error-500.svelte';
import HeadTitle from '$lib/common/shared/HeadTitle.svelte';

$: status = $page.status;
$: message = $page.error?.message || 'An error occurred';

$: icon = status === 404 ? 'bx-search-alt' : 'bx-error-circle';
$: title = status === 404 ? 'Page Not Found' : message;
</script>

{#if $page.status === 500 }
{#if status === 500}
<Error500 />
{:else}
<h1>{$page.status} {$page.error.message}</h1>
<p>Sorry, something went wrong on our end. Please try again later.</p>
<HeadTitle title="{status} Error" />

<div class="account-pages my-5 pt-5">
<Container>
<Row>
<Col lg="12">
<div class="text-center mb-5">
<h1 class="display-2 fw-medium">
{String(status).charAt(0)}
<i class="bx {icon} bx-tada text-primary display-3" />
{String(status).slice(1)}
</h1>
<h4 class="text-uppercase">{title}</h4>
<p class="text-muted mt-3">
{#if status === 404}
The page you're looking for doesn't exist or has been moved.
{:else}
Sorry, something went wrong. Please try again later.
{/if}
</p>
{#if status !== 404}
<div class="mt-5 text-center">
<Link class="btn btn-primary" href="page/dashboard">
Back to Dashboard
</Link>
</div>
{/if}
</div>
</Col>
</Row>
<Row class="justify-content-center">
<Col md="8" xl="6">
<div>
<img src="/images/error-img.png" alt="" class="img-fluid" />
</div>
</Col>
</Row>
</Container>
</div>
{/if}
12 changes: 9 additions & 3 deletions src/routes/chat/[agentId]/[conversationId]/chat-box.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import { Pane, Splitpanes } from 'svelte-splitpanes';
import Viewport from 'svelte-viewport-info';
import { page } from '$app/stores';
import { goto } from '$app/navigation';
import Swal from 'sweetalert2';
import 'overlayscrollbars/overlayscrollbars.css';
import { OverlayScrollbars } from 'overlayscrollbars';
Expand Down Expand Up @@ -226,9 +227,9 @@
}
}

$: {
disableAction = !ADMIN_ROLES.includes(currentUser?.role || '') && currentUser?.id !== conversationUser?.id || !AgentExtensions.chatable(agent);
}
// $: {
// disableAction = !ADMIN_ROLES.includes(currentUser?.role || '') && currentUser?.id !== conversationUser?.id || !AgentExtensions.chatable(agent);
// }

setContext('chat-window-context', {
autoScrollToBottom: autoScrollToBottom
Expand All @@ -237,6 +238,11 @@
onMount(async () => {
disableSpeech = navigator.userAgent.includes('Firefox');
conversation = await getConversation(params.conversationId, true);
if (conversation == null || conversation.accessible === false) {
goto('/error', { replaceState: true });
return;
}

dialogs = await getDialogs(params.conversationId, dialogCount);
conversationUser = conversation?.user;
selectedTags = conversation?.tags || [];
Expand Down