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