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
ca8be1ee
"...git@developer.sourcefind.cn:chenpangpang/open-webui.git" did not exist on "044ee2a78c96e4c3552c672c201c27e8990d6629"
Commit
ca8be1ee
authored
Jun 10, 2024
by
Timothy J. Baek
Browse files
feat: import tools
parent
1611a3aa
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
3 deletions
+13
-3
src/lib/components/workspace/Tools.svelte
src/lib/components/workspace/Tools.svelte
+13
-3
No files found.
src/lib/components/workspace/Tools.svelte
View file @
ca8be1ee
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
import { createNewPrompt, deletePromptByCommand, getPrompts } from '$lib/apis/prompts';
import { createNewPrompt, deletePromptByCommand, getPrompts } from '$lib/apis/prompts';
import { goto } from '$app/navigation';
import { goto } from '$app/navigation';
import { deleteToolById, exportTools, getTools } from '$lib/apis/tools';
import {
createNewTool,
deleteToolById, exportTools, getTools } from '$lib/apis/tools';
const i18n = getContext('i18n');
const i18n = getContext('i18n');
...
@@ -186,8 +186,18 @@
...
@@ -186,8 +186,18 @@
const reader = new FileReader();
const reader = new FileReader();
reader.onload = async (event) => {
reader.onload = async (event) => {
const tools = JSON.parse(event.target.result);
const _tools = JSON.parse(event.target.result);
console.log(tools);
console.log(_tools);
for (const tool of _tools) {
const res = await createNewTool(localStorage.token, tool).catch((error) => {
toast.error(error);
return null;
});
}
toast.success('Tool imported successfully');
tools.set(await getTools(localStorage.token));
};
};
reader.readAsText(importFiles[0]);
reader.readAsText(importFiles[0]);
...
...
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