Skip to content

Commit

Permalink
Download backend full log.
Browse files Browse the repository at this point in the history
  • Loading branch information
Oceania2018 committed Jan 11, 2024
1 parent 7d84897 commit 60d85f0
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 5 deletions.
3 changes: 3 additions & 0 deletions src/lib/services/api-endpoints.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ export const endpoints = {
conversationDetailUrl: `${host}/conversation/{conversationId}`,
dialogsUrl: `${host}/conversation/{conversationId}/dialogs`,

// logging
loggingFullLogUrl: `${host}/logger/full-log`,

// knowledge base
knowledgeBaseUploadUrl: `${host}/knowledge-base/upload`,

Expand Down
21 changes: 21 additions & 0 deletions src/lib/services/logging-service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { endpoints } from './api-endpoints.js';
import axios from 'axios';

/**
* Show backend full log
*/
export async function getFullLog() {
axios({
url: endpoints.loggingFullLogUrl,
method: 'GET',
responseType: 'blob'
}).then((response) => {
const url = window.URL.createObjectURL(new Blob([response.data]));
const link = document.createElement('a');
link.href = url;
link.target = "_blank";
document.body.appendChild(link);
link.click();
link.remove();
})
}
12 changes: 7 additions & 5 deletions src/routes/chat/[agentId]/[conversationId]/chat-box.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import { signalr } from '$lib/services/signalr-service.js';
import { webSpeech } from '$lib/services/web-speech.js';
import { sendMessageToHub, GetDialogs } from '$lib/services/conversation-service.js';
import { getFullLog } from '$lib/services/logging-service';
import { format } from '$lib/helpers/datetime';
import RcText from './rc-text.svelte';
import RcQuickReply from './rc-quick-reply.svelte';
Expand Down Expand Up @@ -91,6 +92,10 @@
refresh();
}
async function viewFullLogHandler() {
await getFullLog();
}
async function sendTextMessage() {
await sendMessageToHub(params.agentId, params.conversationId, text);
}
Expand Down Expand Up @@ -140,9 +145,7 @@
<i class="bx bx-dots-horizontal-rounded" />
</DropdownToggle>
<DropdownMenu class="dropdown-menu-end">
<DropdownItem>Action</DropdownItem>
<DropdownItem>Another action</DropdownItem>
<DropdownItem>Something else</DropdownItem>
<DropdownItem on:click={viewFullLogHandler} >View Log</DropdownItem>
</DropdownMenu>
</Dropdown>
</li>
Expand Down Expand Up @@ -176,9 +179,8 @@
<i class="bx bx-dots-vertical-rounded" />
</DropdownToggle>
<DropdownMenu class="dropdown-menu-end">
<DropdownItem href="#">Eidt</DropdownItem>
<DropdownItem href="#">Copy</DropdownItem>
<DropdownItem href="#">Save</DropdownItem>
<DropdownItem href="#">Forward</DropdownItem>
<DropdownItem href="#">Delete</DropdownItem>
</DropdownMenu>
</Dropdown>
Expand Down

0 comments on commit 60d85f0

Please sign in to comment.