checkOption(null, option)}
+ on:click|preventDefault|stopPropagation={() => {
+ checkOption(null, option);
+ }}
>
checkOption(e, option)}
+ readonly
/>
diff --git a/src/lib/helpers/types/conversationTypes.js b/src/lib/helpers/types/conversationTypes.js
index a7b436f3..cfda9e15 100644
--- a/src/lib/helpers/types/conversationTypes.js
+++ b/src/lib/helpers/types/conversationTypes.js
@@ -7,6 +7,7 @@
* @typedef {Object} ConversationFilter
* @property {import('$commonTypes').Pagination} pager - Pagination
* @property {string?} [agentId] - The agent id.
+ * @property {string[]?} [agentIds] - The agent ids.
* @property {string?} [channel] - The conversation channel.
* @property {string?} [status] - The conversation status.
* @property {string?} [taskId] - The task id.
@@ -288,6 +289,7 @@ IRichContent.prototype.quick_replies;
/**
* @typedef {Object} ConversationSearchOption
* @property {string?} [agentId]
+ * @property {string[]} [agentIds]
* @property {string?} [channel]
* @property {string?} [taskId]
* @property {string?} [status]
diff --git a/src/lib/scss/app.scss b/src/lib/scss/app.scss
index 0a103e52..b7873393 100644
--- a/src/lib/scss/app.scss
+++ b/src/lib/scss/app.scss
@@ -43,7 +43,7 @@ File: Main Css File
@import "custom/components/file";
@import "custom/components/audio";
@import "custom/components/text";
-@import "custom/components/multiselect";
+@import "custom/components/select";
@import "custom/components/markdown";
@import "custom/components/state";
diff --git a/src/lib/scss/custom/components/_multiselect.scss b/src/lib/scss/custom/components/_select.scss
similarity index 82%
rename from src/lib/scss/custom/components/_multiselect.scss
rename to src/lib/scss/custom/components/_select.scss
index 45e9909a..f17fa349 100644
--- a/src/lib/scss/custom/components/_multiselect.scss
+++ b/src/lib/scss/custom/components/_select.scss
@@ -1,6 +1,17 @@
.multiselect-container {
position: relative;
+ &.disabled {
+ .display-container {
+ cursor: not-allowed;
+
+ .display-suffix {
+ opacity: 0.65;
+ cursor: not-allowed;
+ }
+ }
+ }
+
.display-container {
.display-suffix {
position: absolute;
@@ -15,6 +26,13 @@
input[type='text'] {
padding-right: 1.5rem;
+
+ &.disabled {
+ background-color: var(--bs-secondary-bg) !important;
+ color: var(--bs-secondary-color);
+ cursor: not-allowed;
+ opacity: 0.65;
+ }
}
.show-list {
diff --git a/src/routes/page/agent/+page.svelte b/src/routes/page/agent/+page.svelte
index 83efd7aa..0686b7b8 100644
--- a/src/routes/page/agent/+page.svelte
+++ b/src/routes/page/agent/+page.svelte
@@ -9,7 +9,7 @@
import HeadTitle from '$lib/common/HeadTitle.svelte';
import LoadingToComplete from '$lib/common/LoadingToComplete.svelte';
import PlainPagination from '$lib/common/PlainPagination.svelte';
- import MultiSelect from '$lib/common/MultiSelect.svelte';
+ import Select from '$lib/common/Select.svelte';
import { createAgent, getAgentLabels, getAgents } from '$lib/services/agent-service.js';
import { AgentType, GlobalEvent, UserPermission } from '$lib/helpers/enums';
import { myInfo } from '$lib/services/auth-service';
@@ -255,21 +255,23 @@
{/if}
-
selectAgentLabelOption(e)}
/>
- selectAgentTypeOption(e)}
/>
diff --git a/src/routes/page/conversation/+page.svelte b/src/routes/page/conversation/+page.svelte
index 0ba8ffac..34432978 100644
--- a/src/routes/page/conversation/+page.svelte
+++ b/src/routes/page/conversation/+page.svelte
@@ -18,6 +18,7 @@
import HeadTitle from '$lib/common/HeadTitle.svelte';
import TablePagination from '$lib/common/TablePagination.svelte';
import LoadingToComplete from '$lib/common/LoadingToComplete.svelte';
+ import Select from '$lib/common/Select.svelte';
import { getAgentOptions } from '$lib/services/agent-service';
import { getConversations, deleteConversation, getConversationStateSearchKeys } from '$lib/services/conversation-service.js';
import { utcToLocal } from '$lib/helpers/datetime';
@@ -55,23 +56,24 @@
/** @type {string[]} */
let searchStateStrs = [];
- /** @type {import('$commonTypes').IdName[]} */
+ /** @type {import('$commonTypes').LabelValuePair[]} */
let agentOptions = [];
- /** @type {import('$commonTypes').IdName[]} */
+ /** @type {import('$commonTypes').LabelValuePair[]} */
let statusOptions = [
- { id: 'open', name: 'Active' },
- { id: 'closed', name: 'Completed' }
+ { value: 'open', label: 'Active' },
+ { value: 'closed', label: 'Completed' }
];
- /** @type {import('$commonTypes').IdName[]} */
+ /** @type {import('$commonTypes').LabelValuePair[]} */
let channelOptions = Object.entries(ConversationChannel).map(([k, v]) => (
- { id: k.toLowerCase(), name: v }
+ { value: k.toLowerCase(), label: v }
));
/** @type {import('$conversationTypes').ConversationSearchOption} */
let searchOption = {
agentId: null,
+ agentIds: [],
channel: null,
status: null,
taskId: null,
@@ -134,8 +136,8 @@
getAgentOptions().then(res => {
agentOptions = res?.map(x => {
return {
- id: x.id,
- name: x.name
+ label: x.name || '',
+ value: x.id || ''
};
}) || [];
resolve(agentOptions);
@@ -276,6 +278,7 @@
filter = {
...filter,
agentId: searchOption.agentId,
+ agentIds: searchOption.agentIds,
channel: searchOption.channel,
status: searchOption.status,
taskId: searchOption.taskId,
@@ -339,25 +342,28 @@
* @param {string} type
*/
function changeOption(e, type) {
+ // @ts-ignore
+ const selectedValues = e?.detail?.selecteds?.map(x => x.value) || [];
+
if (type === 'agent') {
searchOption = {
...searchOption,
- agentId: e.target.value || null
+ agentIds: selectedValues
};
} else if (type === 'task') {
searchOption = {
...searchOption,
- taskId: e.target.value || null
+ taskId: selectedValues.length > 0 ? selectedValues[0] : null
};
} else if (type === 'channel') {
searchOption = {
...searchOption,
- channel: e.target.value || null
+ channel: selectedValues.length > 0 ? selectedValues[0] : null
};
} else if (type === 'status') {
searchOption = {
...searchOption,
- status: e.target.value || null
+ status: selectedValues.length > 0 ? selectedValues[0] : null
};
} else if (type === 'tags') {
searchOption = {
@@ -424,33 +430,46 @@
- changeOption(e, 'agent')}>
- {$_('Select Agent')}
- {#each agentOptions as op}
- {$_(`${op.name}`)}
- {/each}
-
+ changeOption(e, 'agent')}
+ />
- changeOption(e, 'task')}>
- {$_('Select Task')}
-
+ changeOption(e, 'task')}
+ />
- changeOption(e, 'status')}>
- {$_('Select Status')}
- {#each statusOptions as op}
- {$_(`${op.name}`)}
- {/each}
-
+ changeOption(e, 'status')}
+ />
- changeOption(e, 'channel')}>
- {$_('Select Channel')}
- {#each channelOptions as op}
- {$_(`${op.name}`)}
- {/each}
-
+ changeOption(e, 'channel')}
+ />
import { afterUpdate, createEventDispatcher, onMount } from 'svelte';
import { _ } from 'svelte-i18n';
+ import Select from '$lib/common/Select.svelte';
const svelteDispatch = createEventDispatcher();
@@ -16,7 +17,7 @@
/** @type {any} */
export let selectedModel = null;
- /** @type {any[]} */
+ /** @type {import('$commonTypes').LabelValuePair[]} */
let providerOptions = [];
/** @type {any[]} */
let modelOptions = [];
@@ -36,23 +37,25 @@
/** @param {import('$commonTypes').LlmConfig[]} llmConfigs */
function collectLlmOptions(llmConfigs) {
providerOptions = llmConfigs?.map(x => ({
- id: x.provider,
- name: x.provider
- }))?.sort((a, b) => a.name.localeCompare(b.name)) || [];
+ label: x.provider,
+ value: x.provider
+ }))?.sort((a, b) => a.label.localeCompare(b.label)) || [];
}
/** @param {any} e */
function selectProvider(e) {
- const selected = e.target.value || null;
- selectedProvider = llmConfigs?.find(x => x.provider === selected) || null;
+ // @ts-ignore
+ const selectedValues = e.detail.selecteds?.map(x => x.value) || [];
+ selectedProvider = llmConfigs?.find(x => x.provider === selectedValues[0]) || null;
onProviderChanged();
disPatchEvent();
}
/** @param {any} e */
function selectModel(e) {
- const selected = e.target.value || null;
- selectedModel = modelOptions.find(x => x.id === selected);
+ // @ts-ignore
+ const selectedValues = e.detail.selecteds?.map(x => x.value) || [];
+ selectedModel = modelOptions.find(x => x.id === selectedValues[0]);
disPatchEvent();
}
@@ -60,11 +63,13 @@
function onProviderChanged(targetModel = null) {
modelOptions = selectedProvider?.models?.map(x => ({
id: x.name,
- name: x.name
- }))?.sort((a, b) => a.name.localeCompare(b.name)) || [];
+ name: x.name,
+ label: x.name,
+ value: x.name
+ }))?.sort((a, b) => a.label.localeCompare(b.label)) || [];
if (!!targetModel) {
- selectedModel = modelOptions.find(x => x.name === targetModel) || null;
+ selectedModel = modelOptions.find(x => x.value === targetModel) || null;
} else {
selectedModel = modelOptions.length > 0 ? modelOptions[0] : null;
}
@@ -83,24 +88,42 @@
Provider
-
selectProvider(e)}>
+
+ selectProvider(e)}
+ />
Model
-
selectModel(e)}>
+
+ selectModel(e)}
+ />
\ No newline at end of file
diff --git a/src/routes/page/instruction/instruction-components/instruction-template.svelte b/src/routes/page/instruction/instruction-components/instruction-template.svelte
index 578f28b9..c828f454 100644
--- a/src/routes/page/instruction/instruction-components/instruction-template.svelte
+++ b/src/routes/page/instruction/instruction-components/instruction-template.svelte
@@ -1,6 +1,7 @@