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 90%
rename from src/lib/scss/custom/components/_multiselect.scss
rename to src/lib/scss/custom/components/_select.scss
index 45e9909a..0271e5ff 100644
--- a/src/lib/scss/custom/components/_multiselect.scss
+++ b/src/lib/scss/custom/components/_select.scss
@@ -15,6 +15,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 @@
-
+
\ 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..e7a9ffbe 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 @@
@@ -68,24 +73,42 @@
Agent
-
selectAgent(e)}>
+
+ selectAgent(e)}
+ />
Template
-
selectTemplate(e)}>
+
+ selectTemplate(e)}
+ />
\ No newline at end of file
diff --git a/src/routes/page/instruction/log/+page.svelte b/src/routes/page/instruction/log/+page.svelte
index b0efd88c..118b81bd 100644
--- a/src/routes/page/instruction/log/+page.svelte
+++ b/src/routes/page/instruction/log/+page.svelte
@@ -14,6 +14,7 @@
import LogItem from './log-item.svelte';
import { removeDuplicates } from '$lib/helpers/utils/common';
import StateSearch from '$lib/common/StateSearch.svelte';
+ import Select from '$lib/common/Select.svelte';
import {
getPagingQueryParams,
setUrlQueryParams,
@@ -35,7 +36,7 @@
/** @type {import('$instructTypes').InstructionLogModel[]} */
let logItems = [];
- /** @type {import('$commonTypes').IdName[]} */
+ /** @type {import('$commonTypes').LabelValuePair[]} */
let agentOptions = [];
/** @type {import('$commonTypes').LlmConfig[]} */
@@ -49,9 +50,9 @@
/** @type {any} */
let searchOption = {
- agentId: null,
- provider: null,
- model: null,
+ agentIds: [],
+ providers: [],
+ models: [],
template: '',
states: []
};
@@ -93,8 +94,8 @@
getAgentOptions().then(res => {
agentOptions = res?.map(x => {
return {
- id: x.id,
- name: x.name
+ label: x.name || '',
+ value: x.id || ''
};
}) || [];
resolve(agentOptions);
@@ -110,10 +111,10 @@
getLlmConfigs().then(res => {
llmConfigs = res || [];
providerOptions = llmConfigs.map(x => ({
- id: x.provider,
- name: x.provider,
+ label: x.provider,
+ value: x.provider,
models: x.models || []
- })).sort((a, b) => a.name.localeCompare(b.name));
+ })).sort((a, b) => a.label.localeCompare(b.label));
modelOptions = [];
resolve(llmConfigs);
}).catch((error) => {
@@ -167,29 +168,36 @@
* @param {string} type
*/
function changeOption(e, type) {
- const value = e.target.value;
+ // @ts-ignore
+ const selectedValues = e.detail.selecteds?.map(x => x.value) || [];
+
if (type === 'agent') {
searchOption = {
...searchOption,
- agentId: value || null
+ agentIds: selectedValues
};
} else if (type === 'provider') {
searchOption = {
...searchOption,
- provider: value || null,
- model: null,
+ // @ts-ignore
+ providers: selectedValues,
+ models: [],
};
- const models = llmConfigs.find(x => x.provider === value)?.models?.map(x => ({
- id: x.name,
- name: x.name
- })) || [];
- const uniqueModels = removeDuplicates(models, 'id');
- modelOptions = uniqueModels.sort((a, b) => a.name.localeCompare(b.name)) || [];
+ if (selectedValues.length > 0) {
+ const models = llmConfigs.find(x => x.provider === selectedValues[0])?.models?.map(x => ({
+ label: x.name,
+ value: x.name
+ })) || [];
+ const uniqueModels = removeDuplicates(models, 'label');
+ modelOptions = uniqueModels.sort((a, b) => a.label.localeCompare(b.label)) || [];
+ } else {
+ modelOptions = [];
+ }
} else if (type === 'model') {
searchOption = {
...searchOption,
- model: value || null
+ models: selectedValues
};
}
}
@@ -201,18 +209,18 @@
}
function prepareFilter() {
- const agentId = searchOption.agentId || null;
- const provider = searchOption.provider || null;
- const model = searchOption.model || null;
+ const agentIds = searchOption.agentIds;
+ const providers = searchOption.providers;
+ const models = searchOption.models;
const template = util.trim(searchOption.template) || null;
const states = getSearchStates();
filter = {
...filter,
page: firstPage,
- agentIds: agentId ? [agentId] : [],
- providers: provider ? [provider] : [],
- models: model ? [model] : [],
+ agentIds: agentIds,
+ providers: providers,
+ models: models,
templateNames: template ? [template] : [],
states: states
};
@@ -251,7 +259,7 @@
getInstructionLogSearchKeys({
query: query,
keyLimit: 20,
- agentIds: searchOption.agentId ? [searchOption.agentId] : null
+ agentIds: searchOption.agentIds
}).then(res => {
resolve(res || []);
}).catch(() => resolve([]));
@@ -303,28 +311,38 @@
- changeOption(e, 'agent')}>
-
- {#each agentOptions as op}
-
- {/each}
-
+ changeOption(e, 'agent')}
+ />
- changeOption(e, 'provider')}>
-
- {#each providerOptions as op}
-
- {/each}
-
-
+ changeOption(e, 'provider')}
+ />
+
- changeOption(e, 'model')}>
-
- {#each modelOptions as op}
-
- {/each}
-
+ changeOption(e, 'model')}
+ />
diff --git a/src/routes/page/instruction/testing/+page.svelte b/src/routes/page/instruction/testing/+page.svelte
index cbc0cc7e..dfc25921 100644
--- a/src/routes/page/instruction/testing/+page.svelte
+++ b/src/routes/page/instruction/testing/+page.svelte
@@ -138,14 +138,15 @@
/** @param {any} e */
function onAgentSelected(e) {
selectedAgent = e.detail.agent || null;
- instruction = selectedAgent?.instruction || '';
+ let localText = selectedAgent?.instruction;
const template = e.detail.template || null;
selectedTemplate = template?.name || null;
if (!!template) {
- instruction = template?.content || '';
+ localText = template?.content;
}
+ instruction = localText || '';
const providerName = selectedAgent?.llm_config?.provider || null;
const modelName = selectedAgent?.llm_config?.model || null;
selectedProvider = llmConfigs?.find(x => x.provider === providerName) || null;