Ngva coyotte508 HF staff commited on
Commit
3dbdd6a
1 Parent(s): 64d3841

Announcement banners Configurable with .env vars (#222)

Browse files
.env CHANGED
@@ -49,6 +49,13 @@ OLD_MODELS=`[]`# any removed models, `{ name: string, displayName?: string, id?:
49
  PUBLIC_ORIGIN=#https://hf.co
50
  PUBLIC_GOOGLE_ANALYTICS_ID=#G-XXXXXXXX / Leave empty to disable
51
  PUBLIC_DEPRECATED_GOOGLE_ANALYTICS_ID=#UA-XXXXXXXX-X / Leave empty to disable
 
 
 
 
 
 
 
52
 
53
  PARQUET_EXPORT_DATASET=
54
  PARQUET_EXPORT_HF_TOKEN=
 
49
  PUBLIC_ORIGIN=#https://hf.co
50
  PUBLIC_GOOGLE_ANALYTICS_ID=#G-XXXXXXXX / Leave empty to disable
51
  PUBLIC_DEPRECATED_GOOGLE_ANALYTICS_ID=#UA-XXXXXXXX-X / Leave empty to disable
52
+ PUBLIC_ANNOUNCEMENT_BANNERS=`[
53
+ {
54
+ "title": "Chat UI is now open sourced on GitHub",
55
+ "linkTitle": "GitHub repo",
56
+ "linkHref": "https://github.com/huggingface/chat-ui"
57
+ }
58
+ ]`
59
 
60
  PARQUET_EXPORT_DATASET=
61
  PARQUET_EXPORT_HF_TOKEN=
src/lib/components/chat/ChatIntroduction.svelte CHANGED
@@ -1,5 +1,6 @@
1
  <script lang="ts">
2
  import { PUBLIC_VERSION } from "$env/static/public";
 
3
  import Logo from "$lib/components/icons/Logo.svelte";
4
  import { createEventDispatcher } from "svelte";
5
  import IconChevron from "$lib/components/icons/IconChevron.svelte";
@@ -19,6 +20,10 @@
19
 
20
  $: currentModelMetadata = findCurrentModel(models, settings.activeModel);
21
 
 
 
 
 
22
  const dispatch = createEventDispatcher<{ message: string }>();
23
  </script>
24
 
@@ -40,14 +45,17 @@
40
  </div>
41
  </div>
42
  <div class="lg:col-span-2 lg:pl-24">
43
- <AnnouncementBanner classNames="mb-4" title="Chat UI is now open sourced on GitHub">
44
- <a
45
- target="_blank"
46
- href="https://github.com/huggingface/chat-ui"
47
- class="mr-2 flex items-center underline hover:no-underline"
48
- ><CarbonArrowUpRight class="mr-1" /> GitHub repo</a
49
- >
50
- </AnnouncementBanner>
 
 
 
51
  {#if isModelsModalOpen}
52
  <ModelsModal {settings} {models} on:close={() => (isModelsModalOpen = false)} />
53
  {/if}
 
1
  <script lang="ts">
2
  import { PUBLIC_VERSION } from "$env/static/public";
3
+ import { PUBLIC_ANNOUNCEMENT_BANNERS } from "$env/static/public";
4
  import Logo from "$lib/components/icons/Logo.svelte";
5
  import { createEventDispatcher } from "svelte";
6
  import IconChevron from "$lib/components/icons/IconChevron.svelte";
 
20
 
21
  $: currentModelMetadata = findCurrentModel(models, settings.activeModel);
22
 
23
+ const announcementBanners = PUBLIC_ANNOUNCEMENT_BANNERS
24
+ ? JSON.parse(PUBLIC_ANNOUNCEMENT_BANNERS)
25
+ : [];
26
+
27
  const dispatch = createEventDispatcher<{ message: string }>();
28
  </script>
29
 
 
45
  </div>
46
  </div>
47
  <div class="lg:col-span-2 lg:pl-24">
48
+ {#each announcementBanners as banner}
49
+ <AnnouncementBanner classNames="mb-4" title={banner.title}>
50
+ <a
51
+ target="_blank"
52
+ href={banner.linkHref}
53
+ class="mr-2 flex items-center underline hover:no-underline"
54
+ ><CarbonArrowUpRight class="mr-1" /> {banner.linkTitle}</a
55
+ >
56
+ </AnnouncementBanner>
57
+ {/each}
58
+
59
  {#if isModelsModalOpen}
60
  <ModelsModal {settings} {models} on:close={() => (isModelsModalOpen = false)} />
61
  {/if}