Skip to content
Merged
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
1 change: 0 additions & 1 deletion src/lib/helpers/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,6 @@ IRichContent.prototype.text;
* @property {string} message_id - The message id.
* @property {Object} states - The states content.
* @property {Date} created_at - The states sent time.
* @property {number} expand_level - The object expand level
*/

/**
Expand Down
20 changes: 2 additions & 18 deletions src/routes/chat/[agentId]/[conversationId]/chat-box.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -535,20 +535,12 @@
function truncateLogs(messageId) {
if (isLoadContentLog) {
const targetIdx = contentLogs.findIndex(x => x.message_id === messageId);
if (targetIdx < 0) {
contentLogs = [];
} else {
contentLogs = contentLogs.filter((x, idx) => idx < targetIdx);
}
contentLogs = contentLogs.filter((x, idx) => idx < targetIdx);
}

if (isLoadStateLog) {
const targetIdx = stateLogs.findIndex(x => x.message_id === messageId);
if (targetIdx < 0) {
stateLogs = [];
} else {
stateLogs = stateLogs.filter((x, idx) => idx < targetIdx);
}
stateLogs = stateLogs.filter((x, idx) => idx < targetIdx);
}
}

Expand Down Expand Up @@ -578,14 +570,6 @@
function highlightStateLog(messageId) {
if (!isLoadStateLog) return;

stateLogs = stateLogs.map(item => {
if (item.message_id === messageId) {
item.expand_level = 1;
} else {
item.expand_level = 0;
}
return item;
});
const targets = document.querySelectorAll('.state-log-item');
targets.forEach(elm => {
const contentElm = elm.querySelector('.log-content');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
</Link>
{:else}
<span class="text-white">
{`${data?.name}`}
{data.name}
</span>
{/if}
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

/** @type {any} */
export let data;

$: stateObj = JSON.parse(JSON.stringify(data?.states || {}));
</script>

<div class="log-element state-log-item" id={`state-log-${data.message_id}`}>
Expand All @@ -14,10 +12,7 @@
</div>
<br>
<div class="log-content">
<JSONTree
value={stateObj}
defaultExpandedLevel={data.expand_level || 0}
/>
<JSONTree value={data?.states || {}} />
</div>
{#if data.message_id}
<div style="margin-top: 10px;">
Expand Down
14 changes: 12 additions & 2 deletions src/routes/page/conversation/[conversationId]/conv-dialogs.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import { onMount } from 'svelte';
import { _ } from 'svelte-i18n'
import { USER_SENDERS } from '$lib/helpers/constants';
import Markdown from '$lib/common/Markdown.svelte';

/** @type {import('$types').ChatResponseModel[]} */
let dialogs = [];
Expand Down Expand Up @@ -60,9 +61,18 @@
<div class="flex-grow-1">
<div>
<span>{dialog.sender.full_name}</span>
<p class="fw-bold">{dialog.text}</p>
<span class="text-muted">{utcToLocal(dialog.created_at)}</span>
<span class="text-muted ms-2" style="font-size: 0.7rem;">{utcToLocal(dialog.created_at)}</span>
</div>
<div>
<p class="fw-bold">
<Markdown text={dialog?.rich_content?.message?.text || dialog?.text} />
</p>
</div>
{#if dialog.message_id}
<div>
<span class="text-muted" style="font-size: 0.7rem;">{`Message id: ${dialog.message_id}`}</span>
</div>
{/if}
</div>
</div>
</li>
Expand Down