coyotte508 HF staff commited on
Commit
7482c01
1 Parent(s): 4a0bbdf

Highlight current convo + fix sending bug (#37)

Browse files
src/routes/+layout.svelte CHANGED
@@ -92,7 +92,10 @@
92
  {#each data.conversations as conv}
93
  <a
94
  href="/conversation/{conv.id}"
95
- class="truncate py-3 px-3 rounded-lg flex-none text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center"
 
 
 
96
  >
97
  {conv.title}
98
 
 
92
  {#each data.conversations as conv}
93
  <a
94
  href="/conversation/{conv.id}"
95
+ class="truncate py-3 px-3 rounded-lg flex-none text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center {conv.id ===
96
+ $page.params.id
97
+ ? 'bg-gray-100 dark:bg-gray-700'
98
+ : ''}"
99
  >
100
  {conv.title}
101
 
src/routes/conversation/[id]/+page.svelte CHANGED
@@ -5,18 +5,18 @@
5
  import type { PageData } from './$types';
6
  import { page } from '$app/stores';
7
  import { HfInference } from '@huggingface/inference';
 
8
 
9
  export let data: PageData;
10
 
11
  $: messages = data.messages;
12
 
13
  const hf = new HfInference();
14
- const model = hf.endpoint($page.url.href);
15
 
16
  let loading = false;
17
 
18
  async function getTextGenerationStream(inputs: string) {
19
- const response = model.textGenerationStream(
20
  {
21
  inputs,
22
  parameters: {
@@ -63,6 +63,9 @@
63
  messages = [...messages, { from: 'user', content: message }];
64
 
65
  await getTextGenerationStream(message);
 
 
 
66
  } finally {
67
  loading = false;
68
  }
 
5
  import type { PageData } from './$types';
6
  import { page } from '$app/stores';
7
  import { HfInference } from '@huggingface/inference';
8
+ import { invalidate } from '$app/navigation';
9
 
10
  export let data: PageData;
11
 
12
  $: messages = data.messages;
13
 
14
  const hf = new HfInference();
 
15
 
16
  let loading = false;
17
 
18
  async function getTextGenerationStream(inputs: string) {
19
+ const response = hf.endpoint($page.url.href).textGenerationStream(
20
  {
21
  inputs,
22
  parameters: {
 
63
  messages = [...messages, { from: 'user', content: message }];
64
 
65
  await getTextGenerationStream(message);
66
+
67
+ // Reload conversation order - doesn't seem to work
68
+ // await invalidate('/');
69
  } finally {
70
  loading = false;
71
  }