mirror of
https://github.com/open-webui/open-webui
synced 2024-11-21 23:57:51 +00:00
refac
This commit is contained in:
parent
e6265897c8
commit
913620ff0c
@ -14,7 +14,7 @@
|
||||
|
||||
import { oneDark } from '@codemirror/theme-one-dark';
|
||||
|
||||
import { onMount, createEventDispatcher, getContext } from 'svelte';
|
||||
import { onMount, createEventDispatcher, getContext, tick } from 'svelte';
|
||||
|
||||
import { formatPythonCode } from '$lib/apis/utils';
|
||||
import { toast } from 'svelte-sonner';
|
||||
@ -66,6 +66,10 @@
|
||||
changes: [{ from: 0, to: codeEditor.state.doc.length, insert: formattedCode }]
|
||||
});
|
||||
|
||||
_value = formattedCode;
|
||||
dispatch('change', { value: _value });
|
||||
await tick();
|
||||
|
||||
toast.success($i18n.t('Code formatted successfully'));
|
||||
return true;
|
||||
}
|
||||
|
@ -267,6 +267,10 @@ class Pipe:
|
||||
await tick();
|
||||
|
||||
const res = await codeEditor.formatPythonCodeHandler();
|
||||
await tick();
|
||||
|
||||
content = _content;
|
||||
await tick();
|
||||
|
||||
if (res) {
|
||||
console.log('Code formatted successfully');
|
||||
|
@ -155,6 +155,10 @@ class Tools:
|
||||
await tick();
|
||||
|
||||
const res = await codeEditor.formatPythonCodeHandler();
|
||||
await tick();
|
||||
|
||||
content = _content;
|
||||
await tick();
|
||||
|
||||
if (res) {
|
||||
console.log('Code formatted successfully');
|
||||
|
Loading…
Reference in New Issue
Block a user