Placeholder.svelte 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <script lang="ts">
  2. import { WEBUI_BASE_URL } from '$lib/constants';
  3. import { user } from '$lib/stores';
  4. import { onMount, getContext } from 'svelte';
  5. import Suggestions from '../MessageInput/Suggestions.svelte';
  6. import Bolt from '$lib/components/icons/Bolt.svelte';
  7. const i18n = getContext('i18n');
  8. export let models = [];
  9. export let modelfiles = [];
  10. export let submitPrompt;
  11. export let suggestionPrompts;
  12. let modelfile = null;
  13. let selectedModelIdx = 0;
  14. $: modelfile =
  15. models[selectedModelIdx] in modelfiles ? modelfiles[models[selectedModelIdx]] : null;
  16. $: if (models.length > 0) {
  17. selectedModelIdx = models.length - 1;
  18. }
  19. </script>
  20. {#if models.length > 0}
  21. <div class="m-auto w-full max-w-3xl px-8 pb-32">
  22. <div class="flex justify-start">
  23. <div class="flex -space-x-4 mb-1">
  24. {#each models as model, modelIdx}
  25. <button
  26. on:click={() => {
  27. selectedModelIdx = modelIdx;
  28. }}
  29. >
  30. {#if model in modelfiles}
  31. <img
  32. src={modelfiles[model]?.imageUrl ?? `${WEBUI_BASE_URL}/static/favicon.png`}
  33. alt="modelfile"
  34. class=" size-[2.7rem] rounded-full border-[1px] border-gray-200 dark:border-none"
  35. draggable="false"
  36. />
  37. {:else}
  38. <img
  39. src={$i18n.language === 'dg-DG'
  40. ? `/doge.png`
  41. : `${WEBUI_BASE_URL}/static/favicon.png`}
  42. class=" size-[2.7rem] rounded-full border-[1px] border-gray-200 dark:border-none"
  43. alt="logo"
  44. draggable="false"
  45. />
  46. {/if}
  47. </button>
  48. {/each}
  49. </div>
  50. </div>
  51. <div
  52. class=" mt-2 mb-4 text-3xl text-gray-800 dark:text-gray-100 font-semibold text-left flex items-center gap-4"
  53. >
  54. <div>
  55. {#if modelfile}
  56. <span class=" capitalize">
  57. {modelfile.title}
  58. </span>
  59. <div class="mt-0.5 text-base font-normal text-gray-500 dark:text-gray-400">
  60. {modelfile.desc}
  61. </div>
  62. {#if modelfile.user}
  63. <div class="mt-0.5 text-sm font-normal text-gray-400 dark:text-gray-500">
  64. By <a href="https://openwebui.com/m/{modelfile.user.username}"
  65. >{modelfile.user.name ? modelfile.user.name : `@${modelfile.user.username}`}</a
  66. >
  67. </div>
  68. {/if}
  69. {:else}
  70. <div class=" line-clamp-1">{$i18n.t('Hello, {{name}}', { name: $user.name })}</div>
  71. <div class=" font-medium text-gray-400 dark:text-gray-500">
  72. {$i18n.t('How can I help you today?')}
  73. </div>
  74. {/if}
  75. </div>
  76. </div>
  77. <div class=" w-full">
  78. <Suggestions {suggestionPrompts} {submitPrompt} />
  79. </div>
  80. </div>
  81. {/if}