Placeholder.svelte 1.9 KB

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