mirror of
https://github.com/open-webui/open-webui.git
synced 2026-02-24 04:00:31 +01:00
feat: default model metadata & params
This commit is contained in:
@@ -1263,6 +1263,18 @@ MODEL_ORDER_LIST = PersistentConfig(
|
||||
[],
|
||||
)
|
||||
|
||||
DEFAULT_MODEL_METADATA = PersistentConfig(
|
||||
"DEFAULT_MODEL_METADATA",
|
||||
"models.default_metadata",
|
||||
{},
|
||||
)
|
||||
|
||||
DEFAULT_MODEL_PARAMS = PersistentConfig(
|
||||
"DEFAULT_MODEL_PARAMS",
|
||||
"models.default_params",
|
||||
{},
|
||||
)
|
||||
|
||||
DEFAULT_USER_ROLE = PersistentConfig(
|
||||
"DEFAULT_USER_ROLE",
|
||||
"ui.default_user_role",
|
||||
|
||||
@@ -394,6 +394,8 @@ from open_webui.config import (
|
||||
DEFAULT_PINNED_MODELS,
|
||||
DEFAULT_ARENA_MODEL,
|
||||
MODEL_ORDER_LIST,
|
||||
DEFAULT_MODEL_METADATA,
|
||||
DEFAULT_MODEL_PARAMS,
|
||||
EVALUATION_ARENA_MODELS,
|
||||
# WebUI (OAuth)
|
||||
ENABLE_OAUTH_ROLE_MANAGEMENT,
|
||||
@@ -822,6 +824,8 @@ app.state.config.ADMIN_EMAIL = ADMIN_EMAIL
|
||||
app.state.config.DEFAULT_MODELS = DEFAULT_MODELS
|
||||
app.state.config.DEFAULT_PINNED_MODELS = DEFAULT_PINNED_MODELS
|
||||
app.state.config.MODEL_ORDER_LIST = MODEL_ORDER_LIST
|
||||
app.state.config.DEFAULT_MODEL_METADATA = DEFAULT_MODEL_METADATA
|
||||
app.state.config.DEFAULT_MODEL_PARAMS = DEFAULT_MODEL_PARAMS
|
||||
|
||||
|
||||
app.state.config.DEFAULT_PROMPT_SUGGESTIONS = DEFAULT_PROMPT_SUGGESTIONS
|
||||
@@ -1688,9 +1692,14 @@ async def chat_completion(
|
||||
request.state.direct = True
|
||||
request.state.model = model
|
||||
|
||||
model_info_params = (
|
||||
model_info.params.model_dump() if model_info and model_info.params else {}
|
||||
# Model params: global defaults as base, per-model overrides win
|
||||
default_model_params = (
|
||||
getattr(request.app.state.config, "DEFAULT_MODEL_PARAMS", None) or {}
|
||||
)
|
||||
model_info_params = {
|
||||
**default_model_params,
|
||||
**(model_info.params.model_dump() if model_info and model_info.params else {}),
|
||||
}
|
||||
|
||||
# Check base model existence for custom models
|
||||
if model_info_params.get("base_model_id"):
|
||||
|
||||
@@ -467,6 +467,8 @@ class ModelsConfigForm(BaseModel):
|
||||
DEFAULT_MODELS: Optional[str]
|
||||
DEFAULT_PINNED_MODELS: Optional[str]
|
||||
MODEL_ORDER_LIST: Optional[list[str]]
|
||||
DEFAULT_MODEL_METADATA: Optional[dict] = None
|
||||
DEFAULT_MODEL_PARAMS: Optional[dict] = None
|
||||
|
||||
|
||||
@router.get("/models", response_model=ModelsConfigForm)
|
||||
@@ -475,6 +477,8 @@ async def get_models_config(request: Request, user=Depends(get_admin_user)):
|
||||
"DEFAULT_MODELS": request.app.state.config.DEFAULT_MODELS,
|
||||
"DEFAULT_PINNED_MODELS": request.app.state.config.DEFAULT_PINNED_MODELS,
|
||||
"MODEL_ORDER_LIST": request.app.state.config.MODEL_ORDER_LIST,
|
||||
"DEFAULT_MODEL_METADATA": request.app.state.config.DEFAULT_MODEL_METADATA,
|
||||
"DEFAULT_MODEL_PARAMS": request.app.state.config.DEFAULT_MODEL_PARAMS,
|
||||
}
|
||||
|
||||
|
||||
@@ -485,10 +489,14 @@ async def set_models_config(
|
||||
request.app.state.config.DEFAULT_MODELS = form_data.DEFAULT_MODELS
|
||||
request.app.state.config.DEFAULT_PINNED_MODELS = form_data.DEFAULT_PINNED_MODELS
|
||||
request.app.state.config.MODEL_ORDER_LIST = form_data.MODEL_ORDER_LIST
|
||||
request.app.state.config.DEFAULT_MODEL_METADATA = form_data.DEFAULT_MODEL_METADATA
|
||||
request.app.state.config.DEFAULT_MODEL_PARAMS = form_data.DEFAULT_MODEL_PARAMS
|
||||
return {
|
||||
"DEFAULT_MODELS": request.app.state.config.DEFAULT_MODELS,
|
||||
"DEFAULT_PINNED_MODELS": request.app.state.config.DEFAULT_PINNED_MODELS,
|
||||
"MODEL_ORDER_LIST": request.app.state.config.MODEL_ORDER_LIST,
|
||||
"DEFAULT_MODEL_METADATA": request.app.state.config.DEFAULT_MODEL_METADATA,
|
||||
"DEFAULT_MODEL_PARAMS": request.app.state.config.DEFAULT_MODEL_PARAMS,
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import copy
|
||||
import time
|
||||
import logging
|
||||
import asyncio
|
||||
@@ -307,6 +308,29 @@ async def get_all_models(request, refresh: bool = False, user: UserModel = None)
|
||||
except Exception as e:
|
||||
log.info(f"Failed to load function module for {function_id}: {e}")
|
||||
|
||||
# Apply global model defaults to all models
|
||||
# Per-model overrides take precedence over global defaults
|
||||
default_metadata = (
|
||||
getattr(request.app.state.config, "DEFAULT_MODEL_METADATA", None) or {}
|
||||
)
|
||||
|
||||
if default_metadata:
|
||||
for model in models:
|
||||
info = model.get("info")
|
||||
|
||||
if info is None:
|
||||
model["info"] = {"meta": copy.deepcopy(default_metadata)}
|
||||
continue
|
||||
|
||||
meta = info.setdefault("meta", {})
|
||||
for key, value in default_metadata.items():
|
||||
if key == "capabilities":
|
||||
# Merge capabilities: defaults as base, per-model overrides win
|
||||
existing = meta.get("capabilities") or {}
|
||||
meta["capabilities"] = {**value, **existing}
|
||||
elif meta.get(key) is None:
|
||||
meta[key] = copy.deepcopy(value)
|
||||
|
||||
for model in models:
|
||||
action_ids = [
|
||||
action_id
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
const dispatch = createEventDispatcher();
|
||||
|
||||
import { models } from '$lib/stores';
|
||||
import { DEFAULT_CAPABILITIES } from '$lib/constants';
|
||||
import { deleteAllModels } from '$lib/apis/models';
|
||||
import { getModelsConfig, setModelsConfig } from '$lib/apis/configs';
|
||||
|
||||
@@ -21,12 +22,22 @@
|
||||
import XMark from '$lib/components/icons/XMark.svelte';
|
||||
import ModelSelector from './ModelSelector.svelte';
|
||||
import Model from '../Evaluations/Model.svelte';
|
||||
import AdvancedParams from '$lib/components/chat/Settings/Advanced/AdvancedParams.svelte';
|
||||
|
||||
import Capabilities from '$lib/components/workspace/Models/Capabilities.svelte';
|
||||
import DefaultFeatures from '$lib/components/workspace/Models/DefaultFeatures.svelte';
|
||||
import BuiltinTools from '$lib/components/workspace/Models/BuiltinTools.svelte';
|
||||
|
||||
import AdjustmentsHorizontal from '$lib/components/icons/AdjustmentsHorizontal.svelte';
|
||||
import Eye from '$lib/components/icons/Eye.svelte';
|
||||
|
||||
export let show = false;
|
||||
export let initHandler = () => {};
|
||||
|
||||
let config = null;
|
||||
|
||||
let selectedTab = 'defaults';
|
||||
|
||||
let selectedModelId = '';
|
||||
let defaultModelIds = [];
|
||||
|
||||
@@ -40,6 +51,13 @@
|
||||
|
||||
let loading = false;
|
||||
let showResetModal = false;
|
||||
let showDefaultCapabilities = false;
|
||||
let showDefaultParams = false;
|
||||
|
||||
let defaultCapabilities = {};
|
||||
let defaultFeatureIds = [];
|
||||
let defaultParams = {};
|
||||
let builtinTools = {};
|
||||
|
||||
$: if (show) {
|
||||
init();
|
||||
@@ -74,14 +92,36 @@
|
||||
|
||||
sortKey = '';
|
||||
sortOrder = '';
|
||||
|
||||
const savedMeta = config?.DEFAULT_MODEL_METADATA;
|
||||
if (savedMeta && Object.keys(savedMeta).length > 0) {
|
||||
defaultCapabilities = savedMeta.capabilities ?? { ...DEFAULT_CAPABILITIES };
|
||||
defaultFeatureIds = savedMeta.defaultFeatureIds ?? [];
|
||||
builtinTools = savedMeta.builtinTools ?? {};
|
||||
} else {
|
||||
defaultCapabilities = { ...DEFAULT_CAPABILITIES };
|
||||
defaultFeatureIds = [];
|
||||
builtinTools = {};
|
||||
}
|
||||
defaultParams = config?.DEFAULT_MODEL_PARAMS ?? {};
|
||||
};
|
||||
const submitHandler = async () => {
|
||||
loading = true;
|
||||
|
||||
const metadata = {
|
||||
capabilities: defaultCapabilities,
|
||||
...(defaultFeatureIds.length > 0 ? { defaultFeatureIds } : {}),
|
||||
...(Object.keys(builtinTools).length > 0 ? { builtinTools } : {})
|
||||
};
|
||||
|
||||
const res = await setModelsConfig(localStorage.token, {
|
||||
DEFAULT_MODELS: defaultModelIds.join(','),
|
||||
DEFAULT_PINNED_MODELS: defaultPinnedModelIds.join(','),
|
||||
MODEL_ORDER_LIST: modelIds
|
||||
MODEL_ORDER_LIST: modelIds,
|
||||
DEFAULT_MODEL_METADATA: metadata,
|
||||
DEFAULT_MODEL_PARAMS: Object.fromEntries(
|
||||
Object.entries(defaultParams).filter(([_, v]) => v !== null && v !== '' && v !== undefined)
|
||||
)
|
||||
});
|
||||
|
||||
if (res) {
|
||||
@@ -113,7 +153,7 @@
|
||||
}}
|
||||
/>
|
||||
|
||||
<Modal size="sm" bind:show>
|
||||
<Modal size="lg" bind:show>
|
||||
<div>
|
||||
<div class=" flex justify-between dark:text-gray-100 px-5 pt-4 pb-2">
|
||||
<div class=" text-lg font-medium self-center font-primary">
|
||||
@@ -129,7 +169,7 @@
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col md:flex-row w-full px-5 pb-4 md:space-x-4 dark:text-gray-200">
|
||||
<div class="flex flex-col md:flex-row w-full px-4 pb-4 md:space-x-4 dark:text-gray-200">
|
||||
<div class=" flex flex-col w-full sm:flex-row sm:justify-center sm:space-x-6">
|
||||
{#if config}
|
||||
<form
|
||||
@@ -138,97 +178,236 @@
|
||||
submitHandler();
|
||||
}}
|
||||
>
|
||||
<div>
|
||||
<div class="flex flex-col w-full">
|
||||
<button
|
||||
class="mb-1 flex gap-2"
|
||||
type="button"
|
||||
on:click={() => {
|
||||
sortKey = 'model';
|
||||
|
||||
if (sortOrder === 'asc') {
|
||||
sortOrder = 'desc';
|
||||
} else {
|
||||
sortOrder = 'asc';
|
||||
}
|
||||
|
||||
modelIds = modelIds
|
||||
.filter((id) => id !== '')
|
||||
.sort((a, b) => {
|
||||
const nameA = $models.find((model) => model.id === a)?.name || a;
|
||||
const nameB = $models.find((model) => model.id === b)?.name || b;
|
||||
return sortOrder === 'desc'
|
||||
? nameA.localeCompare(nameB)
|
||||
: nameB.localeCompare(nameA);
|
||||
});
|
||||
}}
|
||||
>
|
||||
<div class="text-xs text-gray-500">{$i18n.t('Reorder Models')}</div>
|
||||
|
||||
{#if sortKey === 'model'}
|
||||
<span class="font-normal self-center">
|
||||
{#if sortOrder === 'asc'}
|
||||
<ChevronUp className="size-3" />
|
||||
{:else}
|
||||
<ChevronDown className="size-3" />
|
||||
{/if}
|
||||
</span>
|
||||
{:else}
|
||||
<span class="invisible">
|
||||
<ChevronUp className="size-3" />
|
||||
</span>
|
||||
{/if}
|
||||
</button>
|
||||
|
||||
<ModelList bind:modelIds />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr class=" border-gray-100 dark:border-gray-700/10 my-2.5 w-full" />
|
||||
|
||||
<ModelSelector
|
||||
title={$i18n.t('Default Models')}
|
||||
models={$models}
|
||||
bind:modelIds={defaultModelIds}
|
||||
/>
|
||||
|
||||
<hr class=" border-gray-100 dark:border-gray-700/10 my-2.5 w-full" />
|
||||
|
||||
<ModelSelector
|
||||
title={$i18n.t('Default Pinned Models')}
|
||||
models={$models}
|
||||
bind:modelIds={defaultPinnedModelIds}
|
||||
/>
|
||||
|
||||
<div class="flex justify-between pt-3 text-sm font-medium gap-1.5">
|
||||
<Tooltip content={$i18n.t('This will delete all models including custom models')}>
|
||||
<button
|
||||
class="px-3.5 py-1.5 text-sm font-medium dark:bg-black dark:hover:bg-gray-950 dark:text-white bg-white text-black hover:bg-gray-100 transition rounded-full flex flex-row space-x-1 items-center"
|
||||
type="button"
|
||||
on:click={() => {
|
||||
showResetModal = true;
|
||||
}}
|
||||
>
|
||||
<!-- {$i18n.t('Delete All Models')} -->
|
||||
{$i18n.t('Reset All Models')}
|
||||
</button>
|
||||
</Tooltip>
|
||||
|
||||
<button
|
||||
class="px-3.5 py-1.5 text-sm font-medium bg-black hover:bg-gray-900 text-white dark:bg-white dark:text-black dark:hover:bg-gray-100 transition rounded-full flex flex-row space-x-1 items-center {loading
|
||||
? ' cursor-not-allowed'
|
||||
: ''}"
|
||||
type="submit"
|
||||
disabled={loading}
|
||||
<div class="flex flex-col lg:flex-row w-full h-full pb-2 lg:space-x-4">
|
||||
<div
|
||||
id="admin-settings-tabs-container"
|
||||
class="tabs flex flex-row overflow-x-auto gap-2.5 max-w-full lg:gap-1 lg:flex-col lg:flex-none lg:w-40 dark:text-gray-200 text-sm font-medium text-left scrollbar-none"
|
||||
>
|
||||
{$i18n.t('Save')}
|
||||
|
||||
{#if loading}
|
||||
<div class="ml-2 self-center">
|
||||
<Spinner />
|
||||
<button
|
||||
class="px-0.5 py-1 max-w-fit w-fit rounded-lg flex-1 lg:flex-none flex text-right transition {selectedTab ===
|
||||
'defaults'
|
||||
? ''
|
||||
: ' text-gray-300 dark:text-gray-600 hover:text-gray-700 dark:hover:text-white'}"
|
||||
on:click={() => {
|
||||
selectedTab = 'defaults';
|
||||
}}
|
||||
type="button"
|
||||
>
|
||||
<div class=" self-center mr-2">
|
||||
<AdjustmentsHorizontal />
|
||||
</div>
|
||||
{/if}
|
||||
</button>
|
||||
<div class=" self-center">{$i18n.t('Defaults')}</div>
|
||||
</button>
|
||||
|
||||
<button
|
||||
class="px-0.5 py-1 max-w-fit w-fit rounded-lg flex-1 lg:flex-none flex text-right transition {selectedTab ===
|
||||
'display'
|
||||
? ''
|
||||
: ' text-gray-300 dark:text-gray-600 hover:text-gray-700 dark:hover:text-white'}"
|
||||
on:click={() => {
|
||||
selectedTab = 'display';
|
||||
}}
|
||||
type="button"
|
||||
>
|
||||
<div class=" self-center mr-2">
|
||||
<Eye />
|
||||
</div>
|
||||
<div class=" self-center">{$i18n.t('Display')}</div>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="flex-1 mt-1 lg:mt-1 lg:h-[30rem] lg:max-h-[30rem] flex flex-col min-w-0">
|
||||
<div class="w-full h-full overflow-y-auto overflow-x-hidden scrollbar-hidden">
|
||||
{#if selectedTab === 'defaults'}
|
||||
<ModelSelector
|
||||
title={$i18n.t('Selected Models')}
|
||||
tooltip={$i18n.t(
|
||||
'Set the default models that are automatically selected for all users when a new chat is created.'
|
||||
)}
|
||||
models={$models}
|
||||
bind:modelIds={defaultModelIds}
|
||||
/>
|
||||
|
||||
<hr class=" border-gray-100 dark:border-gray-700/10 my-2.5 w-full" />
|
||||
|
||||
<ModelSelector
|
||||
title={$i18n.t('Pinned Models')}
|
||||
tooltip={$i18n.t(
|
||||
'Set the models that are automatically pinned to the sidebar for all users.'
|
||||
)}
|
||||
models={$models}
|
||||
bind:modelIds={defaultPinnedModelIds}
|
||||
/>
|
||||
|
||||
<hr class=" border-gray-100 dark:border-gray-700/10 my-2.5 w-full" />
|
||||
|
||||
<div>
|
||||
<button
|
||||
class="flex w-full justify-between items-center"
|
||||
type="button"
|
||||
on:click={() => {
|
||||
showDefaultCapabilities = !showDefaultCapabilities;
|
||||
}}
|
||||
>
|
||||
<div class="text-xs text-gray-500 font-medium">
|
||||
{$i18n.t('Model Capabilities')}
|
||||
</div>
|
||||
<div>
|
||||
{#if showDefaultCapabilities}
|
||||
<ChevronUp className="size-3" />
|
||||
{:else}
|
||||
<ChevronDown className="size-3" />
|
||||
{/if}
|
||||
</div>
|
||||
</button>
|
||||
|
||||
{#if showDefaultCapabilities}
|
||||
<div class="mt-2">
|
||||
<Capabilities bind:capabilities={defaultCapabilities} />
|
||||
|
||||
{#if Object.keys(defaultCapabilities).filter((key) => defaultCapabilities[key]).length > 0}
|
||||
{@const availableFeatures = Object.entries(defaultCapabilities)
|
||||
.filter(
|
||||
([key, value]) =>
|
||||
value &&
|
||||
['web_search', 'code_interpreter', 'image_generation'].includes(
|
||||
key
|
||||
)
|
||||
)
|
||||
.map(([key, value]) => key)}
|
||||
|
||||
{#if availableFeatures.length > 0}
|
||||
<div class="mt-4">
|
||||
<DefaultFeatures
|
||||
{availableFeatures}
|
||||
bind:featureIds={defaultFeatureIds}
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
{#if defaultCapabilities.builtin_tools}
|
||||
<div class="mt-4">
|
||||
<BuiltinTools bind:builtinTools />
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<hr class=" border-gray-100 dark:border-gray-700/10 my-2.5 w-full" />
|
||||
|
||||
<div>
|
||||
<button
|
||||
class="flex w-full justify-between items-center"
|
||||
type="button"
|
||||
on:click={() => {
|
||||
showDefaultParams = !showDefaultParams;
|
||||
}}
|
||||
>
|
||||
<div class="text-xs text-gray-500 font-medium">
|
||||
{$i18n.t('Model Parameters')}
|
||||
</div>
|
||||
<div>
|
||||
{#if showDefaultParams}
|
||||
<ChevronUp className="size-3" />
|
||||
{:else}
|
||||
<ChevronDown className="size-3" />
|
||||
{/if}
|
||||
</div>
|
||||
</button>
|
||||
|
||||
{#if showDefaultParams}
|
||||
<div class="mt-2">
|
||||
<AdvancedParams admin={true} bind:params={defaultParams} />
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{:else if selectedTab === 'display'}
|
||||
<div>
|
||||
<div class="flex flex-col w-full">
|
||||
<button
|
||||
class="mb-1 flex gap-2"
|
||||
type="button"
|
||||
on:click={() => {
|
||||
sortKey = 'model';
|
||||
|
||||
if (sortOrder === 'asc') {
|
||||
sortOrder = 'desc';
|
||||
} else {
|
||||
sortOrder = 'asc';
|
||||
}
|
||||
|
||||
modelIds = modelIds
|
||||
.filter((id) => id !== '')
|
||||
.sort((a, b) => {
|
||||
const nameA = $models.find((model) => model.id === a)?.name || a;
|
||||
const nameB = $models.find((model) => model.id === b)?.name || b;
|
||||
return sortOrder === 'desc'
|
||||
? nameA.localeCompare(nameB)
|
||||
: nameB.localeCompare(nameA);
|
||||
});
|
||||
}}
|
||||
>
|
||||
<div class="text-xs text-gray-500">{$i18n.t('Reorder Models')}</div>
|
||||
|
||||
{#if sortKey === 'model'}
|
||||
<span class="font-normal self-center">
|
||||
{#if sortOrder === 'asc'}
|
||||
<ChevronUp className="size-3" />
|
||||
{:else}
|
||||
<ChevronDown className="size-3" />
|
||||
{/if}
|
||||
</span>
|
||||
{:else}
|
||||
<span class="invisible">
|
||||
<ChevronUp className="size-3" />
|
||||
</span>
|
||||
{/if}
|
||||
</button>
|
||||
|
||||
<ModelList bind:modelIds />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr class=" border-gray-100 dark:border-gray-700/10 my-2.5 w-full" />
|
||||
|
||||
<div>
|
||||
<Tooltip
|
||||
content={$i18n.t('This will delete all models including custom models')}
|
||||
>
|
||||
<button
|
||||
class="px-3.5 py-1.5 text-sm font-medium dark:bg-black dark:hover:bg-gray-950 dark:text-white bg-white text-black hover:bg-gray-100 transition rounded-full flex flex-row space-x-1 items-center"
|
||||
type="button"
|
||||
on:click={() => {
|
||||
showResetModal = true;
|
||||
}}
|
||||
>
|
||||
{$i18n.t('Reset All Models')}
|
||||
</button>
|
||||
</Tooltip>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<div class="flex justify-end pt-3 text-sm font-medium gap-1.5">
|
||||
<button
|
||||
class="px-3.5 py-1.5 text-sm font-medium bg-black hover:bg-gray-900 text-white dark:bg-white dark:text-black dark:hover:bg-gray-100 transition rounded-full flex flex-row space-x-1 items-center {loading
|
||||
? ' cursor-not-allowed'
|
||||
: ''}"
|
||||
type="submit"
|
||||
disabled={loading}
|
||||
>
|
||||
{$i18n.t('Save')}
|
||||
|
||||
{#if loading}
|
||||
<div class="ml-2 self-center">
|
||||
<Spinner />
|
||||
</div>
|
||||
{/if}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
{:else}
|
||||
|
||||
@@ -3,8 +3,10 @@
|
||||
const i18n = getContext('i18n');
|
||||
|
||||
import Minus from '$lib/components/icons/Minus.svelte';
|
||||
import Tooltip from '$lib/components/common/Tooltip.svelte';
|
||||
|
||||
export let title = '';
|
||||
export let tooltip = '';
|
||||
export let models = [];
|
||||
export let modelIds = [];
|
||||
|
||||
@@ -14,7 +16,27 @@
|
||||
<div>
|
||||
<div class="flex flex-col w-full">
|
||||
<div class="mb-1 flex justify-between">
|
||||
<div class="text-xs text-gray-500">{title}</div>
|
||||
<div class="text-xs text-gray-500 flex items-center gap-1">
|
||||
{title}
|
||||
{#if tooltip}
|
||||
<Tooltip content={tooltip} className="cursor-help">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
fill="none"
|
||||
viewBox="0 0 24 24"
|
||||
stroke-width="1.5"
|
||||
stroke="currentColor"
|
||||
class="size-3"
|
||||
>
|
||||
<path
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
d="m11.25 11.25.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9-3.75h.008v.008H12V8.25Z"
|
||||
/>
|
||||
</svg>
|
||||
</Tooltip>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center -mr-1">
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
import { onMount, getContext, tick } from 'svelte';
|
||||
import { models, tools, functions, user } from '$lib/stores';
|
||||
import { WEBUI_BASE_URL } from '$lib/constants';
|
||||
import { WEBUI_BASE_URL, DEFAULT_CAPABILITIES } from '$lib/constants';
|
||||
|
||||
import { getTools } from '$lib/apis/tools';
|
||||
import { getFunctions } from '$lib/apis/functions';
|
||||
@@ -95,18 +95,7 @@
|
||||
let filterIds = [];
|
||||
let defaultFilterIds = [];
|
||||
|
||||
let capabilities = {
|
||||
file_context: true,
|
||||
vision: true,
|
||||
file_upload: true,
|
||||
web_search: true,
|
||||
image_generation: true,
|
||||
code_interpreter: true,
|
||||
citations: true,
|
||||
status_updates: true,
|
||||
usage: undefined,
|
||||
builtin_tools: true
|
||||
};
|
||||
let capabilities = { ...DEFAULT_CAPABILITIES };
|
||||
let defaultFeatureIds = [];
|
||||
let builtinTools = {};
|
||||
|
||||
|
||||
@@ -95,6 +95,19 @@ export const SUPPORTED_FILE_EXTENSIONS = [
|
||||
'msg'
|
||||
];
|
||||
|
||||
export const DEFAULT_CAPABILITIES = {
|
||||
file_context: true,
|
||||
vision: true,
|
||||
file_upload: true,
|
||||
web_search: true,
|
||||
image_generation: true,
|
||||
code_interpreter: true,
|
||||
citations: true,
|
||||
status_updates: true,
|
||||
usage: undefined,
|
||||
builtin_tools: true
|
||||
};
|
||||
|
||||
export const PASTED_TEXT_CHARACTER_LIMIT = 1000;
|
||||
|
||||
// Source: https://kit.svelte.dev/docs/modules#$env-static-public
|
||||
|
||||
Reference in New Issue
Block a user