feat: filter selector model
This commit is contained in:
1 parent
bf5775e07a
commit
08cc20cb93
8 files changed
+117
-32
No files matched your search
@@ -5,7 +5,7 @@
|
||||
|
||||
import { onMount, getContext } from 'svelte';
|
||||
import { page } from '$app/stores';
|
||||
import { settings, user, config, models, tools } from '$lib/stores';
|
||||
import { settings, user, config, models, tools, functions } from '$lib/stores';
|
||||
import { splitStream } from '$lib/utils';
|
||||
|
||||
import { getModelInfos, updateModelById } from '$lib/apis/models';
|
||||
@@ -16,6 +16,7 @@
|
||||
import Tags from '$lib/components/common/Tags.svelte';
|
||||
import Knowledge from '$lib/components/workspace/Models/Knowledge.svelte';
|
||||
import ToolsSelector from '$lib/components/workspace/Models/ToolsSelector.svelte';
|
||||
import FiltersSelector from '$lib/components/workspace/Models/FiltersSelector.svelte';
|
||||
|
||||
const i18n = getContext('i18n');
|
||||
|
||||
@@ -62,6 +63,7 @@
|
||||
|
||||
let knowledge = [];
|
||||
let toolIds = [];
|
||||
let filterIds = [];
|
||||
|
||||
const updateHandler = async () => {
|
||||
loading = true;
|
||||
@@ -86,6 +88,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
if (filterIds.length > 0) {
|
||||
info.meta.filterIds = filterIds;
|
||||
} else {
|
||||
if (info.meta.filterIds) {
|
||||
delete info.meta.filterIds;
|
||||
}
|
||||
}
|
||||
|
||||
info.params.stop = params.stop ? params.stop.split(',').filter((s) => s.trim()) : null;
|
||||
Object.keys(info.params).forEach((key) => {
|
||||
if (info.params[key] === '' || info.params[key] === null) {
|
||||
@@ -147,6 +157,10 @@
|
||||
toolIds = [...model?.info?.meta?.toolIds];
|
||||
}
|
||||
|
||||
if (model?.info?.meta?.filterIds) {
|
||||
filterIds = [...model?.info?.meta?.filterIds];
|
||||
}
|
||||
|
||||
if (model?.owned_by === 'openai') {
|
||||
capabilities.usage = false;
|
||||
}
|
||||
@@ -534,6 +548,13 @@
|
||||
<ToolsSelector bind:selectedToolIds={toolIds} tools={$tools} />
|
||||
</div>
|
||||
|
||||
<div class="my-2">
|
||||
<FiltersSelector
|
||||
bind:selectedFilterIds={filterIds}
|
||||
filters={$functions.filter((func) => func.type === 'filter')}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="my-2">
|
||||
<div class="flex w-full justify-between mb-1">
|
||||
<div class=" self-center text-sm font-semibold">{$i18n.t('Capabilities')}</div>
|
||||
|
||||
Reference in new issue
Block a user