refac: styling

This commit is contained in:
Timothy J. Baek 2024-05-01 22:39:09 -07:00
parent 68cfccedee
commit 6d378844ae
5 changed files with 84 additions and 46 deletions

View file

@ -480,7 +480,8 @@
]; ];
}} }}
/> />
{:else if prompt.charAt(0) === '@'} {/if}
<Models <Models
bind:this={modelsElement} bind:this={modelsElement}
bind:prompt bind:prompt
@ -488,7 +489,6 @@
bind:chatInputPlaceholder bind:chatInputPlaceholder
{messages} {messages}
/> />
{/if}
<!-- {#if messages.length == 0 && suggestionPrompts.length !== 0} <!-- {#if messages.length == 0 && suggestionPrompts.length !== 0}
<Suggestions {suggestionPrompts} {submitPrompt} /> <Suggestions {suggestionPrompts} {submitPrompt} />

View file

@ -13,16 +13,13 @@
export let chatInputPlaceholder = ''; export let chatInputPlaceholder = '';
export let messages = []; export let messages = [];
let selectedModel = null;
let selectedIdx = 0; let selectedIdx = 0;
let filteredModels = []; let filteredModels = [];
$: filteredModels = $models $: filteredModels = $models
.filter( .filter((p) => p.name.includes(prompt.split(' ')?.at(0)?.substring(1) ?? ''))
(p) =>
p.name !== 'hr' &&
!p.external &&
p.name.includes(prompt.split(' ')?.at(0)?.substring(1) ?? '')
)
.sort((a, b) => a.name.localeCompare(b.name)); .sort((a, b) => a.name.localeCompare(b.name));
$: if (prompt) { $: if (prompt) {
@ -38,6 +35,13 @@
}; };
const confirmSelect = async (model) => { const confirmSelect = async (model) => {
prompt = '';
selectedModel = model;
console.log(selectedModel);
};
const confirmSelectCollaborativeChat = async (model) => {
// dispatch('select', model); // dispatch('select', model);
prompt = ''; prompt = '';
user = JSON.parse(JSON.stringify(model.name)); user = JSON.parse(JSON.stringify(model.name));
@ -127,6 +131,7 @@
}; };
</script> </script>
{#if prompt.charAt(0) === '@'}
{#if filteredModels.length > 0} {#if filteredModels.length > 0}
<div class="md:px-2 mb-3 text-left w-full absolute bottom-0 left-0 right-0"> <div class="md:px-2 mb-3 text-left w-full absolute bottom-0 left-0 right-0">
<div class="flex w-full px-2"> <div class="flex w-full px-2">
@ -164,3 +169,12 @@
</div> </div>
</div> </div>
{/if} {/if}
{/if}
{#if selectedModel !== null}
<div class="md:px-2 mb-3 text-left w-full absolute bottom-0 left-0 right-0">
<div>
{JSON.stringify(selectedModel)}
</div>
</div>
{/if}

View file

@ -3,6 +3,7 @@
import { user } from '$lib/stores'; import { user } from '$lib/stores';
import { onMount, getContext } from 'svelte'; import { onMount, getContext } from 'svelte';
import Suggestions from '../MessageInput/Suggestions.svelte'; import Suggestions from '../MessageInput/Suggestions.svelte';
import Bolt from '$lib/components/icons/Bolt.svelte';
const i18n = getContext('i18n'); const i18n = getContext('i18n');
@ -25,7 +26,7 @@
{#if models.length > 0} {#if models.length > 0}
<div class="m-auto w-full max-w-3xl px-8 pb-24"> <div class="m-auto w-full max-w-3xl px-8 pb-24">
<div class="flex justify-start"> <!-- <div class="flex justify-start">
<div class="flex -space-x-4 mb-0.5"> <div class="flex -space-x-4 mb-0.5">
{#each models as model, modelIdx} {#each models as model, modelIdx}
<button <button
@ -53,9 +54,9 @@
</button> </button>
{/each} {/each}
</div> </div>
</div> </div> -->
<div <div
class=" mt-2 mb-4 text-2xl text-gray-800 dark:text-gray-100 font-semibold text-left flex items-center gap-4" class=" mt-2 mb-4 text-3xl text-gray-800 dark:text-gray-100 font-semibold text-left flex items-center gap-4"
> >
<div> <div>
{#if modelfile} {#if modelfile}
@ -83,6 +84,10 @@
</div> </div>
<div class=" w-full"> <div class=" w-full">
<div class="mb-2 flex gap-1 text-sm font-medium items-center dark:text-gray-600">
<Bolt />
Suggested
</div>
<Suggestions {suggestionPrompts} {submitPrompt} /> <Suggestions {suggestionPrompts} {submitPrompt} />
</div> </div>
</div> </div>

View file

@ -0,0 +1,19 @@
<script lang="ts">
export let className = 'size-3';
export let strokeWidth = '1.5';
</script>
<svg
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
stroke-width={strokeWidth}
stroke="currentColor"
class={className}
>
<path
stroke-linecap="round"
stroke-linejoin="round"
d="m3.75 13.5 10.5-11.25L12 10.5h8.25L9.75 21.75 12 13.5H3.75Z"
/>
</svg>

View file

@ -29,7 +29,7 @@
<nav id="nav" class=" sticky py-2.5 top-0 flex flex-row justify-center z-30"> <nav id="nav" class=" sticky py-2.5 top-0 flex flex-row justify-center z-30">
<div <div
class=" flex {$settings?.fullScreenMode ?? null ? 'max-w-full' : 'max-w-3xl'} class=" flex {$settings?.fullScreenMode ?? null ? 'max-w-full' : 'max-w-3xl'}
w-full mx-auto px-3" w-full mx-auto px-5"
> >
<div class="flex items-center w-full max-w-full"> <div class="flex items-center w-full max-w-full">
<div class="flex-1 overflow-hidden max-w-full"> <div class="flex-1 overflow-hidden max-w-full">