open-webui/src/lib/components/chat/Settings/About.svelte

129 lines
3.2 KiB
Svelte
Raw Normal View History

2024-02-05 10:58:54 +01:00
<script lang="ts">
2024-02-25 20:55:15 +01:00
import { getVersionUpdates } from '$lib/apis';
2024-02-05 10:58:54 +01:00
import { getOllamaVersion } from '$lib/apis/ollama';
2024-02-24 02:12:19 +01:00
import { WEBUI_VERSION } from '$lib/constants';
import { WEBUI_NAME, config, showChangelog } from '$lib/stores';
2024-02-25 20:55:15 +01:00
import { compareVersion } from '$lib/utils';
2024-02-05 10:58:54 +01:00
import { onMount } from 'svelte';
let ollamaVersion = '';
2024-02-25 20:55:15 +01:00
let updateAvailable = false;
let version = {
current: '',
latest: ''
};
const checkForVersionUpdates = async () => {
version = await getVersionUpdates(localStorage.token).catch((error) => {
return {
current: WEBUI_VERSION,
latest: WEBUI_VERSION
};
});
console.log(version);
updateAvailable = compareVersion(version.latest, version.current);
console.log(updateAvailable);
};
2024-02-05 10:58:54 +01:00
onMount(async () => {
ollamaVersion = await getOllamaVersion(localStorage.token).catch((error) => {
return '';
});
2024-02-25 20:55:15 +01:00
checkForVersionUpdates();
2024-02-05 10:58:54 +01:00
});
</script>
<div class="flex flex-col h-full justify-between space-y-3 text-sm mb-6">
<div class=" space-y-3">
<div>
<div class=" mb-2.5 text-sm font-medium flex space-x-2 items-center">
<div>
2024-02-24 02:12:19 +01:00
{$WEBUI_NAME} Version
</div>
</div>
2024-02-25 20:55:15 +01:00
<div class="flex w-full justify-between items-center">
<div class="flex flex-col text-xs text-gray-700 dark:text-gray-200">
2024-02-23 10:25:28 +01:00
<div>
2024-02-24 02:12:19 +01:00
v{WEBUI_VERSION}
2024-02-25 20:55:15 +01:00
<a
href="https://github.com/open-webui/open-webui/releases/tag/v{version.latest}"
target="_blank"
>
{updateAvailable ? `(v${version.latest} available!)` : '(latest)'}
</a>
2024-02-23 10:25:28 +01:00
</div>
<button
2024-02-23 10:26:07 +01:00
class=" underline flex items-center space-x-1 text-xs text-gray-500 dark:text-gray-500"
on:click={() => {
showChangelog.set(true);
}}
>
<div>See what's new</div>
</button>
2024-02-05 10:58:54 +01:00
</div>
2024-02-25 20:55:15 +01:00
<button
class=" text-xs px-3 py-1.5 bg-gray-100 hover:bg-gray-200 dark:bg-gray-850 dark:hover:bg-gray-800 transition rounded-lg font-medium"
on:click={() => {
checkForVersionUpdates();
}}
>
Check for updates
</button>
2024-02-05 10:58:54 +01:00
</div>
</div>
{#if ollamaVersion}
<hr class=" dark:border-gray-700" />
2024-02-05 10:58:54 +01:00
<div>
<div class=" mb-2.5 text-sm font-medium">Ollama Version</div>
<div class="flex w-full">
<div class="flex-1 text-xs text-gray-700 dark:text-gray-200">
{ollamaVersion ?? 'N/A'}
</div>
2024-02-05 10:58:54 +01:00
</div>
</div>
{/if}
2024-02-05 10:58:54 +01:00
<hr class=" dark:border-gray-700" />
<div class="flex space-x-1">
<a href="https://discord.gg/5rJgQTnV4s" target="_blank">
<img
alt="Discord"
2024-02-17 10:11:19 +01:00
src="https://img.shields.io/badge/Discord-Open_WebUI-blue?logo=discord&logoColor=white"
2024-02-05 10:58:54 +01:00
/>
</a>
2024-02-22 11:03:24 +01:00
<a href="https://twitter.com/OpenWebUI" target="_blank">
<img
alt="X (formerly Twitter) Follow"
src="https://img.shields.io/twitter/follow/OpenWebUI"
/>
</a>
2024-02-19 20:47:37 +01:00
<a href="https://github.com/open-webui/open-webui" target="_blank">
2024-02-05 10:58:54 +01:00
<img
alt="Github Repo"
2024-02-19 20:47:37 +01:00
src="https://img.shields.io/github/stars/open-webui/open-webui?style=social&label=Star us on Github"
2024-02-05 10:58:54 +01:00
/>
</a>
</div>
<div class="mt-2 text-xs text-gray-400 dark:text-gray-500">
Created by <a
class=" text-gray-500 dark:text-gray-300 font-medium"
href="https://github.com/tjbck"
target="_blank">Timothy J. Baek</a
>
</div>
</div>
</div>