About.svelte 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. <script lang="ts">
  2. import { getVersionUpdates } from '$lib/apis';
  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';
  6. import { compareVersion } from '$lib/utils';
  7. import { onMount, getContext } from 'svelte';
  8. import Tooltip from '$lib/components/common/Tooltip.svelte';
  9. const i18n = getContext('i18n');
  10. let ollamaVersion = '';
  11. let updateAvailable = null;
  12. let version = {
  13. current: '',
  14. latest: ''
  15. };
  16. const checkForVersionUpdates = async () => {
  17. updateAvailable = null;
  18. version = await getVersionUpdates(localStorage.token).catch((error) => {
  19. return {
  20. current: WEBUI_VERSION,
  21. latest: WEBUI_VERSION
  22. };
  23. });
  24. console.log(version);
  25. updateAvailable = compareVersion(version.latest, version.current);
  26. console.log(updateAvailable);
  27. };
  28. onMount(async () => {
  29. ollamaVersion = await getOllamaVersion(localStorage.token).catch((error) => {
  30. return '';
  31. });
  32. checkForVersionUpdates();
  33. });
  34. </script>
  35. <div class="flex flex-col h-full justify-between space-y-3 text-sm mb-6">
  36. <div class=" space-y-3 overflow-y-scroll max-h-[28rem] lg:max-h-full">
  37. <div>
  38. <div class=" mb-2.5 text-sm font-medium flex space-x-2 items-center">
  39. <div>
  40. {$WEBUI_NAME}
  41. {$i18n.t('Version')}
  42. </div>
  43. </div>
  44. <div class="flex w-full justify-between items-center">
  45. <div class="flex flex-col text-xs text-gray-700 dark:text-gray-200">
  46. <div class="flex gap-1">
  47. <Tooltip content={WEBUI_BUILD_HASH}>
  48. v{WEBUI_VERSION}
  49. </Tooltip>
  50. <a
  51. href="https://github.com/open-webui/open-webui/releases/tag/v{version.latest}"
  52. target="_blank"
  53. >
  54. {updateAvailable === null
  55. ? $i18n.t('Checking for updates...')
  56. : updateAvailable
  57. ? `(v${version.latest} ${$i18n.t('available!')})`
  58. : $i18n.t('(latest)')}
  59. </a>
  60. </div>
  61. <button
  62. class=" underline flex items-center space-x-1 text-xs text-gray-500 dark:text-gray-500"
  63. on:click={() => {
  64. showChangelog.set(true);
  65. }}
  66. >
  67. <div>{$i18n.t("See what's new")}</div>
  68. </button>
  69. </div>
  70. <button
  71. 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"
  72. on:click={() => {
  73. checkForVersionUpdates();
  74. }}
  75. >
  76. {$i18n.t('Check for updates')}
  77. </button>
  78. </div>
  79. </div>
  80. {#if ollamaVersion}
  81. <hr class=" border-gray-100 dark:border-gray-850" />
  82. <div>
  83. <div class=" mb-2.5 text-sm font-medium">{$i18n.t('Ollama Version')}</div>
  84. <div class="flex w-full">
  85. <div class="flex-1 text-xs text-gray-700 dark:text-gray-200">
  86. {ollamaVersion ?? 'N/A'}
  87. </div>
  88. </div>
  89. </div>
  90. {/if}
  91. <hr class=" border-gray-100 dark:border-gray-850" />
  92. {#if $config?.license_metadata}
  93. <div class="mb-2 text-xs">
  94. {#if !$WEBUI_NAME.includes('Open WebUI')}
  95. <span class=" text-gray-500 dark:text-gray-300 font-medium">{$WEBUI_NAME}</span> -
  96. {/if}
  97. <span class=" capitalize">{$config?.license_metadata?.type}</span> license purchased by
  98. <span class=" capitalize">{$config?.license_metadata?.organization_name}</span>
  99. </div>
  100. {:else}
  101. <div class="flex space-x-1">
  102. <a href="https://discord.gg/5rJgQTnV4s" target="_blank">
  103. <img
  104. alt="Discord"
  105. src="https://img.shields.io/badge/Discord-Open_WebUI-blue?logo=discord&logoColor=white"
  106. />
  107. </a>
  108. <a href="https://twitter.com/OpenWebUI" target="_blank">
  109. <img
  110. alt="X (formerly Twitter) Follow"
  111. src="https://img.shields.io/twitter/follow/OpenWebUI"
  112. />
  113. </a>
  114. <a href="https://github.com/open-webui/open-webui" target="_blank">
  115. <img
  116. alt="Github Repo"
  117. src="https://img.shields.io/github/stars/open-webui/open-webui?style=social&label=Star us on Github"
  118. />
  119. </a>
  120. </div>
  121. {/if}
  122. <div class="mt-2 text-xs text-gray-400 dark:text-gray-500">
  123. Emoji graphics provided by
  124. <a href="https://github.com/jdecked/twemoji" target="_blank">Twemoji</a>, licensed under
  125. <a href="https://creativecommons.org/licenses/by/4.0/" target="_blank">CC-BY 4.0</a>.
  126. </div>
  127. <div>
  128. <pre
  129. class="text-xs text-gray-400 dark:text-gray-500">Copyright (c) {new Date().getFullYear()} <a
  130. href="https://openwebui.com"
  131. target="_blank"
  132. class="underline">Open WebUI (Timothy Jaeryang Baek)</a
  133. >
  134. All rights reserved.
  135. Redistribution and use in source and binary forms, with or without
  136. modification, are permitted provided that the following conditions are met:
  137. 1. Redistributions of source code must retain the above copyright notice, this
  138. list of conditions and the following disclaimer.
  139. 2. Redistributions in binary form must reproduce the above copyright notice,
  140. this list of conditions and the following disclaimer in the documentation
  141. and/or other materials provided with the distribution.
  142. 3. Neither the name of the copyright holder nor the names of its
  143. contributors may be used to endorse or promote products derived from
  144. this software without specific prior written permission.
  145. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  146. AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  147. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  148. DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  149. FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  150. DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  151. SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  152. CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  153. OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  154. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  155. </pre>
  156. </div>
  157. <div class="mt-2 text-xs text-gray-400 dark:text-gray-500">
  158. {$i18n.t('Created by')}
  159. <a
  160. class=" text-gray-500 dark:text-gray-300 font-medium"
  161. href="https://github.com/tjbck"
  162. target="_blank">Timothy J. Baek</a
  163. >
  164. </div>
  165. </div>
  166. </div>