About.svelte 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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">
  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=" 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=" dark:border-gray-850" />
  92. <div class="flex space-x-1">
  93. <a href="https://discord.gg/5rJgQTnV4s" target="_blank">
  94. <img
  95. alt="Discord"
  96. src="https://img.shields.io/badge/Discord-Open_WebUI-blue?logo=discord&logoColor=white"
  97. />
  98. </a>
  99. <a href="https://twitter.com/OpenWebUI" target="_blank">
  100. <img
  101. alt="X (formerly Twitter) Follow"
  102. src="https://img.shields.io/twitter/follow/OpenWebUI"
  103. />
  104. </a>
  105. <a href="https://github.com/open-webui/open-webui" target="_blank">
  106. <img
  107. alt="Github Repo"
  108. src="https://img.shields.io/github/stars/open-webui/open-webui?style=social&label=Star us on Github"
  109. />
  110. </a>
  111. </div>
  112. <div class="mt-2 text-xs text-gray-400 dark:text-gray-500">
  113. {#if !$WEBUI_NAME.includes('Open WebUI')}
  114. <span class=" text-gray-500 dark:text-gray-300 font-medium">{$WEBUI_NAME}</span> -
  115. {/if}{$i18n.t('Created by')}
  116. <a
  117. class=" text-gray-500 dark:text-gray-300 font-medium"
  118. href="https://github.com/tjbck"
  119. target="_blank">Timothy J. Baek</a
  120. >
  121. </div>
  122. </div>
  123. </div>