About.svelte 3.22 KB
Newer Older
Timothy J. Baek's avatar
Timothy J. Baek committed
1
<script lang="ts">
Timothy J. Baek's avatar
Timothy J. Baek committed
2
	import { getVersionUpdates } from '$lib/apis';
Timothy J. Baek's avatar
Timothy J. Baek committed
3
	import { getOllamaVersion } from '$lib/apis/ollama';
4
5
	import { WEBUI_VERSION } from '$lib/constants';
	import { WEBUI_NAME, config, showChangelog } from '$lib/stores';
Timothy J. Baek's avatar
Timothy J. Baek committed
6
	import { compareVersion } from '$lib/utils';
Timothy J. Baek's avatar
Timothy J. Baek committed
7
8
9
	import { onMount } from 'svelte';

	let ollamaVersion = '';
Timothy J. Baek's avatar
Timothy J. Baek committed
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

	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);
	};

Timothy J. Baek's avatar
Timothy J. Baek committed
31
32
33
34
	onMount(async () => {
		ollamaVersion = await getOllamaVersion(localStorage.token).catch((error) => {
			return '';
		});
Timothy J. Baek's avatar
Timothy J. Baek committed
35
36

		checkForVersionUpdates();
Timothy J. Baek's avatar
Timothy J. Baek committed
37
38
39
40
41
42
	});
</script>

<div class="flex flex-col h-full justify-between space-y-3 text-sm mb-6">
	<div class=" space-y-3">
		<div>
43
44
			<div class=" mb-2.5 text-sm font-medium flex space-x-2 items-center">
				<div>
45
					{$WEBUI_NAME} Version
46
47
				</div>
			</div>
Timothy J. Baek's avatar
Timothy J. Baek committed
48
49
			<div class="flex w-full justify-between items-center">
				<div class="flex flex-col text-xs text-gray-700 dark:text-gray-200">
Timothy J. Baek's avatar
Timothy J. Baek committed
50
					<div>
51
						v{WEBUI_VERSION}
Timothy J. Baek's avatar
Timothy J. Baek committed
52
53
54
55
56
57
58

						<a
							href="https://github.com/open-webui/open-webui/releases/tag/v{version.latest}"
							target="_blank"
						>
							{updateAvailable ? `(v${version.latest} available!)` : '(latest)'}
						</a>
Timothy J. Baek's avatar
Timothy J. Baek committed
59
					</div>
60
61

					<button
Timothy J. Baek's avatar
Timothy J. Baek committed
62
						class=" underline flex items-center space-x-1 text-xs text-gray-500 dark:text-gray-500"
63
64
65
66
67
68
						on:click={() => {
							showChangelog.set(true);
						}}
					>
						<div>See what's new</div>
					</button>
Timothy J. Baek's avatar
Timothy J. Baek committed
69
				</div>
Timothy J. Baek's avatar
Timothy J. Baek committed
70
71
72
73
74
75
76
77
78

				<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>
Timothy J. Baek's avatar
Timothy J. Baek committed
79
80
81
			</div>
		</div>

82
83
		{#if ollamaVersion}
			<hr class=" dark:border-gray-700" />
Timothy J. Baek's avatar
Timothy J. Baek committed
84

85
86
87
88
89
90
			<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>
Timothy J. Baek's avatar
Timothy J. Baek committed
91
92
				</div>
			</div>
93
		{/if}
Timothy J. Baek's avatar
Timothy J. Baek committed
94
95
96
97
98
99
100

		<hr class=" dark:border-gray-700" />

		<div class="flex space-x-1">
			<a href="https://discord.gg/5rJgQTnV4s" target="_blank">
				<img
					alt="Discord"
Timothy J. Baek's avatar
Timothy J. Baek committed
101
					src="https://img.shields.io/badge/Discord-Open_WebUI-blue?logo=discord&logoColor=white"
Timothy J. Baek's avatar
Timothy J. Baek committed
102
103
104
				/>
			</a>

Timothy J. Baek's avatar
Timothy J. Baek committed
105
106
107
108
109
110
111
			<a href="https://twitter.com/OpenWebUI" target="_blank">
				<img
					alt="X (formerly Twitter) Follow"
					src="https://img.shields.io/twitter/follow/OpenWebUI"
				/>
			</a>

Timothy J. Baek's avatar
rename  
Timothy J. Baek committed
112
			<a href="https://github.com/open-webui/open-webui" target="_blank">
Timothy J. Baek's avatar
Timothy J. Baek committed
113
114
				<img
					alt="Github Repo"
Timothy J. Baek's avatar
rename  
Timothy J. Baek committed
115
					src="https://img.shields.io/github/stars/open-webui/open-webui?style=social&label=Star us on Github"
Timothy J. Baek's avatar
Timothy J. Baek committed
116
117
118
119
120
121
122
123
124
125
126
127
128
				/>
			</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>