Files
open-webui/src/lib/components/chat/Settings/About.svelte
T
2026-12-02 23:41:26 +04:00

190 lines
6.5 KiB
Svelte

<script lang="ts">
// Keep keys in nested template expressions visible to i18next-parser.
// $i18n.t("licensed under");
import { getVersionUpdates } from '$lib/apis';
import { getOllamaVersion } from '$lib/apis/ollama';
import { WEBUI_BUILD_CHANNEL, WEBUI_VERSION } from '$lib/constants';
import { WEBUI_NAME, config, settings, showChangelog } from '$lib/stores';
import { compareVersion } from '$lib/utils';
import { onMount, getContext } from 'svelte';
import BuildVersion from '$lib/components/common/BuildVersion.svelte';
import UserSettingRow from './UserSettingRow.svelte';
import UserSettingSection from './UserSettingSection.svelte';
const i18n: any = getContext('i18n');
let ollamaVersion = '';
let updateAvailable = null;
let version = {
current: '',
latest: ''
};
// Settings search reads these keys from the locale file, which i18n:parse cannot see: $i18n.t('settings.personal.about.sections.community.title')
const communityLinks = [
['GitHub', 'https://github.com/open-webui/open-webui'],
['Enterprise', 'https://docs.openwebui.com/enterprise'],
['Careers', 'https://careers.openwebui.com/'],
['Sponsor', 'https://github.com/sponsors/open-webui'],
['Discord', 'https://discord.gg/5rJgQTnV4s'],
['Reddit', 'https://www.reddit.com/r/OpenWebUI/'],
['X', 'https://x.com/OpenWebUI']
];
const actionButtonClass =
'text-xs text-base-500 transition-colors hover:text-base-900 dark:text-base-500 dark:hover:text-base-0';
const checkForVersionUpdates = async () => {
updateAvailable = null;
version = await getVersionUpdates(localStorage.token).catch((error) => {
return {
current: WEBUI_VERSION,
latest: null
};
});
console.log(version);
updateAvailable = compareVersion(version.latest, version.current);
console.log(updateAvailable);
};
onMount(async () => {
ollamaVersion = await getOllamaVersion(localStorage.token).catch((error) => {
return '';
});
if (WEBUI_BUILD_CHANNEL === 'main' && $config?.features?.enable_version_update_check) {
checkForVersionUpdates();
}
});
</script>
<div id="tab-about" class="flex flex-col h-full justify-between text-sm">
<div class="flex-1 min-h-0 overflow-y-auto scrollbar-hover pr-1.5">
<UserSettingSection title={$i18n.t('settings.personal.about.title')} first>
<UserSettingRow description={$i18n.t('settings.personal.about.seeWhatSNew.description')}>
<div slot="label" class="flex flex-col gap-1 text-xs text-base-800 dark:text-base-200">
<!-- LICENSE covers this Open WebUI About identifier.
Do not alter, remove, obscure, or replace it except as LICENSE permits:
https://docs.openwebui.com/license. -->
<div>
{`${$WEBUI_NAME} ${$i18n.t('settings.personal.about.sections.version.title')}`}
</div>
<div
class="flex flex-wrap {($settings?.highContrastMode ?? false)
? 'items-center'
: ''} gap-1 text-base-500 dark:text-base-400"
>
<BuildVersion />
{#if WEBUI_BUILD_CHANNEL === 'main' && $config?.features?.enable_version_update_check}
{#if version.latest === null}
<span>{$i18n.t('Could not check for updates')}</span>
{:else}
<a
class={($settings?.highContrastMode ?? false)
? 'inline-flex min-h-6 items-center'
: ''}
href="https://github.com/open-webui/open-webui/releases/tag/v{version.latest}"
target="_blank"
>
{updateAvailable === null
? $i18n.t('Checking for updates...')
: updateAvailable
? `(v${version.latest} ${$i18n.t('available!')})`
: $i18n.t('(latest)')}
</a>
{/if}
{/if}
</div>
<button
class="self-start {($settings?.highContrastMode ?? false)
? 'inline-flex min-h-6 items-center'
: ''} {actionButtonClass}"
on:click={() => {
showChangelog.set(true);
}}
>
<div>{$i18n.t('settings.personal.about.seeWhatSNew.label')}</div>
</button>
</div>
{#if WEBUI_BUILD_CHANNEL === 'main' && $config?.features?.enable_version_update_check}
<button
class={actionButtonClass}
on:click={() => {
checkForVersionUpdates();
}}
>
{$i18n.t('settings.personal.about.checkForUpdates.label')}
</button>
{/if}
</UserSettingRow>
{#if $config?.license_metadata}
<!-- LICENSE covers this Open WebUI license attribution.
Do not alter, remove, obscure, or replace it except as LICENSE permits:
https://docs.openwebui.com/license. -->
<div class="text-xs text-base-600 dark:text-base-400">
{#if !$WEBUI_NAME.includes('Open WebUI')}
<span>{$WEBUI_NAME}</span> -
{/if}
<span class="capitalize">{$config?.license_metadata?.type}</span>
{$i18n.t('license purchased by')}
<span class="capitalize">{$config?.license_metadata?.organization_name}</span>
</div>
{:else}
<div class="flex flex-wrap gap-x-1.5 gap-y-1 text-xs text-base-500 dark:text-base-400">
{#each communityLinks as [label, href], idx}
{#if idx > 0}<span aria-hidden="true">·</span>{/if}
<a class="hover:text-base-700 dark:hover:text-base-400" {href} target="_blank"
>{label}</a
>
{/each}
</div>
{/if}
</UserSettingSection>
{#if ollamaVersion}
<UserSettingSection title={$i18n.t('settings.personal.about.sections.ollamaVersion.title')}>
<div class="text-xs text-base-600 dark:text-base-400">
{ollamaVersion ?? 'N/A'}
</div>
</UserSettingSection>
{/if}
<UserSettingSection>
<div class="text-xs text-base-500 dark:text-base-400">
{$i18n.t('Emoji graphics provided by')}
<a href="https://github.com/jdecked/twemoji" target="_blank">Twemoji</a>, {$i18n.t(
'licensed under'
)}
<a href="https://creativecommons.org/licenses/by/4.0/" target="_blank">CC-BY 4.0</a>.
</div>
<div class="text-xs text-base-500 dark:text-base-400">
<!-- LICENSE covers this Open WebUI copyright attribution.
Do not alter, remove, obscure, or replace it except as LICENSE permits:
https://docs.openwebui.com/license. -->
{$i18n.t('Copyright (c)')}
{new Date().getFullYear()}
<a href="https://openwebui.com" target="_blank" class="underline">Open WebUI Inc.</a>
<a href="https://github.com/open-webui/open-webui/blob/main/LICENSE" target="_blank"
>{$i18n.t('All rights reserved.')}</a
>
</div>
<div class="text-xs text-base-500 dark:text-base-400">
{$i18n.t('Created by')}
<a class="text-base-500 dark:text-base-400" href="https://github.com/tjbck" target="_blank"
>Tim J. Baek</a
>
</div>
</UserSettingSection>
</div>
</div>