coyotte508 HF staff commited on
Commit
b7f9ccb
1 Parent(s): b7167b0

✨ Make chat intro buttons work (#38)

Browse files
.env CHANGED
@@ -8,7 +8,7 @@ HF_TOKEN=#your huggingface token here
8
  PUBLIC_MODEL_ENDPOINT=https://api-inference.huggingface.co/models/OpenAssistant/oasst-sft-1-pythia-12b
9
  PUBLIC_MODEL_NAME=OpenAssistant/oasst-sft-1-pythia-12b
10
  PUBLIC_MODEL_TAGLINE=This is the first iteration English supervised-fine-tuning (SFT) model of the <a class="underline" href="https://github.com/LAION-AI/Open-Assistant">Open-Assistant</a> project. It is based on a Pythia 12B that was fine-tuned on ~22k human demonstrations of assistant conversations collected through the <a class="underline" href="https://open-assistant.io/">https://open-assistant.io/</a> human feedback web app before March 7, 2023.
11
- PUBLIC_DISABLE_INTRO_TILES=true
12
  PUBLIC_USER_MESSAGE_TOKEN=<|prompter|>
13
  PUBLIC_ASSISTANT_MESSAGE_TOKEN=<|assistant|>
14
  PUBLIC_SEP_TOKEN=<|endoftext|>
 
8
  PUBLIC_MODEL_ENDPOINT=https://api-inference.huggingface.co/models/OpenAssistant/oasst-sft-1-pythia-12b
9
  PUBLIC_MODEL_NAME=OpenAssistant/oasst-sft-1-pythia-12b
10
  PUBLIC_MODEL_TAGLINE=This is the first iteration English supervised-fine-tuning (SFT) model of the <a class="underline" href="https://github.com/LAION-AI/Open-Assistant">Open-Assistant</a> project. It is based on a Pythia 12B that was fine-tuned on ~22k human demonstrations of assistant conversations collected through the <a class="underline" href="https://open-assistant.io/">https://open-assistant.io/</a> human feedback web app before March 7, 2023.
11
+ PUBLIC_DISABLE_INTRO_TILES=false
12
  PUBLIC_USER_MESSAGE_TOKEN=<|prompter|>
13
  PUBLIC_ASSISTANT_MESSAGE_TOKEN=<|assistant|>
14
  PUBLIC_SEP_TOKEN=<|endoftext|>
src/lib/components/chat/ChatIntroduction.svelte CHANGED
@@ -2,6 +2,9 @@
2
  import { PUBLIC_DISABLE_INTRO_TILES, PUBLIC_MODEL_NAME } from '$env/static/public';
3
 
4
  import Logo from '$lib/components/icons/Logo.svelte';
 
 
 
5
  </script>
6
 
7
  <div class="grid lg:grid-cols-3 gap-8 my-auto">
@@ -26,34 +29,56 @@
26
  class="flex items-center gap-4 px-3 py-2 bg-gray-100 rounded-xl text-sm text-gray-600 dark:text-gray-300 dark:bg-gray-800"
27
  >
28
  <!-- need to change link to a public model before launch -->
29
- <a href="https://huggingface.co/OpenAssistant/llama_30b_oasst_latcyr_1000" target="_blank"
30
- >Model page</a
31
- >
32
- <a href="https://huggingface.co/datasets/OpenAssistant/oasst1" target="_blank"
33
- >Dataset page</a
34
  >
35
- <a href="https://open-assistant.io/" target="_blank" class="ml-auto"
36
- >Open Assistant website</a
 
 
 
 
37
  >
 
 
 
 
 
38
  </div>
39
  </div>
40
  </div>
41
- {#if PUBLIC_DISABLE_INTRO_TILES}
42
  <div class="lg:col-span-3 lg:mt-12">
43
  <p class="mb-3 text-gray-600 dark:text-gray-300">Examples</p>
44
  <div class="grid lg:grid-cols-3 gap-3 lg:gap-5">
45
  <button
 
46
  class="text-gray-600 dark:text-gray-300 p-4 bg-gray-50 dark:bg-gray-800 dark:hover:bg-gray-700 hover:bg-gray-100 border dark:border-gray-800 rounded-xl"
47
- >"Write an email from bullet list"</button
 
 
 
 
48
  >
 
 
49
  <button
 
50
  class="text-gray-600 dark:text-gray-300 p-4 bg-gray-50 dark:bg-gray-800 dark:hover:bg-gray-700 hover:bg-gray-100 border dark:border-gray-800 rounded-xl"
51
- >"Code a snake game"</button
 
52
  >
 
 
53
  <button
 
54
  class="text-gray-600 dark:text-gray-300 p-4 bg-gray-50 dark:bg-gray-800 dark:hover:bg-gray-700 hover:bg-gray-100 border dark:border-gray-800 rounded-xl"
55
- >"Assist in a task"</button
56
  >
 
 
57
  </div>
58
  </div>
59
  {/if}
 
2
  import { PUBLIC_DISABLE_INTRO_TILES, PUBLIC_MODEL_NAME } from '$env/static/public';
3
 
4
  import Logo from '$lib/components/icons/Logo.svelte';
5
+ import { createEventDispatcher } from 'svelte';
6
+
7
+ const dispatch = createEventDispatcher<{ message: string }>();
8
  </script>
9
 
10
  <div class="grid lg:grid-cols-3 gap-8 my-auto">
 
29
  class="flex items-center gap-4 px-3 py-2 bg-gray-100 rounded-xl text-sm text-gray-600 dark:text-gray-300 dark:bg-gray-800"
30
  >
31
  <!-- need to change link to a public model before launch -->
32
+ <a
33
+ href="https://huggingface.co/OpenAssistant/llama_30b_oasst_latcyr_1000"
34
+ target="_blank"
35
+ rel="noreferrer"
 
36
  >
37
+ Model page
38
+ </a>
39
+ <a
40
+ href="https://huggingface.co/datasets/OpenAssistant/oasst1"
41
+ target="_blank"
42
+ rel="noreferrer"
43
  >
44
+ Dataset page
45
+ </a>
46
+ <a href="https://open-assistant.io/" target="_blank" class="ml-auto" rel="noreferrer">
47
+ Open Assistant website
48
+ </a>
49
  </div>
50
  </div>
51
  </div>
52
+ {#if PUBLIC_DISABLE_INTRO_TILES !== 'true'}
53
  <div class="lg:col-span-3 lg:mt-12">
54
  <p class="mb-3 text-gray-600 dark:text-gray-300">Examples</p>
55
  <div class="grid lg:grid-cols-3 gap-3 lg:gap-5">
56
  <button
57
+ type="button"
58
  class="text-gray-600 dark:text-gray-300 p-4 bg-gray-50 dark:bg-gray-800 dark:hover:bg-gray-700 hover:bg-gray-100 border dark:border-gray-800 rounded-xl"
59
+ on:click={() =>
60
+ dispatch(
61
+ 'message',
62
+ 'Write an email from bullet list: \n\n- Buy milk\n- Buy eggs\n- Buy bread'
63
+ )}
64
  >
65
+ "Write an email from bullet list"
66
+ </button>
67
  <button
68
+ type="button"
69
  class="text-gray-600 dark:text-gray-300 p-4 bg-gray-50 dark:bg-gray-800 dark:hover:bg-gray-700 hover:bg-gray-100 border dark:border-gray-800 rounded-xl"
70
+ on:click={() =>
71
+ dispatch('message', 'Code a snake game in python, the snake should be red')}
72
  >
73
+ "Code a snake game"
74
+ </button>
75
  <button
76
+ type="button"
77
  class="text-gray-600 dark:text-gray-300 p-4 bg-gray-50 dark:bg-gray-800 dark:hover:bg-gray-700 hover:bg-gray-100 border dark:border-gray-800 rounded-xl"
78
+ on:click={() => dispatch('message', 'How do I make a lemon cheesecake?')}
79
  >
80
+ "Assist in a task"
81
+ </button>
82
  </div>
83
  </div>
84
  {/if}
src/lib/components/chat/ChatMessages.svelte CHANGED
@@ -15,7 +15,7 @@
15
  {#each messages as message}
16
  <ChatMessage {message} />
17
  {:else}
18
- <ChatIntroduction />
19
  {/each}
20
  <div class="h-32 flex-none" />
21
  </div>
 
15
  {#each messages as message}
16
  <ChatMessage {message} />
17
  {:else}
18
+ <ChatIntroduction on:message />
19
  {/each}
20
  <div class="h-32 flex-none" />
21
  </div>
src/lib/components/chat/ChatWindow.svelte CHANGED
@@ -21,7 +21,7 @@
21
  <button>New Chat</button>
22
  <button>+</button>
23
  </nav>
24
- <ChatMessages {messages} />
25
  <div
26
  class="flex max-md:border-t dark:border-gray-800 items-center max-md:dark:bg-gray-900 max-md:bg-white bg-gradient-to-t from-white dark:from-gray-900 to-transparent justify-center absolute inset-x-0 max-w-3xl xl:max-w-4xl mx-auto px-5 bottom-0 py-4 md:py-8 w-full"
27
  >
 
21
  <button>New Chat</button>
22
  <button>+</button>
23
  </nav>
24
+ <ChatMessages {messages} on:message />
25
  <div
26
  class="flex max-md:border-t dark:border-gray-800 items-center max-md:dark:bg-gray-900 max-md:bg-white bg-gradient-to-t from-white dark:from-gray-900 to-transparent justify-center absolute inset-x-0 max-w-3xl xl:max-w-4xl mx-auto px-5 bottom-0 py-4 md:py-8 w-full"
27
  >