|
@@ -34,7 +34,7 @@
|
|
|
|
|
|
// General
|
|
// General
|
|
let API_BASE_URL = OLLAMA_API_BASE_URL;
|
|
let API_BASE_URL = OLLAMA_API_BASE_URL;
|
|
- let themes = ['dark', 'light', 'rose-pine'];
|
|
|
|
|
|
+ let themes = ['dark', 'light', 'rose-pine dark', 'rose-pine-dawn light'];
|
|
let theme = 'dark';
|
|
let theme = 'dark';
|
|
let notificationEnabled = false;
|
|
let notificationEnabled = false;
|
|
let system = '';
|
|
let system = '';
|
|
@@ -74,17 +74,20 @@
|
|
|
|
|
|
let deleteModelTag = '';
|
|
let deleteModelTag = '';
|
|
|
|
|
|
|
|
+ // External
|
|
|
|
+
|
|
|
|
+ let OPENAI_API_KEY = '';
|
|
|
|
+ let OPENAI_API_BASE_URL = '';
|
|
|
|
+
|
|
// Addons
|
|
// Addons
|
|
let titleAutoGenerate = true;
|
|
let titleAutoGenerate = true;
|
|
let speechAutoSend = false;
|
|
let speechAutoSend = false;
|
|
let responseAutoCopy = false;
|
|
let responseAutoCopy = false;
|
|
|
|
|
|
let gravatarEmail = '';
|
|
let gravatarEmail = '';
|
|
- let OPENAI_API_KEY = '';
|
|
|
|
- let OPENAI_API_BASE_URL = '';
|
|
|
|
|
|
+ let titleAutoGenerateModel = '';
|
|
|
|
|
|
// Chats
|
|
// Chats
|
|
-
|
|
|
|
let importFiles;
|
|
let importFiles;
|
|
let showDeleteConfirm = false;
|
|
let showDeleteConfirm = false;
|
|
|
|
|
|
@@ -656,13 +659,14 @@
|
|
options = { ...options, ...settings.options };
|
|
options = { ...options, ...settings.options };
|
|
options.stop = (settings?.options?.stop ?? []).join(',');
|
|
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;
|
|
titleAutoGenerate = settings.titleAutoGenerate ?? true;
|
|
speechAutoSend = settings.speechAutoSend ?? false;
|
|
speechAutoSend = settings.speechAutoSend ?? false;
|
|
responseAutoCopy = settings.responseAutoCopy ?? false;
|
|
responseAutoCopy = settings.responseAutoCopy ?? false;
|
|
-
|
|
|
|
|
|
+ titleAutoGenerateModel = settings.titleAutoGenerateModel ?? '';
|
|
gravatarEmail = settings.gravatarEmail ?? '';
|
|
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;
|
|
authEnabled = settings.authHeader !== undefined ? true : false;
|
|
if (authEnabled) {
|
|
if (authEnabled) {
|
|
@@ -757,31 +761,33 @@
|
|
<div class=" self-center">Advanced</div>
|
|
<div class=" self-center">Advanced</div>
|
|
</button>
|
|
</button>
|
|
|
|
|
|
- <button
|
|
|
|
- class="px-2.5 py-2.5 min-w-fit rounded-lg flex-1 md:flex-none flex text-right transition {selectedTab ===
|
|
|
|
- 'models'
|
|
|
|
- ? 'bg-gray-200 dark:bg-gray-700'
|
|
|
|
- : ' hover:bg-gray-300 dark:hover:bg-gray-800'}"
|
|
|
|
- on:click={() => {
|
|
|
|
- selectedTab = 'models';
|
|
|
|
- }}
|
|
|
|
- >
|
|
|
|
- <div class=" self-center mr-2">
|
|
|
|
- <svg
|
|
|
|
- xmlns="http://www.w3.org/2000/svg"
|
|
|
|
- viewBox="0 0 20 20"
|
|
|
|
- fill="currentColor"
|
|
|
|
- class="w-4 h-4"
|
|
|
|
- >
|
|
|
|
- <path
|
|
|
|
- fill-rule="evenodd"
|
|
|
|
- d="M10 1c3.866 0 7 1.79 7 4s-3.134 4-7 4-7-1.79-7-4 3.134-4 7-4zm5.694 8.13c.464-.264.91-.583 1.306-.952V10c0 2.21-3.134 4-7 4s-7-1.79-7-4V8.178c.396.37.842.688 1.306.953C5.838 10.006 7.854 10.5 10 10.5s4.162-.494 5.694-1.37zM3 13.179V15c0 2.21 3.134 4 7 4s7-1.79 7-4v-1.822c-.396.37-.842.688-1.306.953-1.532.875-3.548 1.369-5.694 1.369s-4.162-.494-5.694-1.37A7.009 7.009 0 013 13.179z"
|
|
|
|
- clip-rule="evenodd"
|
|
|
|
- />
|
|
|
|
- </svg>
|
|
|
|
- </div>
|
|
|
|
- <div class=" self-center">Models</div>
|
|
|
|
- </button>
|
|
|
|
|
|
+ {#if $user?.role === 'admin'}
|
|
|
|
+ <button
|
|
|
|
+ class="px-2.5 py-2.5 min-w-fit rounded-lg flex-1 md:flex-none flex text-right transition {selectedTab ===
|
|
|
|
+ 'models'
|
|
|
|
+ ? 'bg-gray-200 dark:bg-gray-700'
|
|
|
|
+ : ' hover:bg-gray-300 dark:hover:bg-gray-800'}"
|
|
|
|
+ on:click={() => {
|
|
|
|
+ selectedTab = 'models';
|
|
|
|
+ }}
|
|
|
|
+ >
|
|
|
|
+ <div class=" self-center mr-2">
|
|
|
|
+ <svg
|
|
|
|
+ xmlns="http://www.w3.org/2000/svg"
|
|
|
|
+ viewBox="0 0 20 20"
|
|
|
|
+ fill="currentColor"
|
|
|
|
+ class="w-4 h-4"
|
|
|
|
+ >
|
|
|
|
+ <path
|
|
|
|
+ fill-rule="evenodd"
|
|
|
|
+ d="M10 1c3.866 0 7 1.79 7 4s-3.134 4-7 4-7-1.79-7-4 3.134-4 7-4zm5.694 8.13c.464-.264.91-.583 1.306-.952V10c0 2.21-3.134 4-7 4s-7-1.79-7-4V8.178c.396.37.842.688 1.306.953C5.838 10.006 7.854 10.5 10 10.5s4.162-.494 5.694-1.37zM3 13.179V15c0 2.21 3.134 4 7 4s7-1.79 7-4v-1.822c-.396.37-.842.688-1.306.953-1.532.875-3.548 1.369-5.694 1.369s-4.162-.494-5.694-1.37A7.009 7.009 0 013 13.179z"
|
|
|
|
+ clip-rule="evenodd"
|
|
|
|
+ />
|
|
|
|
+ </svg>
|
|
|
|
+ </div>
|
|
|
|
+ <div class=" self-center">Models</div>
|
|
|
|
+ </button>
|
|
|
|
+ {/if}
|
|
|
|
|
|
<button
|
|
<button
|
|
class="px-2.5 py-2.5 min-w-fit rounded-lg flex-1 md:flex-none flex text-right transition {selectedTab ===
|
|
class="px-2.5 py-2.5 min-w-fit rounded-lg flex-1 md:flex-none flex text-right transition {selectedTab ===
|
|
@@ -994,21 +1000,22 @@
|
|
themes
|
|
themes
|
|
.filter((e) => e !== theme)
|
|
.filter((e) => e !== theme)
|
|
.forEach((e) => {
|
|
.forEach((e) => {
|
|
- document.documentElement.classList.remove(e);
|
|
|
|
|
|
+ e.split(' ').forEach((e) => {
|
|
|
|
+ document.documentElement.classList.remove(e);
|
|
|
|
+ });
|
|
});
|
|
});
|
|
|
|
|
|
- document.documentElement.classList.add(theme);
|
|
|
|
-
|
|
|
|
- if (theme === 'rose-pine') {
|
|
|
|
- document.documentElement.classList.add('dark');
|
|
|
|
- }
|
|
|
|
|
|
+ theme.split(' ').forEach((e) => {
|
|
|
|
+ document.documentElement.classList.add(e);
|
|
|
|
+ });
|
|
|
|
|
|
console.log(theme);
|
|
console.log(theme);
|
|
}}
|
|
}}
|
|
>
|
|
>
|
|
<option value="dark">Dark</option>
|
|
<option value="dark">Dark</option>
|
|
<option value="light">Light</option>
|
|
<option value="light">Light</option>
|
|
- <option value="rose-pine">Rosé Pine</option>
|
|
|
|
|
|
+ <option value="rose-pine dark">Rosé Pine</option>
|
|
|
|
+ <option value="rose-pine-dawn light">Rosé Pine Dawn</option>
|
|
</select>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@@ -1547,10 +1554,6 @@
|
|
<form
|
|
<form
|
|
class="flex flex-col h-full justify-between space-y-3 text-sm"
|
|
class="flex flex-col h-full justify-between space-y-3 text-sm"
|
|
on:submit|preventDefault={() => {
|
|
on:submit|preventDefault={() => {
|
|
- saveSettings({
|
|
|
|
- gravatarEmail: gravatarEmail !== '' ? gravatarEmail : undefined,
|
|
|
|
- gravatarUrl: gravatarEmail !== '' ? getGravatarURL(gravatarEmail) : undefined
|
|
|
|
- });
|
|
|
|
show = false;
|
|
show = false;
|
|
}}
|
|
}}
|
|
>
|
|
>
|
|
@@ -1560,7 +1563,7 @@
|
|
|
|
|
|
<div>
|
|
<div>
|
|
<div class=" py-0.5 flex w-full justify-between">
|
|
<div class=" py-0.5 flex w-full justify-between">
|
|
- <div class=" self-center text-xs font-medium">Title Auto Generation</div>
|
|
|
|
|
|
+ <div class=" self-center text-xs font-medium">Title Auto-Generation</div>
|
|
|
|
|
|
<button
|
|
<button
|
|
class="p-1 px-3 text-xs flex rounded transition"
|
|
class="p-1 px-3 text-xs flex rounded transition"
|
|
@@ -1622,6 +1625,54 @@
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<hr class=" dark:border-gray-700" />
|
|
<hr class=" dark:border-gray-700" />
|
|
|
|
+
|
|
|
|
+ <div>
|
|
|
|
+ <div class=" mb-2.5 text-sm font-medium">Set Title Auto-Generation Model</div>
|
|
|
|
+ <div class="flex w-full">
|
|
|
|
+ <div class="flex-1 mr-2">
|
|
|
|
+ <select
|
|
|
|
+ class="w-full rounded py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-800 outline-none"
|
|
|
|
+ bind:value={titleAutoGenerateModel}
|
|
|
|
+ placeholder="Select a model"
|
|
|
|
+ >
|
|
|
|
+ <option value="" selected>Default</option>
|
|
|
|
+ {#each $models.filter((m) => m.size != null) as model}
|
|
|
|
+ <option value={model.name} class="bg-gray-100 dark:bg-gray-700"
|
|
|
|
+ >{model.name +
|
|
|
|
+ ' (' +
|
|
|
|
+ (model.size / 1024 ** 3).toFixed(1) +
|
|
|
|
+ ' GB)'}</option
|
|
|
|
+ >
|
|
|
|
+ {/each}
|
|
|
|
+ </select>
|
|
|
|
+ </div>
|
|
|
|
+ <button
|
|
|
|
+ class="px-3 bg-gray-200 hover:bg-gray-300 dark:bg-gray-700 dark:hover:bg-gray-800 dark:text-gray-100 rounded transition"
|
|
|
|
+ on:click={() => {
|
|
|
|
+ saveSettings({
|
|
|
|
+ titleAutoGenerateModel:
|
|
|
|
+ titleAutoGenerateModel !== '' ? titleAutoGenerateModel : undefined
|
|
|
|
+ });
|
|
|
|
+ }}
|
|
|
|
+ type="button"
|
|
|
|
+ >
|
|
|
|
+ <svg
|
|
|
|
+ xmlns="http://www.w3.org/2000/svg"
|
|
|
|
+ viewBox="0 0 16 16"
|
|
|
|
+ fill="currentColor"
|
|
|
|
+ class="w-3.5 h-3.5"
|
|
|
|
+ >
|
|
|
|
+ <path
|
|
|
|
+ fill-rule="evenodd"
|
|
|
|
+ d="M13.836 2.477a.75.75 0 0 1 .75.75v3.182a.75.75 0 0 1-.75.75h-3.182a.75.75 0 0 1 0-1.5h1.37l-.84-.841a4.5 4.5 0 0 0-7.08.932.75.75 0 0 1-1.3-.75 6 6 0 0 1 9.44-1.242l.842.84V3.227a.75.75 0 0 1 .75-.75Zm-.911 7.5A.75.75 0 0 1 13.199 11a6 6 0 0 1-9.44 1.241l-.84-.84v1.371a.75.75 0 0 1-1.5 0V9.591a.75.75 0 0 1 .75-.75H5.35a.75.75 0 0 1 0 1.5H3.98l.841.841a4.5 4.5 0 0 0 7.08-.932.75.75 0 0 1 1.025-.273Z"
|
|
|
|
+ clip-rule="evenodd"
|
|
|
|
+ />
|
|
|
|
+ </svg>
|
|
|
|
+ </button>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+
|
|
|
|
+ <!-- <hr class=" dark:border-gray-700" />
|
|
<div>
|
|
<div>
|
|
<div class=" mb-2.5 text-sm font-medium">
|
|
<div class=" mb-2.5 text-sm font-medium">
|
|
Gravatar Email <span class=" text-gray-400 text-sm">(optional)</span>
|
|
Gravatar Email <span class=" text-gray-400 text-sm">(optional)</span>
|
|
@@ -1644,7 +1695,7 @@
|
|
target="_blank">Gravatar.</a
|
|
target="_blank">Gravatar.</a
|
|
>
|
|
>
|
|
</div>
|
|
</div>
|
|
- </div>
|
|
|
|
|
|
+ </div> -->
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="flex justify-end pt-3 text-sm font-medium">
|
|
<div class="flex justify-end pt-3 text-sm font-medium">
|