From a60fbac8a5d63794068435f05a03d0f7931f1be7 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Tue, 2 Jan 2024 17:08:35 -0800 Subject: [PATCH] feat: set title auto generate model support --- src/lib/components/chat/SettingsModal.svelte | 72 ++++++++++++++++---- src/routes/(app)/+page.svelte | 2 +- 2 files changed, 61 insertions(+), 13 deletions(-) diff --git a/src/lib/components/chat/SettingsModal.svelte b/src/lib/components/chat/SettingsModal.svelte index a220bd4e..84e95d39 100644 --- a/src/lib/components/chat/SettingsModal.svelte +++ b/src/lib/components/chat/SettingsModal.svelte @@ -74,17 +74,20 @@ let deleteModelTag = ''; + // External + + let OPENAI_API_KEY = ''; + let OPENAI_API_BASE_URL = ''; + // Addons let titleAutoGenerate = true; let speechAutoSend = false; let responseAutoCopy = false; let gravatarEmail = ''; - let OPENAI_API_KEY = ''; - let OPENAI_API_BASE_URL = ''; + let titleAutoGenerateModel = ''; // Chats - let importFiles; let showDeleteConfirm = false; @@ -656,13 +659,14 @@ options = { ...options, ...settings.options }; options.stop = (settings?.options?.stop ?? []).join(','); + OPENAI_API_KEY = settings.OPENAI_API_KEY ?? ''; + OPENAI_API_BASE_URL = settings.OPENAI_API_BASE_URL ?? 'https://api.openai.com/v1'; + titleAutoGenerate = settings.titleAutoGenerate ?? true; speechAutoSend = settings.speechAutoSend ?? false; responseAutoCopy = settings.responseAutoCopy ?? false; - + titleAutoGenerateModel = settings.titleAutoGenerateModel ?? ''; gravatarEmail = settings.gravatarEmail ?? ''; - OPENAI_API_KEY = settings.OPENAI_API_KEY ?? ''; - OPENAI_API_BASE_URL = settings.OPENAI_API_BASE_URL ?? 'https://api.openai.com/v1'; authEnabled = settings.authHeader !== undefined ? true : false; if (authEnabled) { @@ -1548,10 +1552,6 @@
{ - saveSettings({ - gravatarEmail: gravatarEmail !== '' ? gravatarEmail : undefined, - gravatarUrl: gravatarEmail !== '' ? getGravatarURL(gravatarEmail) : undefined - }); show = false; }} > @@ -1561,7 +1561,7 @@
-
Title Auto Generation
+
Title Auto-Generation
+
+
+ +
diff --git a/src/routes/(app)/+page.svelte b/src/routes/(app)/+page.svelte index 30920140..9638861b 100644 --- a/src/routes/(app)/+page.svelte +++ b/src/routes/(app)/+page.svelte @@ -597,7 +597,7 @@ const title = await generateTitle( $settings?.API_BASE_URL ?? OLLAMA_API_BASE_URL, localStorage.token, - selectedModels[0], + $settings?.titleAutoGenerateModel ?? selectedModels[0], userPrompt );