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
92528341
Unverified
Commit
92528341
authored
Jan 03, 2024
by
Timothy Jaeryang Baek
Committed by
GitHub
Jan 03, 2024
Browse files
Merge pull request #370 from ollama-webui/import-prompts
feat: import prompts
parents
c59e1648
df7be3d2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
4 deletions
+39
-4
src/routes/(app)/prompts/+page.svelte
src/routes/(app)/prompts/+page.svelte
+39
-4
No files found.
src/routes/(app)/prompts/+page.svelte
View file @
92528341
...
...
@@ -5,8 +5,10 @@
import { onMount } from 'svelte';
import { prompts } from '$lib/stores';
import { deletePromptByCommand, getPrompts } from '$lib/apis/prompts';
import { createNewPrompt, deletePromptByCommand, getPrompts } from '$lib/apis/prompts';
import { error } from '@sveltejs/kit';
let importFiles = '';
let query = '';
const sharePrompt = async (prompt) => {
...
...
@@ -174,10 +176,43 @@
<div class=" flex justify-between w-full mb-3">
<div class="flex space-x-2">
<!-- <button
<input
id="prompts-import-input"
bind:files={importFiles}
type="file"
accept=".json"
hidden
on:change={() => {
console.log(importFiles);
const reader = new FileReader();
reader.onload = async (event) => {
const savedPrompts = JSON.parse(event.target.result);
console.log(savedPrompts);
for (const prompt of savedPrompts) {
await createNewPrompt(
localStorage.token,
prompt.command.charAt(0) === '/' ? prompt.command.slice(1) : prompt.command,
prompt.title,
prompt.content
).catch((error) => {
toast.error(error);
return null;
});
}
await prompts.set(await getPrompts(localStorage.token));
};
reader.readAsText(importFiles[0]);
}}
/>
<button
class="self-center w-fit text-sm px-3 py-1 border dark:border-gray-600 rounded-xl flex"
on:click={async () => {
//
document.getElementById('
modelfile
s-import-input')?.click();
document.getElementById('
prompt
s-import-input')?.click();
}}
>
<div class=" self-center mr-2 font-medium">Import Prompts</div>
...
...
@@ -196,7 +231,7 @@
/>
</svg>
</div>
</button>
-->
</button>
<button
class="self-center w-fit text-sm px-3 py-1 border dark:border-gray-600 rounded-xl flex"
...
...
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