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
0c7f0f44
Commit
0c7f0f44
authored
May 24, 2024
by
Timothy J. Baek
Browse files
refac: suggestion prompts
parent
bbf5e37f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
165 additions
and
108 deletions
+165
-108
src/routes/(app)/workspace/models/create/+page.svelte
src/routes/(app)/workspace/models/create/+page.svelte
+82
-53
src/routes/(app)/workspace/models/edit/+page.svelte
src/routes/(app)/workspace/models/edit/+page.svelte
+83
-55
No files found.
src/routes/(app)/workspace/models/create/+page.svelte
View file @
0c7f0f44
...
@@ -386,11 +386,32 @@
...
@@ -386,11 +386,32 @@
</div>
</div>
<div class="my-2">
<div class="my-2">
<div class="flex w-full justify-between mb-2">
<div class="flex w-full justify-between items-center">
<div class="flex w-full justify-between items-center">
<div class=" self-center text-sm font-semibold">{$i18n.t('Prompt suggestions')}</div>
<div class=" self-center text-sm font-semibold">{$i18n.t('Prompt suggestions')}</div>
<button
<button
class="p-1 px-3 text-xs flex rounded transition"
class="p-1 text-xs flex rounded transition"
type="button"
on:click={() => {
if (info.meta.suggestion_prompts === null) {
info.meta.suggestion_prompts = [{ content: '' }];
} else {
info.meta.suggestion_prompts = null;
}
}}
>
{#if info.meta.suggestion_prompts === null}
<span class="ml-2 self-center">{$i18n.t('Default')}</span>
{:else}
<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
{/if}
</button>
</div>
{#if info.meta.suggestion_prompts !== null}
<button
class="p-1 px-2 text-xs flex rounded transition"
type="button"
type="button"
on:click={() => {
on:click={() => {
if (
if (
...
@@ -412,8 +433,12 @@
...
@@ -412,8 +433,12 @@
/>
/>
</svg>
</svg>
</button>
</button>
{/if}
</div>
</div>
<div class="flex flex-col space-y-1">
{#if info.meta.suggestion_prompts}
<div class="flex flex-col space-y-1 mt-2">
{#if info.meta.suggestion_prompts.length > 0}
{#each info.meta.suggestion_prompts as prompt, promptIdx}
{#each info.meta.suggestion_prompts as prompt, promptIdx}
<div class=" flex border dark:border-gray-600 rounded-lg">
<div class=" flex border dark:border-gray-600 rounded-lg">
<input
<input
...
@@ -443,7 +468,11 @@
...
@@ -443,7 +468,11 @@
</button>
</button>
</div>
</div>
{/each}
{/each}
{:else}
<div class="text-xs text-center">No suggestion prompts</div>
{/if}
</div>
</div>
{/if}
</div>
</div>
<div class="my-2">
<div class="my-2">
...
...
src/routes/(app)/workspace/models/edit/+page.svelte
View file @
0c7f0f44
...
@@ -44,8 +44,7 @@
...
@@ -44,8 +44,7 @@
meta
:
{
meta
:
{
profile_image_url
:
'/favicon.png'
,
profile_image_url
:
'/favicon.png'
,
description
:
''
,
description
:
''
,
content
:
''
,
suggestion_prompts
:
null
suggestion_prompts
:
[]
},
},
params
:
{
params
:
{
system
:
''
system
:
''
...
@@ -366,11 +365,32 @@
...
@@ -366,11 +365,32 @@
</
div
>
</
div
>
<
div
class
=
"my-2"
>
<
div
class
=
"my-2"
>
<
div
class
=
"flex w-full justify-between mb-2"
>
<
div
class
=
"flex w-full justify-between items-center"
>
<
div
class
=
"flex w-full justify-between items-center"
>
<
div
class
=
" self-center text-sm font-semibold"
>{$
i18n
.
t
(
'Prompt suggestions'
)}</
div
>
<
div
class
=
" self-center text-sm font-semibold"
>{$
i18n
.
t
(
'Prompt suggestions'
)}</
div
>
<
button
<
button
class
=
"p-1 px-3 text-xs flex rounded transition"
class
=
"p-1 text-xs flex rounded transition"
type
=
"button"
on
:
click
={()
=>
{
if
(
info
.
meta
.
suggestion_prompts
===
null
)
{
info
.
meta
.
suggestion_prompts
=
[{
content
:
''
}];
}
else
{
info
.
meta
.
suggestion_prompts
=
null
;
}
}}
>
{#
if
info
.
meta
.
suggestion_prompts
===
null
}
<
span
class
=
"ml-2 self-center"
>{$
i18n
.
t
(
'Default'
)}</
span
>
{:
else
}
<
span
class
=
"ml-2 self-center"
>{$
i18n
.
t
(
'Custom'
)}</
span
>
{/
if
}
</
button
>
</
div
>
{#
if
info
.
meta
.
suggestion_prompts
!== null}
<
button
class
=
"p-1 px-2 text-xs flex rounded transition"
type
=
"button"
type
=
"button"
on
:
click
={()
=>
{
on
:
click
={()
=>
{
if
(
if
(
...
@@ -392,8 +412,12 @@
...
@@ -392,8 +412,12 @@
/>
/>
</
svg
>
</
svg
>
</
button
>
</
button
>
{/
if
}
</
div
>
</
div
>
<
div
class
=
"flex flex-col space-y-1"
>
{#
if
info
.
meta
.
suggestion_prompts
}
<
div
class
=
"flex flex-col space-y-1 mt-2"
>
{#
if
info
.
meta
.
suggestion_prompts
.
length
>
0
}
{#
each
info
.
meta
.
suggestion_prompts
as
prompt
,
promptIdx
}
{#
each
info
.
meta
.
suggestion_prompts
as
prompt
,
promptIdx
}
<
div
class
=
" flex border dark:border-gray-600 rounded-lg"
>
<
div
class
=
" flex border dark:border-gray-600 rounded-lg"
>
<
input
<
input
...
@@ -423,7 +447,11 @@
...
@@ -423,7 +447,11 @@
</
button
>
</
button
>
</
div
>
</
div
>
{/
each
}
{/
each
}
{:
else
}
<
div
class
=
"text-xs text-center"
>
No
suggestion
prompts
</
div
>
{/
if
}
</
div
>
</
div
>
{/
if
}
</
div
>
</
div
>
<
div
class
=
"my-2"
>
<
div
class
=
"my-2"
>
...
...
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