About.svelte 3.77 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
	import { WEBUI_BUILD_HASH, WEBUI_VERSION } from '$lib/constants';
5
	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
	import { onMount, getContext } from 'svelte';

Timothy J. Baek's avatar
Timothy J. Baek committed
9
10
	import Tooltip from '$lib/components/common/Tooltip.svelte';

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

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

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

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

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

<div class="flex flex-col h-full justify-between space-y-3 text-sm mb-6">
	<div class=" space-y-3">
		<div>
48
49
			<div class=" mb-2.5 text-sm font-medium flex space-x-2 items-center">
				<div>
50
51
					{$WEBUI_NAME}
					{$i18n.t('Version')}
52
53
				</div>
			</div>
Timothy J. Baek's avatar
Timothy J. Baek committed
54
55
			<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
56
					<div class="flex gap-1">
57
						<Tooltip content={WEBUI_BUILD_HASH}>
Timothy J. Baek's avatar
Timothy J. Baek committed
58
59
							v{WEBUI_VERSION}
						</Tooltip>
Timothy J. Baek's avatar
Timothy J. Baek committed
60
61
62
63
64

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

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

				<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
89
					{$i18n.t('Check for updates')}
Timothy J. Baek's avatar
Timothy J. Baek committed
90
				</button>
Timothy J. Baek's avatar
Timothy J. Baek committed
91
92
93
			</div>
		</div>

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

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

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

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

		<div class="mt-2 text-xs text-gray-400 dark:text-gray-500">
Timothy J. Baek's avatar
Timothy J. Baek committed
133
134
135
			{#if !$WEBUI_NAME.includes('Open WebUI')}
				<span class=" text-gray-500 dark:text-gray-300 font-medium">{$WEBUI_NAME}</span> -
			{/if}{$i18n.t('Created by')}
Jannik Streidl's avatar
Jannik Streidl committed
136
			<a
Timothy J. Baek's avatar
Timothy J. Baek committed
137
138
139
140
141
142
143
				class=" text-gray-500 dark:text-gray-300 font-medium"
				href="https://github.com/tjbck"
				target="_blank">Timothy J. Baek</a
			>
		</div>
	</div>
</div>