Placeholder.svelte 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <script lang="ts">
  2. import { WEBUI_BASE_URL } from '$lib/constants';
  3. import { onMount } from 'svelte';
  4. export let models = [];
  5. export let modelfiles = [];
  6. let modelfile = null;
  7. let selectedModelIdx = 0;
  8. $: modelfile =
  9. models[selectedModelIdx] in modelfiles ? modelfiles[models[selectedModelIdx]] : null;
  10. $: if (models.length > 0) {
  11. selectedModelIdx = models.length - 1;
  12. }
  13. </script>
  14. {#if models.length > 0}
  15. <div class="m-auto text-center max-w-md px-2">
  16. <div class="flex justify-center mt-8">
  17. <div class="flex -space-x-4 mb-1">
  18. {#each models as model, modelIdx}
  19. <button
  20. on:click={() => {
  21. selectedModelIdx = modelIdx;
  22. }}
  23. >
  24. {#if model in modelfiles}
  25. <img
  26. src={modelfiles[model]?.imageUrl ?? `${WEBUI_BASE_URL}/static/favicon.png`}
  27. alt="modelfile"
  28. class=" w-14 rounded-full border-[1px] border-gray-200 dark:border-none"
  29. draggable="false"
  30. />
  31. {:else}
  32. <img
  33. src={models.length === 1
  34. ? `${WEBUI_BASE_URL}/static/favicon.png`
  35. : `${WEBUI_BASE_URL}/static/favicon.png`}
  36. class=" w-14 rounded-full border-[1px] border-gray-200 dark:border-none"
  37. alt="logo"
  38. draggable="false"
  39. />
  40. {/if}
  41. </button>
  42. {/each}
  43. </div>
  44. </div>
  45. <div class=" mt-2 text-2xl text-gray-800 dark:text-gray-100 font-semibold">
  46. {#if modelfile}
  47. <span class=" capitalize">
  48. {modelfile.title}
  49. </span>
  50. <div class="mt-0.5 text-base font-normal text-gray-600 dark:text-gray-400">
  51. {modelfile.desc}
  52. </div>
  53. {#if modelfile.user}
  54. <div class="mt-0.5 text-sm font-normal text-gray-500 dark:text-gray-500">
  55. By <a href="https://openwebui.com/m/{modelfile.user.username}"
  56. >{modelfile.user.name ? modelfile.user.name : `@${modelfile.user.username}`}</a
  57. >
  58. </div>
  59. {/if}
  60. {:else}
  61. How can I help you today?
  62. {/if}
  63. </div>
  64. </div>
  65. {/if}