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
cfb3f307
Commit
cfb3f307
authored
Nov 22, 2023
by
Timothy J. Baek
Browse files
feat: option to toggle auto title generation
parent
1196fa88
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
91 additions
and
54 deletions
+91
-54
src/lib/components/chat/SettingsModal.svelte
src/lib/components/chat/SettingsModal.svelte
+29
-0
src/routes/(app)/+page.svelte
src/routes/(app)/+page.svelte
+31
-27
src/routes/(app)/c/[id]/+page.svelte
src/routes/(app)/c/[id]/+page.svelte
+31
-27
No files found.
src/lib/components/chat/SettingsModal.svelte
View file @
cfb3f307
...
...
@@ -38,6 +38,7 @@
let pullProgress = null;
// Addons
let titleAutoGenerate = true;
let speechAutoSend = false;
let gravatarEmail = '';
let OPENAI_API_KEY = '';
...
...
@@ -91,6 +92,11 @@
saveSettings({ speechAutoSend: speechAutoSend });
};
const toggleTitleAutoGenerate = async () => {
titleAutoGenerate = !titleAutoGenerate;
saveSettings({ titleAutoGenerate: titleAutoGenerate });
};
const toggleAuthHeader = async () => {
authEnabled = !authEnabled;
};
...
...
@@ -226,6 +232,7 @@
top_k = settings.top_k ?? 40;
top_p = settings.top_p ?? 0.9;
titleAutoGenerate = settings.titleAutoGenerate ?? true;
speechAutoSend = settings.speechAutoSend ?? false;
gravatarEmail = settings.gravatarEmail ?? '';
OPENAI_API_KEY = settings.OPENAI_API_KEY ?? '';
...
...
@@ -851,6 +858,28 @@
}}
>
<div class=" space-y-3">
<div>
<div class=" py-1 flex w-full justify-between">
<div class=" self-center text-sm font-medium">Title Auto Generation</div>
<button
class="p-1 px-3 text-xs flex rounded transition"
on:click={() => {
toggleTitleAutoGenerate();
}}
type="button"
>
{#if titleAutoGenerate === true}
<span class="ml-2 self-center">On</span>
{:else}
<span class="ml-2 self-center">Off</span>
{/if}
</button>
</div>
</div>
<hr class=" dark:border-gray-700" />
<div>
<div class=" py-1 flex w-full justify-between">
<div class=" self-center text-sm font-medium">Voice Input Auto-Send</div>
...
...
src/routes/(app)/+page.svelte
View file @
cfb3f307
...
...
@@ -415,6 +415,7 @@
};
const generateChatTitle = async (_chatId, userPrompt) => {
if ($settings.titleAutoGenerate ?? true) {
console.log('generateChatTitle');
const res = await fetch(`${$settings?.API_BASE_URL ?? OLLAMA_API_BASE_URL}/generate`, {
...
...
@@ -445,6 +446,9 @@
if (res) {
await setChatTitle(_chatId, res.response === '' ? 'New Chat' : res.response);
}
} else {
await setChatTitle(_chatId, `${userPrompt}`);
}
};
const setChatTitle = async (_chatId, _title) => {
...
...
src/routes/(app)/c/[id]/+page.svelte
View file @
cfb3f307
...
...
@@ -451,6 +451,7 @@
};
const generateChatTitle = async (_chatId, userPrompt) => {
if ($settings.titleAutoGenerate ?? true) {
console.log('generateChatTitle');
const res = await fetch(`${$settings?.API_BASE_URL ?? OLLAMA_API_BASE_URL}/generate`, {
...
...
@@ -481,6 +482,9 @@
if (res) {
await setChatTitle(_chatId, res.response === '' ? 'New Chat' : res.response);
}
} else {
await setChatTitle(_chatId, `${userPrompt}`);
}
};
const setChatTitle = async (_chatId, _title) => {
...
...
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