mirror of
https://github.com/open-webui/open-webui
synced 2025-06-26 18:26:48 +00:00
refac
This commit is contained in:
@@ -286,13 +286,15 @@
|
||||
</FunctionMenu>
|
||||
|
||||
<div class=" self-center mx-1">
|
||||
<Switch
|
||||
bind:state={func.is_active}
|
||||
on:change={async (e) => {
|
||||
toggleFunctionById(localStorage.token, func.id);
|
||||
models.set(await getModels(localStorage.token));
|
||||
}}
|
||||
/>
|
||||
<Tooltip content={func.is_active ? 'Enabled' : 'Disabled'}>
|
||||
<Switch
|
||||
bind:state={func.is_active}
|
||||
on:change={async (e) => {
|
||||
toggleFunctionById(localStorage.token, func.id);
|
||||
models.set(await getModels(localStorage.token));
|
||||
}}
|
||||
/>
|
||||
</Tooltip>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
import { toast } from 'svelte-sonner';
|
||||
import { goto } from '$app/navigation';
|
||||
import { settings, user, config, models, tools } from '$lib/stores';
|
||||
import { settings, user, config, models, tools, functions } from '$lib/stores';
|
||||
|
||||
import TurndownService from 'turndown';
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
import ToolsSelector from '$lib/components/workspace/Models/ToolsSelector.svelte';
|
||||
import { stringify } from 'postcss';
|
||||
import { parseFile } from '$lib/utils/characters';
|
||||
import FiltersSelector from '$lib/components/workspace/Models/FiltersSelector.svelte';
|
||||
|
||||
const i18n = getContext('i18n');
|
||||
|
||||
@@ -61,6 +62,7 @@
|
||||
|
||||
let toolIds = [];
|
||||
let knowledge = [];
|
||||
let filterIds = [];
|
||||
|
||||
$: if (name) {
|
||||
id = name
|
||||
@@ -105,6 +107,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) {
|
||||
@@ -173,6 +183,10 @@
|
||||
capabilities = { ...capabilities, ...(model?.info?.meta?.capabilities ?? {}) };
|
||||
toolIds = model?.info?.meta?.toolIds ?? [];
|
||||
|
||||
if (model?.info?.meta?.filterIds) {
|
||||
filterIds = [...model?.info?.meta?.filterIds];
|
||||
}
|
||||
|
||||
info = {
|
||||
...info,
|
||||
...model.info
|
||||
@@ -604,6 +618,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-1">
|
||||
<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