About.svelte 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <script lang="ts">
  2. import { getVersionUpdates } from '$lib/apis';
  3. import { getOllamaVersion } from '$lib/apis/ollama';
  4. import { 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. const i18n = getContext('i18n');
  9. let ollamaVersion = '';
  10. let updateAvailable = null;
  11. let version = {
  12. current: '',
  13. latest: ''
  14. };
  15. const checkForVersionUpdates = async () => {
  16. updateAvailable = null;
  17. version = await getVersionUpdates(localStorage.token).catch((error) => {
  18. return {
  19. current: WEBUI_VERSION,
  20. latest: WEBUI_VERSION
  21. };
  22. });
  23. console.log(version);
  24. updateAvailable = compareVersion(version.latest, version.current);
  25. console.log(updateAvailable);
  26. };
  27. onMount(async () => {
  28. ollamaVersion = await getOllamaVersion(localStorage.token).catch((error) => {
  29. return '';
  30. });
  31. checkForVersionUpdates();
  32. });
  33. </script>
  34. <div class="flex flex-col h-full justify-between space-y-3 text-sm mb-6">
  35. <div class=" space-y-3">
  36. <div>
  37. <div class=" mb-2.5 text-sm font-medium flex space-x-2 items-center">
  38. <div>
  39. {$WEBUI_NAME}
  40. {$i18n.t('Version')}
  41. </div>
  42. </div>
  43. <div class="flex w-full justify-between items-center">
  44. <div class="flex flex-col text-xs text-gray-700 dark:text-gray-200">
  45. <div>
  46. v{WEBUI_VERSION}
  47. <a
  48. href="https://github.com/open-webui/open-webui/releases/tag/v{version.latest}"
  49. target="_blank"
  50. >
  51. {updateAvailable === null
  52. ? $i18n.t('Checking for updates...')
  53. : updateAvailable
  54. ? `(v${version.latest} ${$i18n.t('available!')})`
  55. : $i18n.t('(latest)')}
  56. </a>
  57. </div>
  58. <button
  59. class=" underline flex items-center space-x-1 text-xs text-gray-500 dark:text-gray-500"
  60. on:click={() => {
  61. showChangelog.set(true);
  62. }}
  63. >
  64. <div>{$i18n.t("See what's new")}</div>
  65. </button>
  66. </div>
  67. <button
  68. 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"
  69. on:click={() => {
  70. checkForVersionUpdates();
  71. }}
  72. >
  73. {$i18n.t('Check for updates')}
  74. </button>
  75. </div>
  76. </div>
  77. {#if ollamaVersion}
  78. <hr class=" dark:border-gray-700" />
  79. <div>
  80. <div class=" mb-2.5 text-sm font-medium">{$i18n.t('Ollama Version')}</div>
  81. <div class="flex w-full">
  82. <div class="flex-1 text-xs text-gray-700 dark:text-gray-200">
  83. {ollamaVersion ?? 'N/A'}
  84. </div>
  85. </div>
  86. </div>
  87. {/if}
  88. <hr class=" dark:border-gray-700" />
  89. <div class="flex space-x-1">
  90. <a href="https://discord.gg/5rJgQTnV4s" target="_blank">
  91. <img
  92. alt="Discord"
  93. src="https://img.shields.io/badge/Discord-Open_WebUI-blue?logo=discord&logoColor=white"
  94. />
  95. </a>
  96. <a href="https://twitter.com/OpenWebUI" target="_blank">
  97. <img
  98. alt="X (formerly Twitter) Follow"
  99. src="https://img.shields.io/twitter/follow/OpenWebUI"
  100. />
  101. </a>
  102. <a href="https://github.com/open-webui/open-webui" target="_blank">
  103. <img
  104. alt="Github Repo"
  105. src="https://img.shields.io/github/stars/open-webui/open-webui?style=social&label=Star us on Github"
  106. />
  107. </a>
  108. </div>
  109. <div class="mt-2 text-xs text-gray-400 dark:text-gray-500">
  110. {$i18n.t('Created by')}
  111. <a
  112. class=" text-gray-500 dark:text-gray-300 font-medium"
  113. href="https://github.com/tjbck"
  114. target="_blank">Timothy J. Baek</a
  115. >
  116. </div>
  117. </div>
  118. </div>