victor HF staff commited on
Commit
8ffc49e
1 Parent(s): a4e40b1

/models tweaks (#864)

Browse files

* direct link to new chat

* mobile spacing

* show model logo on new chat

* temp: hide "new chat"

* exemples tweak

src/lib/components/MobileNav.svelte CHANGED
@@ -12,7 +12,7 @@
12
  export let isOpen = false;
13
  export let title: string | undefined;
14
 
15
- $: title = title || "New Chat";
16
 
17
  let closeEl: HTMLButtonElement;
18
  let openEl: HTMLButtonElement;
 
12
  export let isOpen = false;
13
  export let title: string | undefined;
14
 
15
+ $: title = title ?? "New Chat";
16
 
17
  let closeEl: HTMLButtonElement;
18
  let openEl: HTMLButtonElement;
src/lib/components/chat/ChatIntroduction.svelte CHANGED
@@ -59,7 +59,18 @@
59
  <div class="flex p-3">
60
  <div>
61
  <div class="text-sm text-gray-600 dark:text-gray-400">Current Model</div>
62
- <div class="font-semibold">{currentModel.displayName}</div>
 
 
 
 
 
 
 
 
 
 
 
63
  </div>
64
  <a
65
  href="{base}/settings/{currentModel.id}"
@@ -77,7 +88,7 @@
77
  {#each currentModelMetadata.promptExamples as example}
78
  <button
79
  type="button"
80
- class="rounded-xl border bg-gray-50 p-2.5 text-gray-600 hover:bg-gray-100 sm:p-4 dark:border-gray-800 dark:bg-gray-800 dark:text-gray-300 dark:hover:bg-gray-700"
81
  on:click={() => dispatch("message", example.prompt)}
82
  >
83
  {example.title}
 
59
  <div class="flex p-3">
60
  <div>
61
  <div class="text-sm text-gray-600 dark:text-gray-400">Current Model</div>
62
+ <div class="flex items-center gap-1.5 font-semibold max-sm:text-smd">
63
+ {#if currentModel.logoUrl}
64
+ <img
65
+ class=" overflown aspect-square size-4 rounded border dark:border-gray-700"
66
+ src={currentModel.logoUrl}
67
+ alt=""
68
+ />
69
+ {:else}
70
+ <div class="size-4 rounded border border-transparent bg-gray-300 dark:bg-gray-800" />
71
+ {/if}
72
+ {currentModel.displayName}
73
+ </div>
74
  </div>
75
  <a
76
  href="{base}/settings/{currentModel.id}"
 
88
  {#each currentModelMetadata.promptExamples as example}
89
  <button
90
  type="button"
91
+ class="rounded-xl border bg-gray-50 p-3 text-gray-600 hover:bg-gray-100 max-xl:text-sm xl:p-3.5 dark:border-gray-800 dark:bg-gray-800 dark:text-gray-300 dark:hover:bg-gray-700"
92
  on:click={() => dispatch("message", example.prompt)}
93
  >
94
  {example.title}
src/routes/+layout.svelte CHANGED
@@ -118,6 +118,10 @@
118
  }
119
  $settings.activeModel = $page.url.searchParams.get("model") ?? $settings.activeModel;
120
  }
 
 
 
 
121
  </script>
122
 
123
  <svelte:head>
@@ -173,11 +177,7 @@
173
  <div
174
  class="grid h-full w-screen grid-cols-1 grid-rows-[auto,1fr] overflow-hidden text-smd md:grid-cols-[280px,1fr] md:grid-rows-[1fr] dark:text-gray-300"
175
  >
176
- <MobileNav
177
- isOpen={isNavOpen}
178
- on:toggle={(ev) => (isNavOpen = ev.detail)}
179
- title={data.conversations.find((conv) => conv.id === $page.params.id)?.title}
180
- >
181
  <NavMenu
182
  conversations={data.conversations}
183
  user={data.user}
 
118
  }
119
  $settings.activeModel = $page.url.searchParams.get("model") ?? $settings.activeModel;
120
  }
121
+
122
+ $: mobileNavTitle = ["/models", "/assistants", "/privacy"].includes($page.route.id ?? "")
123
+ ? ""
124
+ : data.conversations.find((conv) => conv.id === $page.params.id)?.title;
125
  </script>
126
 
127
  <svelte:head>
 
177
  <div
178
  class="grid h-full w-screen grid-cols-1 grid-rows-[auto,1fr] overflow-hidden text-smd md:grid-cols-[280px,1fr] md:grid-rows-[1fr] dark:text-gray-300"
179
  >
180
+ <MobileNav isOpen={isNavOpen} on:toggle={(ev) => (isNavOpen = ev.detail)} title={mobileNavTitle}>
 
 
 
 
181
  <NavMenu
182
  conversations={data.conversations}
183
  user={data.user}
src/routes/assistants/+page.svelte CHANGED
@@ -50,7 +50,7 @@
50
  {/if}
51
  </svelte:head>
52
 
53
- <div class="scrollbar-custom mr-1 h-full overflow-y-auto py-12 md:py-24">
54
  <div class="pt-42 mx-auto flex flex-col px-5 xl:w-[60rem] 2xl:w-[64rem]">
55
  <div class="flex items-center">
56
  <h1 class="text-2xl font-bold">Assistants</h1>
 
50
  {/if}
51
  </svelte:head>
52
 
53
+ <div class="scrollbar-custom mr-1 h-full overflow-y-auto py-12 max-sm:pt-8 md:py-24">
54
  <div class="pt-42 mx-auto flex flex-col px-5 xl:w-[60rem] 2xl:w-[64rem]">
55
  <div class="flex items-center">
56
  <h1 class="text-2xl font-bold">Assistants</h1>
src/routes/models/+page.svelte CHANGED
@@ -22,7 +22,7 @@
22
  {/if}
23
  </svelte:head>
24
 
25
- <div class="scrollbar-custom mr-1 h-full overflow-y-auto py-12 md:py-24">
26
  <div class="pt-42 mx-auto flex flex-col px-5 xl:w-[60rem] 2xl:w-[64rem]">
27
  <div class="flex items-center">
28
  <h1 class="text-2xl font-bold">Models</h1>
@@ -40,7 +40,7 @@
40
  <dl class="mt-8 grid grid-cols-1 gap-3 sm:gap-5 xl:grid-cols-2">
41
  {#each data.models.filter((el) => !el.unlisted) as model, index (model.id)}
42
  <a
43
- href="{base}/settings/{model.id}"
44
  class="relative flex flex-col gap-2 overflow-hidden rounded-xl border bg-gray-50/50 px-6 py-5 shadow hover:bg-gray-50 hover:shadow-inner dark:border-gray-800/70 dark:bg-gray-950/20 dark:hover:bg-gray-950/40"
45
  >
46
  <div class="flex items-center justify-between">
 
22
  {/if}
23
  </svelte:head>
24
 
25
+ <div class="scrollbar-custom mr-1 h-full overflow-y-auto py-12 max-sm:pt-8 md:py-24">
26
  <div class="pt-42 mx-auto flex flex-col px-5 xl:w-[60rem] 2xl:w-[64rem]">
27
  <div class="flex items-center">
28
  <h1 class="text-2xl font-bold">Models</h1>
 
40
  <dl class="mt-8 grid grid-cols-1 gap-3 sm:gap-5 xl:grid-cols-2">
41
  {#each data.models.filter((el) => !el.unlisted) as model, index (model.id)}
42
  <a
43
+ href="{base}/?model={model.id}"
44
  class="relative flex flex-col gap-2 overflow-hidden rounded-xl border bg-gray-50/50 px-6 py-5 shadow hover:bg-gray-50 hover:shadow-inner dark:border-gray-800/70 dark:bg-gray-950/20 dark:hover:bg-gray-950/40"
45
  >
46
  <div class="flex items-center justify-between">