About.svelte 3.39 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';
7
8
9
	import { onMount, getContext } from 'svelte';

	const i18n = getContext('i18n');
Timothy J. Baek's avatar
Timothy J. Baek committed
10
11

	let ollamaVersion = '';
Timothy J. Baek's avatar
Timothy J. Baek committed
12

13
	let updateAvailable = null;
Timothy J. Baek's avatar
Timothy J. Baek committed
14
15
16
17
18
19
	let version = {
		current: '',
		latest: ''
	};

	const checkForVersionUpdates = async () => {
20
		updateAvailable = null;
Timothy J. Baek's avatar
Timothy J. Baek committed
21
22
23
24
25
26
27
28
29
30
31
32
33
		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
34
35
36
37
	onMount(async () => {
		ollamaVersion = await getOllamaVersion(localStorage.token).catch((error) => {
			return '';
		});
Timothy J. Baek's avatar
Timothy J. Baek committed
38
39

		checkForVersionUpdates();
Timothy J. Baek's avatar
Timothy J. Baek committed
40
41
42
43
44
45
	});
</script>

<div class="flex flex-col h-full justify-between space-y-3 text-sm mb-6">
	<div class=" space-y-3">
		<div>
46
47
			<div class=" mb-2.5 text-sm font-medium flex space-x-2 items-center">
				<div>
48
					{$WEBUI_NAME} Version
49
50
				</div>
			</div>
Timothy J. Baek's avatar
Timothy J. Baek committed
51
52
			<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
53
					<div>
54
						v{WEBUI_VERSION}
Timothy J. Baek's avatar
Timothy J. Baek committed
55
56
57
58
59

						<a
							href="https://github.com/open-webui/open-webui/releases/tag/v{version.latest}"
							target="_blank"
						>
60
61
62
63
64
							{updateAvailable === null
								? 'Checking for updates...'
								: updateAvailable
								? `(v${version.latest} available!)`
								: '(latest)'}
Timothy J. Baek's avatar
Timothy J. Baek committed
65
						</a>
Timothy J. Baek's avatar
Timothy J. Baek committed
66
					</div>
67
68

					<button
Timothy J. Baek's avatar
Timothy J. Baek committed
69
						class=" underline flex items-center space-x-1 text-xs text-gray-500 dark:text-gray-500"
70
71
72
73
74
75
						on:click={() => {
							showChangelog.set(true);
						}}
					>
						<div>See what's new</div>
					</button>
Timothy J. Baek's avatar
Timothy J. Baek committed
76
				</div>
Timothy J. Baek's avatar
Timothy J. Baek committed
77
78
79
80
81
82
83
84
85

				<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
86
87
88
			</div>
		</div>

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

92
			<div>
93
				<div class=" mb-2.5 text-sm font-medium">{$i18n.t('Ollama Version')}</div>
94
95
96
97
				<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
98
99
				</div>
			</div>
100
		{/if}
Timothy J. Baek's avatar
Timothy J. Baek committed
101
102
103
104
105
106
107

		<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
108
					src="https://img.shields.io/badge/Discord-Open_WebUI-blue?logo=discord&logoColor=white"
Timothy J. Baek's avatar
Timothy J. Baek committed
109
110
111
				/>
			</a>

Timothy J. Baek's avatar
Timothy J. Baek committed
112
113
114
115
116
117
118
			<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
119
			<a href="https://github.com/open-webui/open-webui" target="_blank">
Timothy J. Baek's avatar
Timothy J. Baek committed
120
121
				<img
					alt="Github Repo"
Timothy J. Baek's avatar
rename  
Timothy J. Baek committed
122
					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
123
124
125
126
127
128
129
130
131
132
133
134
135
				/>
			</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>