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
7c7a80c4
"docs/git@developer.sourcefind.cn:OpenDAS/nni.git" did not exist on "5b62d048fe1d0d8f5aa07f7b10bbe8e315afae73"
Commit
7c7a80c4
authored
Feb 17, 2024
by
Timothy J. Baek
Browse files
feat: CLIPBOARD variable for prompt preset
parent
b993b66c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
3 deletions
+21
-3
src/lib/components/chat/MessageInput/PromptCommands.svelte
src/lib/components/chat/MessageInput/PromptCommands.svelte
+13
-1
src/routes/(app)/prompts/create/+page.svelte
src/routes/(app)/prompts/create/+page.svelte
+8
-2
No files found.
src/lib/components/chat/MessageInput/PromptCommands.svelte
View file @
7c7a80c4
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
import { prompts } from '$lib/stores';
import { prompts } from '$lib/stores';
import { findWordIndices } from '$lib/utils';
import { findWordIndices } from '$lib/utils';
import { tick } from 'svelte';
import { tick } from 'svelte';
import toast from 'svelte-french-toast';
export let prompt = '';
export let prompt = '';
let selectedCommandIdx = 0;
let selectedCommandIdx = 0;
...
@@ -24,7 +25,18 @@
...
@@ -24,7 +25,18 @@
};
};
const confirmCommand = async (command) => {
const confirmCommand = async (command) => {
prompt = command.content;
let text = command.content;
if (command.content.includes('{{CLIPBOARD}}')) {
const clipboardText = await navigator.clipboard.readText().catch((err) => {
toast.error('Failed to read clipboard contents');
return '{{CLIPBOARD}}';
});
text = command.content.replaceAll('{{CLIPBOARD}}', clipboardText);
}
prompt = text;
const chatInputElement = document.getElementById('chat-textarea');
const chatInputElement = document.getElementById('chat-textarea');
...
...
src/routes/(app)/prompts/create/+page.svelte
View file @
7c7a80c4
...
@@ -171,12 +171,18 @@
...
@@ -171,12 +171,18 @@
</div>
</div>
<div class="text-xs text-gray-400 dark:text-gray-500">
<div class="text-xs text-gray-400 dark:text-gray-500">
Format your variables using square brackets like this: <span
ⓘ
Format your variables using square brackets like this: <span
class=" text-gray-600 dark:text-gray-300 font-medium">[variable]</span
class=" text-gray-600 dark:text-gray-300 font-medium">[variable]</span
>
>
. Make sure to enclose them with
. Make sure to enclose them with
<span class=" text-gray-600 dark:text-gray-300 font-medium">'['</span>
<span class=" text-gray-600 dark:text-gray-300 font-medium">'['</span>
and <span class=" text-gray-600 dark:text-gray-300 font-medium">']'</span> .
and <span class=" text-gray-600 dark:text-gray-300 font-medium">']'</span>.
</div>
<div class="text-xs text-gray-400 dark:text-gray-500">
Utilize <span class=" text-gray-600 dark:text-gray-300 font-medium"
>{`{{CLIPBOARD}}`}</span
> variable to have them replaced with clipboard content.
</div>
</div>
</div>
</div>
</div>
</div>
...
...
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