victor HF Staff commited on
Commit
1a77343
·
1 Parent(s): 58df0c8

Remove dynamic primary color theme support

Browse files

Eliminates the PUBLIC_APP_COLOR environment variable and related dynamic theming for primary colors. Updates UI components to use static gray color classes instead of primary color classes. Removes OverloadedModal component and its usage, and updates routerExamples with new and improved prompts.

.github/workflows/deploy-prod.yml CHANGED
@@ -47,7 +47,6 @@ jobs:
47
  build-args: |
48
  INCLUDE_DB=false
49
  APP_BASE=/chat
50
- PUBLIC_APP_COLOR=yellow
51
  PUBLIC_COMMIT_SHA=${{ env.GITHUB_SHA_SHORT }}
52
  deploy:
53
  name: Deploy on prod
 
47
  build-args: |
48
  INCLUDE_DB=false
49
  APP_BASE=/chat
 
50
  PUBLIC_COMMIT_SHA=${{ env.GITHUB_SHA_SHORT }}
51
  deploy:
52
  name: Deploy on prod
Dockerfile CHANGED
@@ -43,7 +43,7 @@ WORKDIR /app
43
  COPY --link --chown=1000 package-lock.json package.json ./
44
 
45
  ARG APP_BASE=
46
- ARG PUBLIC_APP_COLOR=blue
47
  ENV BODY_SIZE_LIMIT=15728640
48
 
49
  RUN --mount=type=cache,target=/app/.npm \
@@ -81,8 +81,7 @@ ENV INCLUDE_DB=${INCLUDE_DB}
81
 
82
  # svelte requires APP_BASE at build time so it must be passed as a build arg
83
  ARG APP_BASE=
84
- # tailwind requires the primary theme to be known at build time so it must be passed as a build arg
85
- ARG PUBLIC_APP_COLOR=blue
86
  ARG PUBLIC_COMMIT_SHA=
87
  ENV PUBLIC_COMMIT_SHA=${PUBLIC_COMMIT_SHA}
88
  ENV BODY_SIZE_LIMIT=15728640
 
43
  COPY --link --chown=1000 package-lock.json package.json ./
44
 
45
  ARG APP_BASE=
46
+ ARG PUBLIC_APP_COLOR=
47
  ENV BODY_SIZE_LIMIT=15728640
48
 
49
  RUN --mount=type=cache,target=/app/.npm \
 
81
 
82
  # svelte requires APP_BASE at build time so it must be passed as a build arg
83
  ARG APP_BASE=
84
+ ARG PUBLIC_APP_COLOR=
 
85
  ARG PUBLIC_COMMIT_SHA=
86
  ENV PUBLIC_COMMIT_SHA=${PUBLIC_COMMIT_SHA}
87
  ENV BODY_SIZE_LIMIT=15728640
README.md CHANGED
@@ -113,14 +113,12 @@ You can use a few environment variables to customize the look and feel of chat-u
113
  ```env
114
  PUBLIC_APP_NAME=ChatUI
115
  PUBLIC_APP_ASSETS=chatui
116
- PUBLIC_APP_COLOR=blue
117
  PUBLIC_APP_DESCRIPTION="Making the community's best AI chat models available to everyone."
118
  PUBLIC_APP_DATA_SHARING=
119
  ```
120
 
121
  - `PUBLIC_APP_NAME` The name used as a title throughout the app.
122
  - `PUBLIC_APP_ASSETS` Is used to find logos & favicons in `static/$PUBLIC_APP_ASSETS`, current options are `chatui` and `huggingchat`.
123
- - `PUBLIC_APP_COLOR` Can be any of the [tailwind colors](https://tailwindcss.com/docs/customizing-colors#default-color-palette).
124
  - `PUBLIC_APP_DATA_SHARING` Can be set to 1 to add a toggle in the user settings that lets your users opt-in to data sharing with models creator.
125
 
126
  ### Models
 
113
  ```env
114
  PUBLIC_APP_NAME=ChatUI
115
  PUBLIC_APP_ASSETS=chatui
 
116
  PUBLIC_APP_DESCRIPTION="Making the community's best AI chat models available to everyone."
117
  PUBLIC_APP_DATA_SHARING=
118
  ```
119
 
120
  - `PUBLIC_APP_NAME` The name used as a title throughout the app.
121
  - `PUBLIC_APP_ASSETS` Is used to find logos & favicons in `static/$PUBLIC_APP_ASSETS`, current options are `chatui` and `huggingchat`.
 
122
  - `PUBLIC_APP_DATA_SHARING` Can be set to 1 to add a toggle in the user settings that lets your users opt-in to data sharing with models creator.
123
 
124
  ### Models
src/lib/components/AnnouncementBanner.svelte CHANGED
@@ -10,7 +10,7 @@
10
 
11
  <div class="flex items-center rounded-xl bg-gray-100 p-1 text-sm dark:bg-gray-800 {classNames}">
12
  <span
13
- class="from-primary-300 text-primary-700 dark:from-primary-900 dark:text-primary-400 mr-2 inline-flex items-center rounded-lg bg-gradient-to-br px-2 py-1 text-xxs font-medium uppercase leading-3"
14
  >New</span
15
  >
16
  {title}
 
10
 
11
  <div class="flex items-center rounded-xl bg-gray-100 p-1 text-sm dark:bg-gray-800 {classNames}">
12
  <span
13
+ class="mr-2 inline-flex items-center rounded-lg bg-gradient-to-br from-gray-300 px-2 py-1 text-xxs font-medium uppercase leading-3 text-gray-700 dark:from-gray-900 dark:text-gray-400"
14
  >New</span
15
  >
16
  {title}
src/lib/components/LoginModal.svelte CHANGED
@@ -19,7 +19,7 @@
19
 
20
  <Modal onclose={() => onclose?.()} width="!max-w-[400px] !m-4">
21
  <div
22
- class="from-primary-500/40 via-primary-500/10 to-primary-500/0 flex w-full flex-col items-center gap-6 bg-gradient-to-b px-5 pb-8 pt-9 text-center"
23
  >
24
  <h2 class="flex items-center text-2xl font-semibold text-gray-800">
25
  <Logo classNames="mr-1" />
 
19
 
20
  <Modal onclose={() => onclose?.()} width="!max-w-[400px] !m-4">
21
  <div
22
+ class="flex w-full flex-col items-center gap-6 bg-gradient-to-b from-gray-500/40 via-gray-500/10 to-gray-500/0 px-5 pb-8 pt-9 text-center"
23
  >
24
  <h2 class="flex items-center text-2xl font-semibold text-gray-800">
25
  <Logo classNames="mr-1" />
src/lib/components/OverloadedModal.svelte DELETED
@@ -1,42 +0,0 @@
1
- <script lang="ts">
2
- import { goto } from "$app/navigation";
3
- import { base } from "$app/paths";
4
- import { page } from "$app/state";
5
- import IconDazzled from "./icons/IconDazzled.svelte";
6
- import Modal from "./Modal.svelte";
7
-
8
- let { onClose }: { onClose: () => void } = $props();
9
- </script>
10
-
11
- <Modal onclose={onClose} width="!max-w-[400px] !m-4">
12
- <div
13
- class="from-primary-500/40 via-primary-500/10 to-primary-500/0 flex w-full flex-col items-center gap-3 bg-gradient-to-b px-5 pb-4 pt-9 text-center sm:px-6"
14
- >
15
- <div class="flex flex-wrap items-center gap-2">
16
- <IconDazzled classNames="text-3xl mx-auto" />
17
- <h2 class="flex flex-wrap items-center text-lg font-semibold text-gray-800">
18
- This model is currently overloaded.
19
- </h2>
20
- </div>
21
-
22
- <p class="text-sm text-gray-500">
23
- Please try again later or consider using a different model. We currently have {page.data
24
- .models.length} models available.
25
- </p>
26
-
27
- <div class="flex w-full flex-col items-center gap-4 pt-4">
28
- <button
29
- onclick={() => (onClose(), goto(`${base}/models`))}
30
- class="flex w-full flex-wrap items-center justify-center whitespace-nowrap rounded-full border-2 border-black bg-black px-5 py-2 text-lg font-semibold text-gray-100 transition-colors hover:bg-gray-900"
31
- >
32
- See all available models
33
- </button>
34
- <button
35
- onclick={onClose}
36
- class="flex w-fit flex-wrap items-center justify-center whitespace-nowrap px-2 py-1 text-gray-600 transition-colors hover:text-gray-900"
37
- >
38
- Close
39
- </button>
40
- </div>
41
- </div>
42
- </Modal>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
src/lib/constants/routerExamples.ts CHANGED
@@ -28,11 +28,15 @@ export const routerExamples: RouterExample[] = [
28
  prompt:
29
  "Add a power-up mechanic to the Pong game so paddles temporarily grow when a player scores twice in a row.",
30
  },
31
-
32
  {
33
  title: "CRT Screen",
34
  prompt: "Add a CRT screen effect to the game",
35
  },
 
 
 
 
 
36
  ],
37
  },
38
  {
@@ -61,7 +65,13 @@ export const routerExamples: RouterExample[] = [
61
  },
62
  {
63
  title: "Translate to Italian",
64
- prompt: "Translate the visible content of the page into italian",
 
 
 
 
 
 
65
  },
66
  ],
67
  },
@@ -72,7 +82,7 @@ export const routerExamples: RouterExample[] = [
72
  followUps: [
73
  {
74
  title: "Psychological analysis",
75
- prompt: "Provide a psychological analysis of Eminems emotions in this song.",
76
  },
77
  {
78
  title: "Wired Article",
@@ -82,6 +92,10 @@ export const routerExamples: RouterExample[] = [
82
  title: "Roleplay",
83
  prompt: "Roleplay as Eminem so I can discuss the song with him.",
84
  },
 
 
 
 
85
  ],
86
  },
87
  {
@@ -103,6 +117,11 @@ export const routerExamples: RouterExample[] = [
103
  prompt:
104
  "Rewrite the previous response from Yoda into plain English while keeping the same meaning.",
105
  },
 
 
 
 
 
106
  ],
107
  },
108
  {
@@ -111,13 +130,18 @@ export const routerExamples: RouterExample[] = [
111
  followUps: [
112
  {
113
  title: "Turn into JSON",
114
- prompt: `Generate a detailed JSON object for each prompt. Include fields for subjects (list of objects), scene (setting, environment, background details), actions (whats happening), style (artistic style or medium)`,
115
  },
116
  {
117
  title: "Sci-fi portraits",
118
  prompt:
119
  "Produce five futuristic character portrait prompts with unique professions and settings.",
120
  },
 
 
 
 
 
121
  ],
122
  },
123
  {
@@ -139,11 +163,16 @@ export const routerExamples: RouterExample[] = [
139
  prompt:
140
  "Summarize the explanation of large language models for a high school student using relatable analogies.",
141
  },
 
 
 
 
 
142
  ],
143
  },
144
  {
145
  title: "Translate in Italian",
146
- prompt: `Translate in Italian: Some are born great, some achieve greatness, and some have greatness thrust upon em`,
147
  followUps: [
148
  {
149
  title: "Back to English",
@@ -159,6 +188,11 @@ export const routerExamples: RouterExample[] = [
159
  prompt:
160
  "Modernize the Italian translation into contemporary informal Italian suitable for social media.",
161
  },
 
 
 
 
 
162
  ],
163
  },
164
  ];
 
28
  prompt:
29
  "Add a power-up mechanic to the Pong game so paddles temporarily grow when a player scores twice in a row.",
30
  },
 
31
  {
32
  title: "CRT Screen",
33
  prompt: "Add a CRT screen effect to the game",
34
  },
35
+ {
36
+ title: "Explain collision logic",
37
+ prompt:
38
+ "Explain the collision detection algorithm in the pong game in simple terms with examples.",
39
+ },
40
  ],
41
  },
42
  {
 
65
  },
66
  {
67
  title: "Translate to Italian",
68
+ prompt:
69
+ "Translate only the text content displayed to users (headings, paragraphs, buttons) into Italian. Keep all code, class names, and IDs unchanged.",
70
+ },
71
+ {
72
+ title: "Architecture review",
73
+ prompt:
74
+ "Review the architecture and suggest improvements for scalability, SEO optimization, and performance.",
75
  },
76
  ],
77
  },
 
82
  followUps: [
83
  {
84
  title: "Psychological analysis",
85
+ prompt: "Provide a psychological analysis of Eminem's emotions in this song.",
86
  },
87
  {
88
  title: "Wired Article",
 
92
  title: "Roleplay",
93
  prompt: "Roleplay as Eminem so I can discuss the song with him.",
94
  },
95
+ {
96
+ title: "Translate to Spanish",
97
+ prompt: "Translate the rap lyrics to Spanish while maintaining the rhyme scheme and flow.",
98
+ },
99
  ],
100
  },
101
  {
 
117
  prompt:
118
  "Rewrite the previous response from Yoda into plain English while keeping the same meaning.",
119
  },
120
+ {
121
+ title: "Compare philosophies",
122
+ prompt:
123
+ "Compare Yoda's Jedi philosophy to Stoic philosophy from ancient Greece and explain the similarities and differences.",
124
+ },
125
  ],
126
  },
127
  {
 
130
  followUps: [
131
  {
132
  title: "Turn into JSON",
133
+ prompt: `Generate a detailed JSON object for each prompt. Include fields for subjects (list of objects), scene (setting, environment, background details), actions (what's happening), style (artistic style or medium)`,
134
  },
135
  {
136
  title: "Sci-fi portraits",
137
  prompt:
138
  "Produce five futuristic character portrait prompts with unique professions and settings.",
139
  },
140
+ {
141
+ title: "Explain image generation",
142
+ prompt:
143
+ "Explain how text-to-image diffusion models work, covering the denoising process and how text prompts guide generation.",
144
+ },
145
  ],
146
  },
147
  {
 
163
  prompt:
164
  "Summarize the explanation of large language models for a high school student using relatable analogies.",
165
  },
166
+ {
167
+ title: "Write a blog post",
168
+ prompt:
169
+ "Write a blog post about how transformers revolutionized NLP, targeting software engineers who are new to AI.",
170
+ },
171
  ],
172
  },
173
  {
174
  title: "Translate in Italian",
175
+ prompt: `Translate in Italian: Some are born great, some achieve greatness, and some have greatness thrust upon 'em`,
176
  followUps: [
177
  {
178
  title: "Back to English",
 
188
  prompt:
189
  "Modernize the Italian translation into contemporary informal Italian suitable for social media.",
190
  },
191
+ {
192
+ title: "Teach me Italian",
193
+ prompt:
194
+ "Help me practice Italian by conversing about this Shakespeare quote, correcting my grammar when needed.",
195
+ },
196
  ],
197
  },
198
  ];
src/routes/+layout.svelte CHANGED
@@ -17,7 +17,6 @@
17
  import ExpandNavigation from "$lib/components/ExpandNavigation.svelte";
18
  import { loginModalOpen } from "$lib/stores/loginModal";
19
  import LoginModal from "$lib/components/LoginModal.svelte";
20
- import OverloadedModal from "$lib/components/OverloadedModal.svelte";
21
  import { setContext } from "svelte";
22
  import { handleResponse, useAPIClient } from "$lib/APIClient";
23
  import { isAborted } from "$lib/stores/isAborted";
@@ -39,8 +38,6 @@
39
 
40
  let isNavCollapsed = $state(false);
41
 
42
- let overloadedModalOpen = $state(false);
43
-
44
  let errorToastTimeout: ReturnType<typeof setTimeout>;
45
  let currentError: string | undefined = $state();
46
 
@@ -54,9 +51,6 @@
54
 
55
  currentError = $error;
56
 
57
- if (currentError === "Model is overloaded") {
58
- overloadedModalOpen = true;
59
- }
60
  errorToastTimeout = setTimeout(() => {
61
  $error = undefined;
62
  currentError = undefined;
@@ -234,10 +228,6 @@
234
  />
235
  {/if}
236
 
237
- {#if overloadedModalOpen && publicConfig.isHuggingChat}
238
- <OverloadedModal onClose={() => (overloadedModalOpen = false)} />
239
- {/if}
240
-
241
  <BackgroundGenerationPoller />
242
 
243
  <div
 
17
  import ExpandNavigation from "$lib/components/ExpandNavigation.svelte";
18
  import { loginModalOpen } from "$lib/stores/loginModal";
19
  import LoginModal from "$lib/components/LoginModal.svelte";
 
20
  import { setContext } from "svelte";
21
  import { handleResponse, useAPIClient } from "$lib/APIClient";
22
  import { isAborted } from "$lib/stores/isAborted";
 
38
 
39
  let isNavCollapsed = $state(false);
40
 
 
 
41
  let errorToastTimeout: ReturnType<typeof setTimeout>;
42
  let currentError: string | undefined = $state();
43
 
 
51
 
52
  currentError = $error;
53
 
 
 
 
54
  errorToastTimeout = setTimeout(() => {
55
  $error = undefined;
56
  currentError = undefined;
 
228
  />
229
  {/if}
230
 
 
 
 
 
231
  <BackgroundGenerationPoller />
232
 
233
  <div
tailwind.config.cjs CHANGED
@@ -9,7 +9,6 @@ module.exports = {
9
  theme: {
10
  extend: {
11
  colors: {
12
- primary: colors[process.env.PUBLIC_APP_COLOR],
13
  gray: {
14
  600: "#323843",
15
  700: "#252a33",
 
9
  theme: {
10
  extend: {
11
  colors: {
 
12
  gray: {
13
  600: "#323843",
14
  700: "#252a33",