Skip to content

Commit dce7b38

Browse files
committed
add github repo link in account settings & type fixes
1 parent ae91cef commit dce7b38

5 files changed

Lines changed: 22 additions & 72 deletions

File tree

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"css.lint.unknownAtRules": "ignore"
3+
}

src/lib/components/model-picker/model-picker.svelte

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -598,10 +598,14 @@
598598
</button>
599599

600600
{#if open}
601+
<!-- svelte-ignore a11y_no_static_element_interactions -->
601602
<div
602603
class="fixed inset-0 z-50 bg-black/80 backdrop-blur-sm"
604+
role="button"
605+
tabindex="-1"
603606
transition:fade={{ duration: 150 }}
604607
onclick={() => (open = false)}
608+
onkeydown={(e) => e.key === 'Escape' && (open = false)}
605609
></div>
606610
<div
607611
class="bg-background fixed inset-x-0 bottom-0 z-50 h-[85vh] touch-none rounded-t-xl border-t shadow-xl"

src/routes/account/+layout.svelte

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import Button from '$lib/components/ui/button/button.svelte';
66
import { LightSwitch } from '$lib/components/ui/light-switch';
77
import ArrowLeftIcon from '~icons/lucide/arrow-left';
8+
import GithubIcon from '~icons/lucide/github';
89
import { Avatar } from 'melt/components';
910
import { Kbd } from '$lib/components/ui/kbd/index.js';
1011
import { formatKeybind } from '$lib/hooks/is-mac.svelte.js';
@@ -141,6 +142,15 @@
141142
{/each}
142143
</div>
143144
</div>
145+
<a
146+
href="https://github.com/nanogpt-community/nanochat"
147+
target="_blank"
148+
rel="noopener noreferrer"
149+
class="text-muted-foreground hover:text-foreground mt-6 flex items-center gap-2 text-sm transition-colors"
150+
>
151+
<GithubIcon class="size-4" />
152+
<span>View on GitHub</span>
153+
</a>
144154
</div>
145155
</div>
146156
<div class="md:col-start-2 md:pl-12">

src/routes/chat/+layout.svelte

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -847,18 +847,8 @@
847847
conversationId={page.params.id}
848848
messages={messages.data}
849849
conversation={currentConversationQuery.data}
850-
variant="ghost"
851-
class="w-full justify-start px-2"
852-
>
853-
<span class="ml-2">Export Chat</span>
854-
</ExportButton>
855-
<ShareButton
856-
conversationId={page.params.id as Id<'conversations'>}
857-
variant="ghost"
858-
class="w-full justify-start px-2"
859-
>
860-
<span class="ml-2">Share Chat</span>
861-
</ShareButton>
850+
/>
851+
<ShareButton conversationId={page.params.id as Id<'conversations'>} />
862852
</div>
863853
<DropdownMenu.Separator />
864854
{/if}

src/routes/chat/[id]/message.svelte

Lines changed: 3 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import ChevronDownIcon from '~icons/lucide/chevron-down';
2626
import RefreshCwIcon from '~icons/lucide/refresh-cw';
2727
import PencilIcon from '~icons/lucide/pencil';
28-
import StarIcon from '~icons/lucide/star';
2928
import * as DropdownMenu from '$lib/components/ui/dropdown-menu';
3029
import { AnnotationSchema, type Annotation } from '$lib/types';
3130
import ExternalLinkIcon from '~icons/lucide/external-link';
@@ -187,11 +186,6 @@
187186
188187
let isEditing = $state(false);
189188
let editedContent = $state('');
190-
let isStarred = $state<boolean>(false);
191-
192-
$effect(() => {
193-
isStarred = message.starred ?? false;
194-
});
195189
196190
function startEditing() {
197191
editedContent = message.content;
@@ -280,37 +274,6 @@
280274
}
281275
}
282276
}
283-
284-
async function toggleStarred() {
285-
if (!session.current?.session.token) return;
286-
if (message.role !== 'assistant') return;
287-
288-
const previous = isStarred;
289-
isStarred = !isStarred;
290-
291-
try {
292-
const res = await fetch(api.messages.setStarred.url, {
293-
method: 'POST',
294-
headers: { 'Content-Type': 'application/json' },
295-
body: JSON.stringify({
296-
action: 'setStarred',
297-
messageId: message.id,
298-
starred: isStarred,
299-
}),
300-
});
301-
302-
if (!res.ok) {
303-
console.error('Failed to update starred state');
304-
isStarred = previous;
305-
return;
306-
}
307-
308-
invalidateQueryPattern(api.messages.getAllFromConversation.url);
309-
} catch (e) {
310-
console.error('Error updating starred state:', e);
311-
isStarred = previous;
312-
}
313-
}
314277
</script>
315278

316279
{#if message.role !== 'system' && !(message.role === 'assistant' && message.content.length === 0 && message.reasoning?.length === 0 && !message.error)}
@@ -518,27 +481,7 @@
518481
{/snippet}
519482
{message.role === 'user' ? 'Branch and regenerate message' : 'Branch off this message'}
520483
</Tooltip>
521-
{#if message.role === 'assistant' && message.content.length > 0 && !message.error}
522-
<Tooltip>
523-
{#snippet trigger(tooltip)}
524-
<Button
525-
size="icon"
526-
variant="ghost"
527-
class="order-1 size-7"
528-
onclick={toggleStarred}
529-
{...tooltip.trigger}
530-
>
531-
<StarIcon
532-
class={cn('size-4', {
533-
'fill-yellow-400 text-yellow-400': isStarred,
534-
'text-muted-foreground/60': !isStarred,
535-
})}
536-
/>
537-
</Button>
538-
{/snippet}
539-
{isStarred ? 'Unstar message' : 'Star message'}
540-
</Tooltip>
541-
{/if}
484+
542485
{#if message.content.length > 0}
543486
<Tooltip>
544487
{#snippet trigger(tooltip)}
@@ -576,7 +519,7 @@
576519
{#if message.role === 'assistant'}
577520
<!-- Desktop: Show all metadata inline -->
578521
<div class="hidden items-center gap-2 md:flex">
579-
{#if message.modelId !== undefined}
522+
{#if message.modelId}
580523
{@const modelName = message.modelId.split('/').pop() || message.modelId}
581524
<span class="text-muted-foreground text-xs">{modelName}</span>
582525
{/if}
@@ -625,7 +568,7 @@
625568
</div>
626569
<!-- Mobile: Compact metadata in a single info chip -->
627570
<div class="flex items-center gap-1.5 md:hidden">
628-
{#if message.modelId !== undefined}
571+
{#if message.modelId}
629572
{@const modelName = message.modelId.split('/').pop() || message.modelId}
630573
<span class="text-muted-foreground max-w-[100px] truncate text-xs">{modelName}</span>
631574
{/if}

0 commit comments

Comments
 (0)