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
8 changes: 7 additions & 1 deletion src/lib/helpers/enums.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,10 @@ const editorType = {
Email: 'email',
File: 'file'
};
export const EditorType = Object.freeze(editorType);
export const EditorType = Object.freeze(editorType);

const fileSourceType = {
User: 'user',
Bot: 'bot'
};
export const FileSourceType = Object.freeze(fileSourceType);
4 changes: 4 additions & 0 deletions src/lib/scss/custom/pages/_conversation.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,8 @@

.list-title {
width: 40%;
}

.conv-state-search-menu {
inset: auto 0px auto auto !important;
}
2 changes: 1 addition & 1 deletion src/lib/services/api-endpoints.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const endpoints = {
conversationCountUrl: `${host}/conversations/count`,
conversationDeletionUrl: `${host}/conversation/{conversationId}`,
conversationDetailUrl: `${host}/conversation/{conversationId}`,
conversationAttachmentUrl: `${host}/conversation/{conversationId}/files/{messageId}`,
conversationAttachmentUrl: `${host}/conversation/{conversationId}/files/{messageId}/{source}`,
conversationUserUrl: `${host}/conversation/{conversationId}/user`,
dialogsUrl: `${host}/conversation/{conversationId}/dialogs`,
conversationMessageDeletionUrl: `${host}/conversation/{conversationId}/message/{messageId}`,
Expand Down
5 changes: 3 additions & 2 deletions src/lib/services/conversation-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,10 @@ export async function getConversations(filter) {
* Get conversation files
* @param {string} conversationId
* @param {string} messageId
* @param {string} source
*/
export async function getConversationFiles(conversationId, messageId) {
const url = replaceUrl(endpoints.conversationAttachmentUrl, { conversationId: conversationId, messageId: messageId });
export async function getConversationFiles(conversationId, messageId, source) {
const url = replaceUrl(endpoints.conversationAttachmentUrl, { conversationId: conversationId, messageId: messageId, source: source });
const response = await axios.get(url);
return response?.data;
}
Expand Down
4 changes: 2 additions & 2 deletions src/routes/chat/[agentId]/[conversationId]/chat-box.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
import ChatTextArea from '$lib/common/ChatTextArea.svelte';
import { utcToLocal } from '$lib/helpers/datetime';
import { replaceNewLine } from '$lib/helpers/http';
import { EditorType, SenderAction, UserRole } from '$lib/helpers/enums';
import { EditorType, FileSourceType, SenderAction, UserRole } from '$lib/helpers/enums';
import { loadFileGallery, loadLocalFiles } from '$lib/helpers/utils/gallery';
import RichContent from './rich-content/rich-content.svelte';
import RcMessage from "./rich-content/rc-message.svelte";
Expand Down Expand Up @@ -995,7 +995,7 @@
{#if message.is_load_images || USER_SENDERS.includes(message.sender?.role)}
<MessageImageGallery
galleryStyles={'justify-content: flex-end;'}
fetchFiles={() => getConversationFiles(params.conversationId, message.message_id)}
fetchFiles={() => getConversationFiles(params.conversationId, message.message_id, FileSourceType.User)}
/>
{/if}
</div>
Expand Down
3 changes: 2 additions & 1 deletion src/routes/page/agent/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
name: 'New Agent',
description: 'New Agent Description',
instruction: 'New Agent Instructions',
isPublic: true
};
// @ts-ignore
const createdAgent = await createAgent(newAgent);
Expand Down Expand Up @@ -113,7 +114,7 @@
<HeadTitle title="{$_('List')}" />
<Breadcrumb title="{$_('Agent')}" pagetitle="{$_('List')}" />

{#if !!user && user.role == UserRole.Admin}
{#if !!user}
<Button class="mb-4" color="primary" on:click={() => createNewAgent()}>
<i class="bx bx-copy" /> {$_('New Agent')}
</Button>
Expand Down
2 changes: 2 additions & 0 deletions src/routes/page/agent/[agentId]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@
function handleAgentUpdate() {
fetchJsonContent();
isLoading = true;
agent.description = agent.description || '';
agent.instruction = agent.instruction || '';
saveAgent(agent).then(res => {
isLoading = false;
isComplete = true;
Expand Down
4 changes: 2 additions & 2 deletions src/routes/page/agent/[agentId]/agent-llm-config.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
<div class="col-md-9 config-item-container">
<Input type="select" value={config.provider} on:change={e => changeProvider(e)}>
{#each providers as option}
<option value={option}>{option}</option>
<option value={option} selected={option == config.provider}>{option}</option>
{/each}
</Input>
</div>
Expand All @@ -91,7 +91,7 @@
<div class="col-md-9">
<Input type="select" value={config.model} disabled={models.length === 0} on:change={e => changeModel(e)}>
{#each models as option}
<option value={option.name}>{option.name}</option>
<option value={option.name} selected={option.name == config.model}>{option.name}</option>
{/each}
</Input>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/routes/page/agent/card-agent.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

{#each agents as agent}
<Col xl="4" sm="6">
<Card>
<Card style={"height: 95%;"}>
<CardBody>
<div class="d-flex">
<div class="avatar-md me-4">
Expand Down
2 changes: 1 addition & 1 deletion src/routes/page/conversation/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@
<DropdownToggle type="menu" class="btn" id="dropdownMenuButton1">
<i class="mdi mdi-dots-vertical" />
</DropdownToggle>
<DropdownMenu>
<DropdownMenu class="conv-state-search-menu">
<DropdownItem
on:click={() => toggleSearchStateModal()}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import Markdown from '$lib/common/Markdown.svelte';
import MessageImageGallery from '$lib/common/MessageImageGallery.svelte';
import { loadFileGallery } from '$lib/helpers/utils/gallery';
import { FileSourceType } from '$lib/helpers/enums';

/** @type {import('$types').ChatResponseModel[]} */
let dialogs = [];
Expand Down Expand Up @@ -81,7 +82,7 @@
</div>
<div class="flex-grow-1">
<div>
<span>{dialog.sender.full_name}</span>
<span>{dialog.sender?.full_name || dialog.sender?.user_name || 'Unkown'}</span>
<span class="text-muted ms-2" style="font-size: 0.7rem;">{utcToLocal(dialog.created_at)}</span>
</div>
<div>
Expand All @@ -91,7 +92,7 @@
{#if dialog.is_load_images || showInRight(dialog)}
<MessageImageGallery
galleryClasses={'dialog-file-display'}
fetchFiles={() => getConversationFiles(conversation.id, dialog.message_id)}
fetchFiles={() => getConversationFiles(conversation.id, dialog.message_id, FileSourceType.User)}
/>
{/if}
</div>
Expand Down