Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
open-webui
Commits
6e7e575a
"vscode:/vscode.git/clone" did not exist on "70a8f6e7070980fa0b81a97ffbeec82924043061"
Commit
6e7e575a
authored
Jun 10, 2024
by
Timothy J. Baek
Browse files
refac
parent
f43b545b
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
3 deletions
+17
-3
src/lib/components/common/CodeEditor.svelte
src/lib/components/common/CodeEditor.svelte
+1
-1
src/lib/components/workspace/Tools.svelte
src/lib/components/workspace/Tools.svelte
+7
-1
src/lib/components/workspace/Tools/CodeEditor.svelte
src/lib/components/workspace/Tools/CodeEditor.svelte
+9
-1
No files found.
src/lib/components/common/CodeEditor.svelte
View file @
6e7e575a
...
...
@@ -24,7 +24,7 @@
let isDarkMode = false;
let editorTheme = new Compartment();
const formatPythonCodeHandler = async () => {
export
const formatPythonCodeHandler = async () => {
if (codeEditor) {
console.log('formatPythonCodeHandler');
const res = await formatPythonCode(value).catch((error) => {
...
...
src/lib/components/workspace/Tools.svelte
View file @
6e7e575a
...
...
@@ -7,9 +7,15 @@
let loading = false;
let codeEditor;
const submitHandler = async () => {
loading = true;
// Call the API to submit the code
if (codeEditor) {
codeEditor.submitHandler();
}
};
</script>
...
...
@@ -17,7 +23,7 @@
<div class="mx-auto w-full md:px-0 h-full">
<div class=" flex flex-col max-h-[100dvh] h-full">
<div class="mb-2.5 flex-1 overflow-auto h-0 rounded-lg">
<CodeEditor />
<CodeEditor
bind:this={codeEditor}
/>
</div>
<div class="pb-3">
<button
...
...
src/lib/components/workspace/Tools/CodeEditor.svelte
View file @
6e7e575a
...
...
@@ -3,6 +3,8 @@
export let value = '';
let codeEditor;
let boilerplate = `# Add your custom tools using pure Python code here, make sure to add type hints
# Use Sphinx-style docstrings to document your tools, they will be used for generating tools specifications
# Please refer to function_calling_filter_pipeline.py file from pipelines project for an example
...
...
@@ -43,6 +45,12 @@ class Tools:
return "Invalid equation"
`;
export const submitHandler = async () => {
if (codeEditor) {
codeEditor.formatPythonCodeHandler();
}
};
</script>
<CodeEditor bind:value {boilerplate} />
<CodeEditor bind:value {boilerplate}
bind:this={codeEditor}
/>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment