Skip to content

Commit 8fe2aef

Browse files
gary149nsarrazin
andauthored
Assistants: UI tweaks for release (#764)
* increase settings visibility * hideemojis = hide assistants avatars * mobile * text balance * Revert "hideemojis = hide assistants avatars" This reverts commit 6ec0d68. * always show assistant avatar * mobile scroll to assistants * rm comment * full width start message * /assistants thumbnail * model selector * width * font-size * lint * min width on desktop too --------- Co-authored-by: Nathan Sarrazin <sarrazin.nathan@gmail.com>
1 parent 15ecf06 commit 8fe2aef

File tree

10 files changed

+61
-36
lines changed

10 files changed

+61
-36
lines changed

src/lib/components/AssistantSettings.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@
211211
</label>
212212

213213
<label>
214-
<span class="mb-1 text-sm font-semibold">Start messages</span>
214+
<span class="mb-1 text-sm font-semibold">User start messages</span>
215215
<div class="flex flex-col gap-2 md:max-h-32">
216216
<input
217217
name="exampleInput1"

src/lib/components/NavConversationItem.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
{#if confirmDelete}
3838
<span class="mr-1 font-semibold"> Delete </span>
3939
{/if}
40-
{#if conv.avatarHash && !$settings.hideEmojiOnSidebar}
40+
{#if conv.avatarHash}
4141
<img
4242
src="{base}/settings/assistants/{conv.assistantId}/avatar?hash={conv.avatarHash}"
4343
alt="Assistant avatar"

src/lib/components/chat/AssistantIntroduction.svelte

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
<div
1717
class="relative mt-auto rounded-2xl bg-gray-100 text-gray-600 dark:border-gray-800 dark:bg-gray-800/60 dark:text-gray-300"
1818
>
19-
<div class="flex items-center gap-4 p-4 pr-10 md:p-8 md:pt-10 xl:gap-8">
19+
<div
20+
class="flex min-w-[80dvw] items-center gap-4 p-4 pr-1 sm:min-w-[440px] md:p-8 md:pt-10 xl:gap-8"
21+
>
2022
{#if assistant.avatar}
2123
<img
2224
src={`${base}/settings/assistants/${assistant._id.toString()}/avatar?hash=${
@@ -33,14 +35,11 @@
3335
</div>
3436
{/if}
3537

36-
<div class="flex h-full flex-col gap-2">
37-
<p
38-
class="w-fit truncate text-ellipsis rounded-full border bg-white px-3 py-1 text-xs text-gray-800 dark:border-gray-700 dark:bg-gray-700 dark:text-gray-400"
39-
>
40-
Assistant
41-
</p>
38+
<div class="flex h-full flex-col gap-2 text-balance">
39+
<p class="-mb-1">Assistant</p>
40+
4241
<p class="text-xl font-bold sm:text-2xl">{assistant.name}</p>
43-
<p class="line-clamp-6 text-balance text-sm text-gray-500 dark:text-gray-400">
42+
<p class="line-clamp-6 text-sm text-gray-500 dark:text-gray-400">
4443
{assistant.description}
4544
</p>
4645

@@ -60,15 +59,19 @@
6059
<div class="absolute right-3 top-3 md:right-4 md:top-4">
6160
<a
6261
href="{base}/settings/assistants/{assistant._id.toString()}"
63-
class="flex size-7 items-center justify-center rounded-full border bg-gray-200 p-1 text-xs hover:bg-gray-100 dark:border-gray-700 dark:bg-gray-700 dark:hover:bg-gray-600"
64-
><IconGear /></a
62+
class="flex items-center gap-1.5 rounded-full border bg-white py-1 pl-3 pr-2.5 text-xs text-gray-800 shadow-sm hover:shadow-inner md:text-sm dark:border-gray-700 dark:bg-gray-700 dark:text-gray-300/90 dark:hover:bg-gray-800"
63+
><IconGear class="text-xxs" />Settings</a
6564
>
6665
</div>
6766
</div>
6867
{#if assistant.exampleInputs}
6968
<div class="mx-auto mt-auto w-full gap-8 sm:-mb-8">
7069
<div class="md:col-span-2 md:mt-6">
71-
<div class="grid grid-cols-1 gap-3 md:grid-cols-2">
70+
<div
71+
class="grid grid-cols-1 gap-3 {assistant.exampleInputs.length > 1
72+
? 'md:grid-cols-2'
73+
: ''}"
74+
>
7275
{#each assistant.exampleInputs as example}
7376
<button
7477
type="button"

src/lib/components/chat/ChatWindow.svelte

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import CarbonStopFilledAlt from "~icons/carbon/stop-filled-alt";
88
import CarbonClose from "~icons/carbon/close";
99
import CarbonCheckmark from "~icons/carbon/checkmark";
10+
import CarbonCaretDown from "~icons/carbon/caret-down";
1011
1112
import EosIconsLoading from "~icons/eos-icons/loading";
1213
@@ -256,8 +257,10 @@
256257
>{currentModel.displayName}</a
257258
>{:else}
258259
{@const model = models.find((m) => m.id === assistant?.modelId)}
259-
<a href="{base}/settings/assistants/{assistant._id}" class="hover:underline"
260-
>{model?.displayName}</a
260+
<a
261+
href="{base}/settings/assistants/{assistant._id}"
262+
class="inline-flex items-center border-b hover:text-gray-600 dark:border-gray-700 dark:hover:text-gray-300"
263+
>{model?.displayName}<CarbonCaretDown class="text-xxs" /></a
261264
>{/if} <span class="max-sm:hidden">·</span><br class="sm:hidden" /> Generated content may
262265
be inaccurate or false.
263266
</p>

src/routes/+layout.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@
124124

125125
<!-- use those meta tags everywhere except on the share assistant page -->
126126
<!-- feel free to refacto if there's a better way -->
127-
{#if !$page.url.pathname.includes("/assistant/")}
127+
{#if !$page.url.pathname.includes("/assistant/") && $page.route.id !== "/assistants"}
128128
<meta property="og:title" content={PUBLIC_APP_NAME} />
129129
<meta property="og:type" content="website" />
130130
<meta property="og:url" content="{PUBLIC_ORIGIN || $page.url.origin}{base}" />

src/routes/assistants/+page.svelte

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<script lang="ts">
22
import type { PageData } from "./$types";
33
4+
import { PUBLIC_APP_ASSETS, PUBLIC_ORIGIN } from "$env/static/public";
5+
import { isHuggingChat } from "$lib/utils/isHuggingChat";
6+
47
import { goto } from "$app/navigation";
58
import { base } from "$app/paths";
69
import { page } from "$app/stores";
@@ -22,6 +25,24 @@
2225
};
2326
</script>
2427

28+
<svelte:head>
29+
{#if isHuggingChat}
30+
<title>HuggingChat - Assistants</title>
31+
<meta property="og:title" content="HuggingChat - Assistants" />
32+
<meta property="og:type" content="link" />
33+
<meta
34+
property="og:description"
35+
content="Browse HuggingChat assistants made by the community."
36+
/>
37+
<meta
38+
property="og:image"
39+
content="{PUBLIC_ORIGIN ||
40+
$page.url.origin}{base}/{PUBLIC_APP_ASSETS}/assistants-thumbnail.png"
41+
/>
42+
<meta property="og:url" content={$page.url.href} />
43+
{/if}
44+
</svelte:head>
45+
2546
<div class="scrollbar-custom mr-1 h-full overflow-y-auto py-12 md:py-24">
2647
<div class="pt-42 mx-auto flex flex-col px-5 xl:w-[60rem] 2xl:w-[64rem]">
2748
<div class="flex items-center">
@@ -33,7 +54,7 @@
3354
<h3 class="text-gray-500">Browse popular assistants made by the community</h3>
3455
<div class="mt-6 flex justify-between gap-2 max-sm:flex-col sm:items-center">
3556
<select
36-
class="mt-1 rounded-lg border border-gray-300 bg-gray-50 p-2 text-xs text-gray-900 focus:border-blue-700 focus:ring-blue-700 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:placeholder-gray-400"
57+
class="mt-1 h-[34px] rounded-lg border border-gray-300 bg-gray-50 px-2 text-sm text-gray-900 focus:border-blue-700 focus:ring-blue-700 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:placeholder-gray-400"
3758
bind:value={selectedModel}
3859
on:change={onModelChange}
3960
>
@@ -45,16 +66,16 @@
4566

4667
<a
4768
href={`${base}/settings/assistants/new`}
48-
class="flex items-center gap-1 whitespace-nowrap rounded-lg border bg-white py-1 pl-1.5 pr-2.5 text-center shadow-sm hover:bg-gray-50 hover:shadow-none dark:border-gray-600 dark:bg-gray-700 dark:hover:bg-gray-700"
69+
class="flex items-center gap-1 whitespace-nowrap rounded-lg border bg-white py-1 pl-1.5 pr-2.5 shadow-sm hover:bg-gray-50 hover:shadow-none dark:border-gray-600 dark:bg-gray-700 dark:hover:bg-gray-700"
4970
>
5071
<CarbonAdd />Create New assistant
5172
</a>
5273
</div>
53-
<div class="mt-10 grid grid-cols-2 gap-4 sm:gap-5 md:grid-cols-3 lg:grid-cols-4">
74+
<div class="mt-10 grid grid-cols-2 gap-3 sm:gap-5 md:grid-cols-3 lg:grid-cols-4">
5475
{#each data.assistants as assistant}
5576
<a
5677
href="{base}/assistant/{assistant._id}"
57-
class="flex flex-col items-center justify-center overflow-hidden rounded-xl border bg-gray-50/50 px-4 py-6 text-center shadow hover:bg-gray-50 hover:shadow-inner max-sm:px-4 sm:h-64 sm:pb-4 dark:border-gray-800/70 dark:bg-gray-950/20 dark:hover:bg-gray-950/40"
78+
class="flex flex-col items-center justify-center overflow-hidden text-balance rounded-xl border bg-gray-50/50 px-4 py-6 text-center shadow hover:bg-gray-50 hover:shadow-inner max-sm:px-4 sm:h-64 sm:pb-4 dark:border-gray-800/70 dark:bg-gray-950/20 dark:hover:bg-gray-950/40"
5879
>
5980
{#if assistant.avatar}
6081
<img
@@ -74,13 +95,11 @@
7495
>
7596
{assistant.name}
7697
</h3>
77-
<p
78-
class="line-clamp-4 text-balance text-xxs text-gray-700 sm:line-clamp-2 sm:text-xs dark:text-gray-400"
79-
>
98+
<p class="line-clamp-4 text-xs text-gray-700 sm:line-clamp-2 dark:text-gray-400">
8099
{assistant.description}
81100
</p>
82101
{#if assistant.createdByName}
83-
<p class="mt-auto pt-2 text-xxs text-gray-400 sm:text-xs dark:text-gray-500">
102+
<p class="mt-auto pt-2 text-xs text-gray-400 dark:text-gray-500">
84103
Created by <a
85104
class="hover:underline"
86105
href="https://hf.co/{assistant.createdByName}"

src/routes/settings/+layout.svelte

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<script lang="ts">
2+
import { onMount } from "svelte";
23
import { base } from "$app/paths";
34
import { clickOutside } from "$lib/actions/clickOutside";
45
import { afterNavigate, goto } from "$app/navigation";
@@ -15,6 +16,13 @@
1516
export let data;
1617
1718
let previousPage: string = base;
19+
let assistantsSection: HTMLHeadingElement;
20+
21+
onMount(() => {
22+
if ($page.params?.assistantId) {
23+
assistantsSection.scrollIntoView();
24+
}
25+
});
1826
1927
afterNavigate(({ from }) => {
2028
if (!from?.url.pathname.includes("settings")) {
@@ -71,7 +79,9 @@
7179
{/each}
7280
<!-- if its huggingchat, the number of assistants owned by the user must be non-zero to show the UI -->
7381
{#if data.enableAssistants && (!isHuggingChat || data.assistants.length >= 1)}
74-
<h3 class="pb-3 pl-3 pt-5 text-[.8rem] text-gray-800 sm:pl-1">Assistants</h3>
82+
<h3 bind:this={assistantsSection} class="pb-3 pl-3 pt-5 text-[.8rem] text-gray-800 sm:pl-1">
83+
Assistants
84+
</h3>
7585

7686
{#if !data.loginEnabled || (data.loginEnabled && !!data.user)}
7787
<a

src/routes/settings/+page.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
target="_blank"
5757
rel="noreferrer"
5858
class="flex items-center underline decoration-gray-300 underline-offset-2 hover:decoration-gray-700"
59-
><CarbonArrowUpRight class="mr-1.5 shrink-0 text-xs " /> Give your feedback on HuggingChat</a
59+
><CarbonArrowUpRight class="mr-1.5 shrink-0 text-sm " /> Share your feedback on HuggingChat</a
6060
>
6161
<button
6262
on:click|preventDefault={() => (isConfirmingDeletion = true)}

src/routes/settings/assistants/[assistantId]/+page.svelte

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -137,16 +137,6 @@
137137
</div>
138138
</div>
139139

140-
<!-- <div>
141-
<h2 class="mb-2 text-lg font-semibold">Model used</h2>
142-
143-
<div
144-
class="flex flex-row gap-2 rounded-lg border-2 border-gray-200 bg-gray-100 py-2 pl-3 pr-1.5"
145-
>
146-
<input disabled class="flex-1" value="Model" />
147-
</div>
148-
</div> -->
149-
150140
<h2 class="mt-4 text-lg font-semibold">System Instructions</h2>
151141

152142
<textarea
206 KB
Loading

0 commit comments

Comments
 (0)