2023-12-30 07:03:48 +00:00
|
|
|
<script lang="ts">
|
|
|
|
import { onMount } from 'svelte';
|
|
|
|
|
|
|
|
export let models = [];
|
|
|
|
export let modelfiles = [];
|
|
|
|
|
|
|
|
let modelfile = null;
|
|
|
|
let selectedModelIdx = 0;
|
|
|
|
|
|
|
|
$: modelfile =
|
|
|
|
models[selectedModelIdx] in modelfiles ? modelfiles[models[selectedModelIdx]] : null;
|
|
|
|
|
|
|
|
$: if (models.length > 0) {
|
|
|
|
selectedModelIdx = models.length - 1;
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
{#if models.length > 0}
|
2024-02-16 00:20:46 +00:00
|
|
|
<div class="m-auto text-center max-w-md px-2">
|
2023-12-30 07:03:48 +00:00
|
|
|
<div class="flex justify-center mt-8">
|
2024-02-15 02:45:51 +00:00
|
|
|
<div class="flex -space-x-4 mb-1">
|
2023-12-30 07:03:48 +00:00
|
|
|
{#each models as model, modelIdx}
|
|
|
|
<button
|
|
|
|
on:click={() => {
|
|
|
|
selectedModelIdx = modelIdx;
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
{#if model in modelfiles}
|
|
|
|
<img
|
2024-02-10 03:14:26 +00:00
|
|
|
src={modelfiles[model]?.imageUrl ?? './favicon.png'}
|
2023-12-30 07:03:48 +00:00
|
|
|
alt="modelfile"
|
2024-02-15 02:45:51 +00:00
|
|
|
class=" w-14 rounded-full border-[1px] border-gray-200 dark:border-none"
|
2023-12-30 07:03:48 +00:00
|
|
|
draggable="false"
|
|
|
|
/>
|
|
|
|
{:else}
|
|
|
|
<img
|
2024-02-10 03:14:26 +00:00
|
|
|
src={models.length === 1 ? '/favicon.png' : '/favicon.png'}
|
2024-02-15 02:45:51 +00:00
|
|
|
class=" w-14 rounded-full border-[1px] border-gray-200 dark:border-none"
|
|
|
|
alt="logo"
|
2023-12-30 07:03:48 +00:00
|
|
|
draggable="false"
|
|
|
|
/>
|
|
|
|
{/if}
|
|
|
|
</button>
|
|
|
|
{/each}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class=" mt-2 text-2xl text-gray-800 dark:text-gray-100 font-semibold">
|
|
|
|
{#if modelfile}
|
|
|
|
<span class=" capitalize">
|
|
|
|
{modelfile.title}
|
|
|
|
</span>
|
|
|
|
<div class="mt-0.5 text-base font-normal text-gray-600 dark:text-gray-400">
|
|
|
|
{modelfile.desc}
|
|
|
|
</div>
|
|
|
|
{#if modelfile.user}
|
|
|
|
<div class="mt-0.5 text-sm font-normal text-gray-500 dark:text-gray-500">
|
2024-02-17 07:04:37 +00:00
|
|
|
By <a href="https://openwebui.com/m/{modelfile.user.username}"
|
2023-12-30 07:03:48 +00:00
|
|
|
>{modelfile.user.name ? modelfile.user.name : `@${modelfile.user.username}`}</a
|
|
|
|
>
|
|
|
|
</div>
|
|
|
|
{/if}
|
|
|
|
{:else}
|
|
|
|
How can I help you today?
|
|
|
|
{/if}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{/if}
|