mirror of
https://github.com/open-webui/open-webui
synced 2024-11-29 07:21:01 +00:00
refac: move functions (plugin) to admin panel
This commit is contained in:
parent
0cf1969adc
commit
947444949a
@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
import { WEBUI_NAME, config, functions, models } from '$lib/stores';
|
import { WEBUI_NAME, config, functions, models } from '$lib/stores';
|
||||||
import { onMount, getContext, tick } from 'svelte';
|
import { onMount, getContext, tick } from 'svelte';
|
||||||
import { createNewPrompt, deletePromptByCommand, getPrompts } from '$lib/apis/prompts';
|
|
||||||
|
|
||||||
import { goto } from '$app/navigation';
|
import { goto } from '$app/navigation';
|
||||||
import {
|
import {
|
||||||
@ -25,8 +24,8 @@
|
|||||||
import FunctionMenu from './Functions/FunctionMenu.svelte';
|
import FunctionMenu from './Functions/FunctionMenu.svelte';
|
||||||
import EllipsisHorizontal from '../icons/EllipsisHorizontal.svelte';
|
import EllipsisHorizontal from '../icons/EllipsisHorizontal.svelte';
|
||||||
import Switch from '../common/Switch.svelte';
|
import Switch from '../common/Switch.svelte';
|
||||||
import ValvesModal from './common/ValvesModal.svelte';
|
import ValvesModal from '../workspace/common/ValvesModal.svelte';
|
||||||
import ManifestModal from './common/ManifestModal.svelte';
|
import ManifestModal from '../workspace/common/ManifestModal.svelte';
|
||||||
import Heart from '../icons/Heart.svelte';
|
import Heart from '../icons/Heart.svelte';
|
||||||
import DeleteConfirmDialog from '$lib/components/common/ConfirmDialog.svelte';
|
import DeleteConfirmDialog from '$lib/components/common/ConfirmDialog.svelte';
|
||||||
import GarbageBin from '../icons/GarbageBin.svelte';
|
import GarbageBin from '../icons/GarbageBin.svelte';
|
||||||
@ -98,7 +97,7 @@
|
|||||||
id: `${_function.id}_clone`,
|
id: `${_function.id}_clone`,
|
||||||
name: `${_function.name} (Clone)`
|
name: `${_function.name} (Clone)`
|
||||||
});
|
});
|
||||||
goto('/workspace/functions/create');
|
goto('/admin/functions/create');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -210,7 +209,7 @@
|
|||||||
<div>
|
<div>
|
||||||
<a
|
<a
|
||||||
class=" px-2 py-2 rounded-xl hover:bg-gray-700/10 dark:hover:bg-gray-100/10 dark:text-gray-300 dark:hover:text-white transition font-medium text-sm flex items-center space-x-1"
|
class=" px-2 py-2 rounded-xl hover:bg-gray-700/10 dark:hover:bg-gray-100/10 dark:text-gray-300 dark:hover:text-white transition font-medium text-sm flex items-center space-x-1"
|
||||||
href="/workspace/functions/create"
|
href="/admin/functions/create"
|
||||||
>
|
>
|
||||||
<Plus className="size-3.5" />
|
<Plus className="size-3.5" />
|
||||||
</a>
|
</a>
|
||||||
@ -225,7 +224,7 @@
|
|||||||
>
|
>
|
||||||
<a
|
<a
|
||||||
class=" flex flex-1 space-x-3.5 cursor-pointer w-full"
|
class=" flex flex-1 space-x-3.5 cursor-pointer w-full"
|
||||||
href={`/workspace/functions/edit?id=${encodeURIComponent(func.id)}`}
|
href={`/admin/functions/edit?id=${encodeURIComponent(func.id)}`}
|
||||||
>
|
>
|
||||||
<div class="flex items-center text-left">
|
<div class="flex items-center text-left">
|
||||||
<div class=" flex-1 self-center pl-1">
|
<div class=" flex-1 self-center pl-1">
|
||||||
@ -322,7 +321,7 @@
|
|||||||
<FunctionMenu
|
<FunctionMenu
|
||||||
{func}
|
{func}
|
||||||
editHandler={() => {
|
editHandler={() => {
|
||||||
goto(`/workspace/functions/edit?id=${encodeURIComponent(func.id)}`);
|
goto(`/admin/functions/edit?id=${encodeURIComponent(func.id)}`);
|
||||||
}}
|
}}
|
||||||
shareHandler={() => {
|
shareHandler={() => {
|
||||||
shareHandler(func);
|
shareHandler(func);
|
@ -305,7 +305,7 @@ class Pipe:
|
|||||||
<button
|
<button
|
||||||
class="w-full text-left text-sm py-1.5 px-1 rounded-lg dark:text-gray-300 dark:hover:text-white hover:bg-black/5 dark:hover:bg-gray-850"
|
class="w-full text-left text-sm py-1.5 px-1 rounded-lg dark:text-gray-300 dark:hover:text-white hover:bg-black/5 dark:hover:bg-gray-850"
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
goto('/workspace/functions');
|
goto('/admin/functions');
|
||||||
}}
|
}}
|
||||||
type="button"
|
type="button"
|
||||||
>
|
>
|
@ -323,12 +323,6 @@
|
|||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class=" text-gray-500 text-xs mt-1 mb-2">
|
|
||||||
ⓘ {$i18n.t(
|
|
||||||
'Admins have access to all tools at all times; users need tools assigned per model in the workspace.'
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class=" flex justify-end w-full mb-2">
|
<div class=" flex justify-end w-full mb-2">
|
||||||
<div class="flex space-x-2">
|
<div class="flex space-x-2">
|
||||||
<input
|
<input
|
||||||
|
@ -65,6 +65,13 @@
|
|||||||
href="/admin/evaluations">{$i18n.t('Evaluations')}</a
|
href="/admin/evaluations">{$i18n.t('Evaluations')}</a
|
||||||
>
|
>
|
||||||
|
|
||||||
|
<a
|
||||||
|
class="min-w-fit rounded-full p-1.5 {$page.url.pathname.includes('/admin/functions')
|
||||||
|
? ''
|
||||||
|
: 'text-gray-300 dark:text-gray-600 hover:text-gray-700 dark:hover:text-white'} transition"
|
||||||
|
href="/admin/functions">{$i18n.t('Functions')}</a
|
||||||
|
>
|
||||||
|
|
||||||
<a
|
<a
|
||||||
class="min-w-fit rounded-full p-1.5 {$page.url.pathname.includes('/admin/settings')
|
class="min-w-fit rounded-full p-1.5 {$page.url.pathname.includes('/admin/settings')
|
||||||
? ''
|
? ''
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
import { functions } from '$lib/stores';
|
import { functions } from '$lib/stores';
|
||||||
|
|
||||||
import { getFunctions } from '$lib/apis/functions';
|
import { getFunctions } from '$lib/apis/functions';
|
||||||
import Functions from '$lib/components/workspace/Functions.svelte';
|
import Functions from '$lib/components/admin/Functions.svelte';
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
await Promise.all([
|
await Promise.all([
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import { functions, models } from '$lib/stores';
|
import { functions, models } from '$lib/stores';
|
||||||
import { createNewFunction, getFunctions } from '$lib/apis/functions';
|
import { createNewFunction, getFunctions } from '$lib/apis/functions';
|
||||||
import FunctionEditor from '$lib/components/workspace/Functions/FunctionEditor.svelte';
|
import FunctionEditor from '$lib/components/admin/Functions/FunctionEditor.svelte';
|
||||||
import { getModels } from '$lib/apis';
|
import { getModels } from '$lib/apis';
|
||||||
import { compareVersion, extractFrontmatter } from '$lib/utils';
|
import { compareVersion, extractFrontmatter } from '$lib/utils';
|
||||||
import { WEBUI_VERSION } from '$lib/constants';
|
import { WEBUI_VERSION } from '$lib/constants';
|
@ -7,7 +7,7 @@
|
|||||||
import { functions, models } from '$lib/stores';
|
import { functions, models } from '$lib/stores';
|
||||||
import { updateFunctionById, getFunctions, getFunctionById } from '$lib/apis/functions';
|
import { updateFunctionById, getFunctions, getFunctionById } from '$lib/apis/functions';
|
||||||
|
|
||||||
import FunctionEditor from '$lib/components/workspace/Functions/FunctionEditor.svelte';
|
import FunctionEditor from '$lib/components/admin/Functions/FunctionEditor.svelte';
|
||||||
import Spinner from '$lib/components/common/Spinner.svelte';
|
import Spinner from '$lib/components/common/Spinner.svelte';
|
||||||
import { getModels } from '$lib/apis';
|
import { getModels } from '$lib/apis';
|
||||||
import { compareVersion, extractFrontmatter } from '$lib/utils';
|
import { compareVersion, extractFrontmatter } from '$lib/utils';
|
@ -82,7 +82,6 @@
|
|||||||
href="/workspace/prompts">{$i18n.t('Prompts')}</a
|
href="/workspace/prompts">{$i18n.t('Prompts')}</a
|
||||||
>
|
>
|
||||||
|
|
||||||
{#if $user?.role === 'admin'}
|
|
||||||
<a
|
<a
|
||||||
class="min-w-fit rounded-full p-1.5 {$page.url.pathname.includes('/workspace/tools')
|
class="min-w-fit rounded-full p-1.5 {$page.url.pathname.includes('/workspace/tools')
|
||||||
? ''
|
? ''
|
||||||
@ -91,18 +90,6 @@
|
|||||||
>
|
>
|
||||||
{$i18n.t('Tools')}
|
{$i18n.t('Tools')}
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<a
|
|
||||||
class="min-w-fit rounded-full p-1.5 {$page.url.pathname.includes(
|
|
||||||
'/workspace/functions'
|
|
||||||
)
|
|
||||||
? ''
|
|
||||||
: 'text-gray-300 dark:text-gray-600 hover:text-gray-700 dark:hover:text-white'} transition"
|
|
||||||
href="/workspace/functions"
|
|
||||||
>
|
|
||||||
{$i18n.t('Functions')}
|
|
||||||
</a>
|
|
||||||
{/if}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user