Skip to content

Commit 285050f

Browse files
committed
Only show creator name if it's defined
1 parent c89c620 commit 285050f

File tree

7 files changed

+33
-28
lines changed

7 files changed

+33
-28
lines changed

src/lib/components/chat/AssistantIntroduction.svelte

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,17 @@
4444
{assistant.description}
4545
</p>
4646

47-
<p class="pt-2 text-sm text-gray-400 dark:text-gray-500">
48-
Created by <a
49-
class="hover:underline"
50-
href="https://hf.co/{assistant.createdByName}"
51-
target="_blank"
52-
>
53-
{assistant.createdByName}
54-
</a>
55-
</p>
47+
{#if assistant.createdByName}
48+
<p class="pt-2 text-sm text-gray-400 dark:text-gray-500">
49+
Created by <a
50+
class="hover:underline"
51+
href="https://hf.co/{assistant.createdByName}"
52+
target="_blank"
53+
>
54+
{assistant.createdByName}
55+
</a>
56+
</p>
57+
{/if}
5658
</div>
5759
</div>
5860
<div class="absolute right-2 top-3 sm:top-2">

src/routes/assistant/[assistantId]/+page.svelte

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -66,16 +66,17 @@
6666
<h3 class="text-sm text-gray-700">
6767
{data.assistant.description}
6868
</h3>
69-
<p class="text-sm text-gray-500">
70-
Created by <a
71-
class="hover:underline"
72-
href="https://hf.co/{data.assistant.createdByName}"
73-
target="_blank"
74-
>
75-
{data.assistant.createdByName}
76-
</a>
77-
</p>
78-
69+
{#if data.assistant.createdByName}
70+
<p class="text-sm text-gray-500">
71+
Created by <a
72+
class="hover:underline"
73+
href="https://hf.co/{data.assistant.createdByName}"
74+
target="_blank"
75+
>
76+
{data.assistant.createdByName}
77+
</a>
78+
</p>
79+
{/if}
7980
<button
8081
class="mt-4 w-full rounded-full bg-gray-200 px-4 py-2 font-semibold text-gray-700"
8182
on:click={() => {

src/routes/assistant/[assistantId]/thumbnail.png/+server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export const GET: RequestHandler = (async ({ url, params, fetch }) => {
2323
href: url.origin,
2424
name: assistant.name,
2525
description: assistant.description,
26-
createdByName: assistant.createdByName ?? "",
26+
createdByName: assistant.createdByName,
2727
avatarUrl: assistant.avatar
2828
? url.origin + APP_BASE + "/settings/assistants/" + assistant._id + "/avatar"
2929
: undefined,

src/routes/assistant/[assistantId]/thumbnail.png/ChatThumbnail.svelte

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
export let href: string = "";
66
export let name: string;
77
export let description: string = "";
8-
export let createdByName = "";
8+
export let createdByName: string | undefined;
99
export let avatarUrl: string | undefined;
1010
1111
const imgUrl = `${href}${base}/${PUBLIC_APP_ASSETS}/icon.svg`;
@@ -30,10 +30,12 @@
3030
<span class="-mt-5 max-w-[65vw] text-3xl font-black">
3131
{name}
3232
</span>
33-
<h3 class="mt-2 font-medium text-gray-400">
34-
Created by
35-
<span class="ml-1 underline">{createdByName}</span>
36-
</h3>
33+
{#if createdByName}
34+
<h3 class="mt-2 font-medium text-gray-400">
35+
Created by
36+
<span class="ml-1 underline">{createdByName}</span>
37+
</h3>
38+
{/if}
3739
</div>
3840
</div>
3941
<h2 class="max-w-[90vw] items-center text-center font-medium text-gray-400">

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

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

7878
<p class="pb-2 text-sm text-gray-500">
7979
People with this link will be able to use your assistant.
80-
{#if !assistant?.createdByMe}
80+
{#if !assistant?.createdByMe && assistant?.createdByName}
8181
Created by <a
8282
class="underline"
8383
target="_blank"

src/routes/settings/assistants/[assistantId]/edit/+page.server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ export const actions: Actions = {
137137
},
138138
{
139139
createdById: assistant?.createdById,
140-
createdByName: locals.user?.username,
140+
createdByName: locals.user?.username ?? locals.user?.name,
141141
...parse.data,
142142
exampleInputs,
143143
avatar: hash ?? assistant.avatar,

src/routes/settings/assistants/new/+page.server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ export const actions: Actions = {
123123
const { insertedId } = await collections.assistants.insertOne({
124124
_id: newAssistantId,
125125
createdById,
126-
createdByName: locals.user?.username,
126+
createdByName: locals.user?.username ?? locals.user?.name,
127127
...parse.data,
128128
exampleInputs,
129129
avatar: hash,

0 commit comments

Comments
 (0)