julien-c HF staff commited on
Commit
bd8c7a0
1 Parent(s): cb6af22

move type to its own file

Browse files
src/lib/Types.ts ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ export type Message =
2
+ | {
3
+ from: 'user';
4
+ content: string;
5
+ }
6
+ | {
7
+ from: 'bot';
8
+ content: string;
9
+ };
10
+
src/lib/chat/ChatBox.svelte CHANGED
@@ -1,5 +1,7 @@
1
  <script lang="ts">
2
- export let message;
 
 
3
  </script>
4
 
5
  {#if message.from === 'bot'}
 
1
  <script lang="ts">
2
+ import type { Message } from '$lib/Types';
3
+
4
+ export let message: Message;
5
  </script>
6
 
7
  {#if message.from === 'bot'}
src/lib/chat/ChatIntroduction.svelte CHANGED
@@ -1,7 +1,7 @@
1
  <script lang="ts">
2
  import { PUBLIC_DISABLE_INTRO_TILES, PUBLIC_MODEL_NAME, PUBLIC_MODEL_TAGLINE } from '$env/static/public';
3
 
4
- export let title: string = '';
5
  </script>
6
 
7
  <div class="grid grid-cols-3 gap-3 my-auto">
 
1
  <script lang="ts">
2
  import { PUBLIC_DISABLE_INTRO_TILES, PUBLIC_MODEL_NAME, PUBLIC_MODEL_TAGLINE } from '$env/static/public';
3
 
4
+ export let title: string = 'Joi 20B Instruct';
5
  </script>
6
 
7
  <div class="grid grid-cols-3 gap-3 my-auto">
src/routes/+page.svelte CHANGED
@@ -2,17 +2,10 @@
2
  import { fetchEventSource } from '@microsoft/fetch-event-source';
3
  import ChatBox from '$lib/chat/ChatBox.svelte';
4
  import ChatIntroduction from '$lib/chat/ChatIntroduction.svelte';
 
 
5
  const ENDPOINT = 'https://joi-20b.ngrok.io/generate_stream';
6
 
7
- type Message =
8
- | {
9
- from: 'user';
10
- content: string;
11
- }
12
- | {
13
- from: 'bot';
14
- content: string;
15
- };
16
 
17
  let messages: Message[] = [];
18
  let message = '';
@@ -104,7 +97,7 @@
104
  {#each messages as message}
105
  <ChatBox {message} />
106
  {:else}
107
- <ChatIntroduction title="Joi 20B Instruct" />
108
  {/each}
109
  <div class="h-32 flex-none" />
110
  </div>
 
2
  import { fetchEventSource } from '@microsoft/fetch-event-source';
3
  import ChatBox from '$lib/chat/ChatBox.svelte';
4
  import ChatIntroduction from '$lib/chat/ChatIntroduction.svelte';
5
+ import type { Message } from '$lib/Types';
6
+
7
  const ENDPOINT = 'https://joi-20b.ngrok.io/generate_stream';
8
 
 
 
 
 
 
 
 
 
 
9
 
10
  let messages: Message[] = [];
11
  let message = '';
 
97
  {#each messages as message}
98
  <ChatBox {message} />
99
  {:else}
100
+ <ChatIntroduction />
101
  {/each}
102
  <div class="h-32 flex-none" />
103
  </div>