Merge pull request #136 from ollama-webui/dev

fix: settings save issue
This commit is contained in:
Timothy Jaeryang Baek 2023-11-24 12:01:07 -05:00 committed by GitHub
commit a6be8e57e8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View file

@ -88,7 +88,7 @@
{#if autoScroll === false && messages.length > 0} {#if autoScroll === false && messages.length > 0}
<div class=" flex justify-center mb-4"> <div class=" flex justify-center mb-4">
<button <button
class=" bg-white/20 p-1.5 rounded-full" class=" bg-white border border-gray-100 dark:border-none dark:bg-white/20 p-1.5 rounded-full"
on:click={() => { on:click={() => {
autoScroll = true; autoScroll = true;
window.scrollTo({ top: document.body.scrollHeight, behavior: 'smooth' }); window.scrollTo({ top: document.body.scrollHeight, behavior: 'smooth' });

View file

@ -1,7 +1,7 @@
<script lang="ts"> <script lang="ts">
import Modal from '../common/Modal.svelte'; import Modal from '../common/Modal.svelte';
import { WEB_UI_VERSION, OLLAMA_API_BASE_URL as BUILD_TIME_API_BASE_URL } from '$lib/constants'; import { WEB_UI_VERSION, OLLAMA_API_BASE_URL } from '$lib/constants';
import toast from 'svelte-french-toast'; import toast from 'svelte-french-toast';
import { onMount } from 'svelte'; import { onMount } from 'svelte';
import { config, models, settings, user } from '$lib/stores'; import { config, models, settings, user } from '$lib/stores';
@ -19,7 +19,7 @@
let selectedTab = 'general'; let selectedTab = 'general';
// General // General
let API_BASE_URL = BUILD_TIME_API_BASE_URL; let API_BASE_URL = OLLAMA_API_BASE_URL;
let theme = 'dark'; let theme = 'dark';
let system = ''; let system = '';
@ -50,7 +50,7 @@
const checkOllamaConnection = async () => { const checkOllamaConnection = async () => {
if (API_BASE_URL === '') { if (API_BASE_URL === '') {
API_BASE_URL = BUILD_TIME_API_BASE_URL; API_BASE_URL = OLLAMA_API_BASE_URL;
} }
const _models = await getModels(API_BASE_URL, 'ollama'); const _models = await getModels(API_BASE_URL, 'ollama');
@ -222,7 +222,7 @@
console.log(settings); console.log(settings);
theme = localStorage.theme ?? 'dark'; theme = localStorage.theme ?? 'dark';
API_BASE_URL = settings.API_BASE_URL ?? BUILD_TIME_API_BASE_URL; API_BASE_URL = settings.API_BASE_URL ?? OLLAMA_API_BASE_URL;
system = settings.system ?? ''; system = settings.system ?? '';
requestFormat = settings.requestFormat ?? ''; requestFormat = settings.requestFormat ?? '';
@ -599,7 +599,7 @@
class=" px-4 py-2 bg-emerald-600 hover:bg-emerald-700 text-gray-100 transition rounded" class=" px-4 py-2 bg-emerald-600 hover:bg-emerald-700 text-gray-100 transition rounded"
on:click={() => { on:click={() => {
saveSettings({ saveSettings({
API_BASE_URL: API_BASE_URL === '' ? BUILD_TIME_API_BASE_URL : API_BASE_URL, API_BASE_URL: API_BASE_URL === '' ? OLLAMA_API_BASE_URL : API_BASE_URL,
system: system !== '' ? system : undefined system: system !== '' ? system : undefined
}); });
show = false; show = false;