mirror of
https://github.com/open-webui/open-webui
synced 2025-06-26 18:26:48 +00:00
refac
This commit is contained in:
parent
cd3904046d
commit
e06111a362
@ -1,8 +1,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import { getContext, createEventDispatcher, onMount, tick } from 'svelte';
|
import { getContext, onMount, tick } from 'svelte';
|
||||||
import { goto } from '$app/navigation';
|
import { goto } from '$app/navigation';
|
||||||
|
|
||||||
const dispatch = createEventDispatcher();
|
|
||||||
const i18n = getContext('i18n');
|
const i18n = getContext('i18n');
|
||||||
|
|
||||||
import CodeEditor from '$lib/components/common/CodeEditor.svelte';
|
import CodeEditor from '$lib/components/common/CodeEditor.svelte';
|
||||||
@ -15,6 +14,8 @@
|
|||||||
let loading = false;
|
let loading = false;
|
||||||
let showConfirm = false;
|
let showConfirm = false;
|
||||||
|
|
||||||
|
export let onSave = () => {};
|
||||||
|
|
||||||
export let edit = false;
|
export let edit = false;
|
||||||
export let clone = false;
|
export let clone = false;
|
||||||
|
|
||||||
@ -256,7 +257,7 @@ class Pipe:
|
|||||||
|
|
||||||
const saveHandler = async () => {
|
const saveHandler = async () => {
|
||||||
loading = true;
|
loading = true;
|
||||||
dispatch('save', {
|
onSave({
|
||||||
id,
|
id,
|
||||||
name,
|
name,
|
||||||
meta,
|
meta,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<script>
|
<script>
|
||||||
import { getContext, createEventDispatcher, onMount, tick } from 'svelte';
|
import { getContext, onMount, tick } from 'svelte';
|
||||||
|
|
||||||
const i18n = getContext('i18n');
|
const i18n = getContext('i18n');
|
||||||
|
|
||||||
@ -12,8 +12,6 @@
|
|||||||
import LockClosed from '$lib/components/icons/LockClosed.svelte';
|
import LockClosed from '$lib/components/icons/LockClosed.svelte';
|
||||||
import AccessControlModal from '../common/AccessControlModal.svelte';
|
import AccessControlModal from '../common/AccessControlModal.svelte';
|
||||||
|
|
||||||
const dispatch = createEventDispatcher();
|
|
||||||
|
|
||||||
let formElement = null;
|
let formElement = null;
|
||||||
let loading = false;
|
let loading = false;
|
||||||
|
|
||||||
@ -23,6 +21,8 @@
|
|||||||
export let edit = false;
|
export let edit = false;
|
||||||
export let clone = false;
|
export let clone = false;
|
||||||
|
|
||||||
|
export let onSave = () => {};
|
||||||
|
|
||||||
export let id = '';
|
export let id = '';
|
||||||
export let name = '';
|
export let name = '';
|
||||||
export let meta = {
|
export let meta = {
|
||||||
@ -150,7 +150,7 @@ class Tools:
|
|||||||
|
|
||||||
const saveHandler = async () => {
|
const saveHandler = async () => {
|
||||||
loading = true;
|
loading = true;
|
||||||
dispatch('save', {
|
onSave({
|
||||||
id,
|
id,
|
||||||
name,
|
name,
|
||||||
meta,
|
meta,
|
||||||
|
@ -95,8 +95,8 @@
|
|||||||
meta={func?.meta ?? { description: '' }}
|
meta={func?.meta ?? { description: '' }}
|
||||||
content={func?.content ?? ''}
|
content={func?.content ?? ''}
|
||||||
{clone}
|
{clone}
|
||||||
on:save={(e) => {
|
onSave={(value) => {
|
||||||
saveHandler(e.detail);
|
saveHandler(value);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
{/key}
|
{/key}
|
||||||
|
@ -80,8 +80,8 @@
|
|||||||
name={func.name}
|
name={func.name}
|
||||||
meta={func.meta}
|
meta={func.meta}
|
||||||
content={func.content}
|
content={func.content}
|
||||||
on:save={(e) => {
|
onSave={(value) => {
|
||||||
saveHandler(e.detail);
|
saveHandler(value);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
{:else}
|
{:else}
|
||||||
|
@ -89,8 +89,8 @@
|
|||||||
content={tool?.content ?? ''}
|
content={tool?.content ?? ''}
|
||||||
access_control={null}
|
access_control={null}
|
||||||
{clone}
|
{clone}
|
||||||
on:save={(e) => {
|
onSave={(value) => {
|
||||||
saveHandler(e.detail);
|
saveHandler(value);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
{/key}
|
{/key}
|
||||||
|
@ -75,8 +75,8 @@
|
|||||||
meta={tool.meta}
|
meta={tool.meta}
|
||||||
content={tool.content}
|
content={tool.content}
|
||||||
accessControl={tool.access_control}
|
accessControl={tool.access_control}
|
||||||
on:save={(e) => {
|
onSave={(value) => {
|
||||||
saveHandler(e.detail);
|
saveHandler(value);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
{:else}
|
{:else}
|
||||||
|
Loading…
Reference in New Issue
Block a user