About.svelte 3.3 KB

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