Placeholder.svelte 2.61 KB
Newer Older
1
<script lang="ts">
2
	import { WEBUI_BASE_URL } from '$lib/constants';
Timothy J. Baek's avatar
Timothy J. Baek committed
3
	import { user } from '$lib/stores';
4
	import { onMount, getContext } from 'svelte';
Timothy J. Baek's avatar
Timothy J. Baek committed
5
	import Suggestions from '../MessageInput/Suggestions.svelte';
Timothy J. Baek's avatar
Timothy J. Baek committed
6
	import Bolt from '$lib/components/icons/Bolt.svelte';
7
8

	const i18n = getContext('i18n');
9
10
11
12

	export let models = [];
	export let modelfiles = [];

Timothy J. Baek's avatar
Timothy J. Baek committed
13
14
15
	export let submitPrompt;
	export let suggestionPrompts;

16
17
18
19
20
21
22
23
24
25
26
27
	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}
Timothy J. Baek's avatar
Timothy J. Baek committed
28
	<div class="m-auto w-full max-w-3xl px-8 pb-24">
Timothy J. Baek's avatar
Timothy J. Baek committed
29
		<!-- <div class="flex justify-start">
Timothy J. Baek's avatar
Timothy J. Baek committed
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
			<div class="flex -space-x-4 mb-0.5">
				{#each models as model, modelIdx}
					<button
						on:click={() => {
							selectedModelIdx = modelIdx;
						}}
					>
						{#if model in modelfiles}
							<img
								src={modelfiles[model]?.imageUrl ?? `${WEBUI_BASE_URL}/static/favicon.png`}
								alt="modelfile"
								class=" size-[2.7rem] rounded-full border-[1px] border-gray-200 dark:border-none"
								draggable="false"
							/>
						{:else}
							<img
								src={$i18n.language === 'dg-DG'
									? `/doge.png`
									: `${WEBUI_BASE_URL}/static/favicon.png`}
								class=" size-[2.7rem] rounded-full border-[1px] border-gray-200 dark:border-none"
								alt="logo"
								draggable="false"
							/>
Timothy J. Baek's avatar
Timothy J. Baek committed
53
						{/if}
Timothy J. Baek's avatar
Timothy J. Baek committed
54
55
56
					</button>
				{/each}
			</div>
Timothy J. Baek's avatar
Timothy J. Baek committed
57
		</div> -->
Timothy J. Baek's avatar
Timothy J. Baek committed
58
		<div
Timothy J. Baek's avatar
Timothy J. Baek committed
59
			class=" mt-2 mb-4 text-3xl text-gray-800 dark:text-gray-100 font-semibold text-left flex items-center gap-4"
Timothy J. Baek's avatar
Timothy J. Baek committed
60
61
62
63
64
65
66
67
68
69
70
71
72
73
		>
			<div>
				{#if modelfile}
					<span class=" capitalize">
						{modelfile.title}
					</span>
					<div class="mt-0.5 text-base font-normal text-gray-500 dark:text-gray-400">
						{modelfile.desc}
					</div>
					{#if modelfile.user}
						<div class="mt-0.5 text-sm font-normal text-gray-400 dark:text-gray-500">
							By <a href="https://openwebui.com/m/{modelfile.user.username}"
								>{modelfile.user.name ? modelfile.user.name : `@${modelfile.user.username}`}</a
							>
Timothy J. Baek's avatar
Timothy J. Baek committed
74
75
						</div>
					{/if}
Timothy J. Baek's avatar
Timothy J. Baek committed
76
77
				{:else}
					<div class=" line-clamp-1">{$i18n.t('Hello, {{name}}', { name: $user.name })}</div>
Timothy J. Baek's avatar
Timothy J. Baek committed
78

Timothy J. Baek's avatar
Timothy J. Baek committed
79
80
81
82
					<div class=" font-medium text-gray-400 dark:text-gray-500">
						{$i18n.t('How can I help you today?')}
					</div>
				{/if}
Timothy J. Baek's avatar
Timothy J. Baek committed
83
			</div>
84
		</div>
Timothy J. Baek's avatar
Timothy J. Baek committed
85
86

		<div class=" w-full">
Timothy J. Baek's avatar
Timothy J. Baek committed
87
88
89
90
			<div class="mb-2 flex gap-1 text-sm font-medium items-center dark:text-gray-600">
				<Bolt />
				Suggested
			</div>
Timothy J. Baek's avatar
Timothy J. Baek committed
91
92
			<Suggestions {suggestionPrompts} {submitPrompt} />
		</div>
93
94
	</div>
{/if}