About.svelte 3.48 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
49
					{$WEBUI_NAME}
					{$i18n.t('Version')}
50
51
				</div>
			</div>
Timothy J. Baek's avatar
Timothy J. Baek committed
52
53
			<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
54
					<div>
55
						v{WEBUI_VERSION}
Timothy J. Baek's avatar
Timothy J. Baek committed
56
57
58
59
60

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

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

				<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();
					}}
				>
Jannik Streidl's avatar
Jannik Streidl committed
85
					{$i18n.t('Check for updates')}
Timothy J. Baek's avatar
Timothy J. Baek committed
86
				</button>
Timothy J. Baek's avatar
Timothy J. Baek committed
87
88
89
			</div>
		</div>

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

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

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

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

		<div class="mt-2 text-xs text-gray-400 dark:text-gray-500">
Jannik Streidl's avatar
Jannik Streidl committed
129
130
			{$i18n.t('Created by')}
			<a
Timothy J. Baek's avatar
Timothy J. Baek committed
131
132
133
134
135
136
137
				class=" text-gray-500 dark:text-gray-300 font-medium"
				href="https://github.com/tjbck"
				target="_blank">Timothy J. Baek</a
			>
		</div>
	</div>
</div>