From 172bde254bb2996351adde55c444a4cd04fb9c47 Mon Sep 17 00:00:00 2001 From: Jicheng Lu <103353@smsassist.com> Date: Tue, 23 Jan 2024 14:00:35 -0600 Subject: [PATCH] revert end conv --- .../[conversationId]/chat-box.svelte | 25 +++---------------- src/routes/page/agent/evaluator/+page.svelte | 22 ++++++++-------- .../page/agent/router/routing-flow.svelte | 4 +-- 3 files changed, 17 insertions(+), 34 deletions(-) diff --git a/src/routes/chat/[agentId]/[conversationId]/chat-box.svelte b/src/routes/chat/[agentId]/[conversationId]/chat-box.svelte index 09080e43..e695232d 100644 --- a/src/routes/chat/[agentId]/[conversationId]/chat-box.svelte +++ b/src/routes/chat/[agentId]/[conversationId]/chat-box.svelte @@ -5,7 +5,6 @@ DropdownMenu, DropdownItem, } from '@sveltestrap/sveltestrap'; - import 'overlayscrollbars/overlayscrollbars.css'; import { OverlayScrollbars } from 'overlayscrollbars'; import { page } from '$app/stores'; @@ -19,8 +18,6 @@ import RcQuickReply from './rc-quick-reply.svelte'; import { PUBLIC_LIVECHAT_ENTRY_ICON } from '$env/static/public'; import ContentLog from './content-log.svelte'; - import Swal from 'sweetalert2/dist/sweetalert2.js'; - import "sweetalert2/src/sweetalert2.scss"; import { replaceNewLine } from '$lib/helpers/http'; import _ from "lodash"; @@ -105,7 +102,7 @@ /** @param {import('$types').ContentLogModel} log */ function onContentLogGenerated(log) { contentLogs.push(log); - contentLogs = contentLogs.map(log => { return { ...log }; }); + contentLogs = contentLogs.map(x => { return { ...x }; }); } function viewFullLogHandler() { @@ -143,22 +140,8 @@ await sendMessageToHub(params.agentId, params.conversationId, text); } - function endChat() { - // @ts-ignore - Swal.fire({ - title: 'Are you sure?', - text: "You will exit this conversation.", - icon: 'warning', - customClass: 'conv-delete-modal', - showCancelButton: true, - confirmButtonText: 'Yes', - cancelButtonText: 'No' - // @ts-ignore - }).then((result) => { - if (result.value) { - window.close(); - } - }); + function close() { + window.parent.postMessage({ action: "close" }, "*"); } function closeLog() { @@ -194,7 +177,7 @@ {/if}
  • diff --git a/src/routes/page/agent/evaluator/+page.svelte b/src/routes/page/agent/evaluator/+page.svelte index 8d5f079d..3f6d1901 100644 --- a/src/routes/page/agent/evaluator/+page.svelte +++ b/src/routes/page/agent/evaluator/+page.svelte @@ -2,15 +2,15 @@ import { Col, Row } from '@sveltestrap/sveltestrap'; import Breadcrumb from '$lib/common/Breadcrumb.svelte'; import HeadTitle from '$lib/common/HeadTitle.svelte'; - import { getAgents } from '$lib/services/agent-service.js'; - import { onMount } from 'svelte'; + import { getAgents } from '$lib/services/agent-service.js'; + import { onMount } from 'svelte'; import PlainPagination from '$lib/common/PlainPagination.svelte'; - const firstPage = 1; + const firstPage = 1; const pageSize = 12; /** @type {import('$types').PagedItems} */ - let agents = { items: [], count: 0 }; + let agents = { items: [], count: 0 }; /** @type {import('$types').AgentFilter} */ const initFilter = { @@ -18,18 +18,18 @@ isEvaluator: true }; - /** @type {import('$types').AgentFilter} */ - let filter = { ... initFilter }; + /** @type {import('$types').AgentFilter} */ + let filter = { ... initFilter }; /** @type {import('$types').Pagination} */ let pager = filter.pager; - onMount(async () => { - await getPagedAgents(); - }); + onMount(async () => { + await getPagedAgents(); + }); - async function getPagedAgents() { - agents = await getAgents(filter); + async function getPagedAgents() { + agents = await getAgents(filter); refresh(); } diff --git a/src/routes/page/agent/router/routing-flow.svelte b/src/routes/page/agent/router/routing-flow.svelte index 77580f56..7643ca9a 100644 --- a/src/routes/page/agent/router/routing-flow.svelte +++ b/src/routes/page/agent/router/routing-flow.svelte @@ -5,7 +5,7 @@ import { getAgents } from '$lib/services/agent-service.js'; import { onMount, createEventDispatcher } from 'svelte'; - /** @type any[]} */ + /** @type {any[]} */ let agents = []; /** @type {import('$types').AgentFilter} */ @@ -14,7 +14,7 @@ isRouter: false, isEvaluator: false, disabled: false, - allowRouting: false + allowRouting: true }; /** @type {import('$types').AgentModel} */